Reply to Re: accessing database in wamp environment

Your name:

Reply:


Posted by Jerry Stuckle on 07/25/07 04:04

scout3014@gmail.com wrote:
> On Jul 25, 11:45 am, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> scout3...@gmail.com wrote:
>>> Hi
>>> I am using WAMP5 to create web applications. I have a problem as far
>>> as accessing the database is concerned. This following code is used to
>>> access database:
>>> $con = mysql_connect("localhost", "root", "");
>>> if (!con) {
>>> die('Could not Connect' . mysql_error());
>>> }
>>> mysql_select_db("Leave", $con);
>>> $data = mysql_query("SELECT * FROM loginInfo WHERE username=" .
>>> $username);
>>> if(!$data){
>>> die('Invalid username: ' . mysql_error());
>>> }
>>> else{
>>> ...... //processing login
>>> ......
>>> }
>>> When i activate this code by logging in, the following is shown:
>>> "Invalid username: No database selected"
>>> I would like to know if there is anything wrong with my database
>>> connection for my database is correct. My database name on e
>>> SQLiteManager is 'Leave' and my table is "loginInfo"
>>> Help is much appreciated
>>> Regards
>>> Eugene
>> What's the result of your mysql_select_db call? It returns true/false
>> depending on whether the request worked/failed. If you get false back,
>> what's the error?
>>
>> - Show quoted text -
>
> if (!mysql_select_db("leave", $con)){
> die (mysql_error());
> }
>
> using the following code, the error message is as shown:
> Unknown database 'leave'
>
> Like i was saying my database name was "Leave" with capital L so i do
> not know why they put in in small case
>

Well, I'm not sure who "they" is - but looks like you need to change the
mysql_select_db call.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация