|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
connecting mysql with PHP
hello all
i a new to this group hi.. i a new member to this forum...and i am using Red Hat 9 . I found my problem matching with the this thread.. Thread titled as "Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.3 After Upgrade " As i followed the thread it ..i do get the same error as the last posted message in the thread and since i didn't find any follow up after this post ..i dont know what to do... i get the following error messages "Details: Error writing file 'applications:/Internet/redhat-web.desktop': Read-only file system" and i also have another problem i am not able to open .html files by double clicking with the mouse..or even by rightclick->open/openwith->mozilla. Please Help suresh **************************************** insert into <table name> values(&id,'&title'&actor); <table border=1> <tr><th>Movie</th><th>Year</th><th>Actor</th><tr> hello everybody i am not able to connect to mysql databse ,i am just learning PHP, MySQL ,i use Red hat 9. i have just written a simple program 1 <html> 2 <head><title> Bond Movies </title></head> 3 <body> 4 <?php 5 //open database connection and use dooondo databse 6 mysql_connect("localhost","ananth","kaavi123"); 7 echo"$connection"; 8 mysql_select_db("doondo",$connection); 9 $result=mysql_query("SELECT * FROM movies",$connection); 10 while($row=mysql_fetch_row($result)) 11 { 12 for ($i=0; $i<mysql_num_fields($result);$i++) 13 echo $row[$i]. " "; 14 echo "\n" ; 15 mysql_close($connection); 16 } 17 ?> 18 </body> 19 </html> i get the error message as Warning: Access denied for user: 'ananth@localhost' (Using password: YES) in /home/sites/doondo/examples/bondmovies.php on line 6 Warning: MySQL Connection Failed: Access denied for user: 'ananth@localhost' (Using password: YES) in /home/sites/doondo/examples/bondmovies.php on line 6 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/sites/doondo/examples/bondmovies.php on line 8 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/sites/doondo/examples/bondmovies.php on line 9 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/sites/doondo/examples/bondmovies.php on line 10 the m/c i use has the PHP, Mysql, appache installed in it please help |
|
#2
|
|||
|
|||
|
Did you ever assign $connection to anything? Like this:
$connection = mysql_connect("localhost", "username", "password"); |
|
#3
|
|||
|
|||
|
..oh no..
but after adding the line $connection=mysql_connect("localhost","ananth","kaavi123"); i still get the same error .. |
|
#4
|
|||
|
|||
|
hello..
and when i tried a more simple program.. <html> <body> <?php $conn=mysql_connect("kaavi-server","ananth","xxxxx"); ?> </body> </html> i get the following error Warning: Host 'kaavi-server' is not allowed to connect to this MySQL server in /home/sites/doondo/examples/sqlconnect.php on line 4 Warning: MySQL Connection Failed: Host 'kaavi-server' is not allowed to connect to this MySQL server in /home/sites/doondo/examples/sqlconnect.php on line 4 for more info when i tried the same code just with replacing the "kaavi-server" by "localhost" i get the following errors <html> <body> <?php $conn=mysql_connect("localhost","ananth","xxxxx"); ?> </body> </html> Warning: Access denied for user: 'ananth@localhost' (Using password: YES) in /home/sites/doondo/examples/sqlconnect.php on line 4 Warning: MySQL Connection Failed: Access denied for user: 'ananth@localhost' (Using password: YES) in /home/sites/doondo/examples/sqlconnect.php on line 4 more over i connect to appache webserver by http://kaavi-server:90/examples/sqlconnect.php for addition information when i execute the following commands i get [ananth@kaavi-server examples]$ hostname -d [ananth@kaavi-server examples]$ hostname -s kaavi-server [ananth@kaavi-server examples]$ hostname -a localhost.localdomain localhost [ananth@kaavi-server examples]$ hostname -f kaavi-server |
|
#5
|
|||
|
|||
|
still i am not connect to the databse....!
do i have to create a seperate user for connecting into mysql database thru php..? Please any body help me out |
|
#6
|
|||
|
|||
|
hi, is your database named "doondo" or "dooondo" ?
|
|
#7
|
||||
|
||||
|
Quote:
Hmm, like that makes sense... Ontopic: Yes, you have to create a user for your MySQL. You can use the root-user, but I would disencourage that. Do you have PHPMyAdmin installed? It's an easy tool to administrate your MySQL. Create a user which only can connect from localhost. The connection string would then look like this: PHP Code:
This way it should work. I get the idea that you are trying to connect with a user which doesn't have sufficient rights to do so. [edit] Maybe there is something wrong in your php.ini Please first try the thing above, if it still doesn't work look if you don't have a standard user configured for your MySQL. [/edit] Cheers
__________________
Work to live, don't live to work |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > connecting mysql with PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|