![]() |
|
|
#1 |
|
Junior Member
Join Date: Sep 2004
Posts: 1
|
Hello guys out there..!!
This is my first time using mysql and php...could someone help me for connecting to mysql database please...!! im getting this error...!! Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\php\dat.php on line 9 and heres my code $db = mysql_connect('localhost', 'root', 'roots'); mysql_select_db("test",$db); $result = mysql_query("SELECT * FROM employees",$db); printf("First Name: %s<br>\n", mysql_result($result,0,"first")); printf("Last Name: %s<br>\n", mysql_result($result,0,"last")); printf("Address: %s<br>\n", mysql_result($result,0,"address")); printf("Position: %s<br>\n", mysql_result($result,0,"position")); ?> i installed mysql 5.01 and php 5.01 also...now i got this code from some tutorials but still not working? i also tried to remove password like but still the same error occurs...!! $db = mysql_connect('localhost', 'root'); so my problem is how i could display this mysql database to my php page...? |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2004
Posts: 167
|
Re: mysql_connect
Before trying out your own code, try phpMyAdmin and see if the statements you use are responding. Then slowly add little pieces and test it one by one rather than using all that code.
Also, rather than printf, try something like echo "First Name: $result[first]<br>"; |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|