MySqlTalk.com  

Go Back   MySqlTalk.com > Programming Languages and MySQL > PHP
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread
Old 09-13-2004, 05:15 AM   #1
fourthnoel
Junior Member
 
Join Date: Sep 2004
Posts: 1 fourthnoel is on a distinguished road
Exclamation mysql_connect

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...?
fourthnoel is offline   Fork this post Reply With Quote
Old 10-20-2004, 03:15 PM   #2
Azkaban
Senior Member
 
Join Date: Jul 2004
Posts: 167 Azkaban is on a distinguished road
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>";
Azkaban is offline   Fork this post Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -4. The time now is 06:37 AM.



Powered by: vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Google
  Web http://www.mysqltalk.com
DISCLAIMERS:
1. We have no commercial interest in this site.
Banner Ads and Subscriptions will only be used to help pay for hosting and maintenance costs.
2. MySQLTalk.com is NOT affiliated with MySQL AB in any way.
3. MySQLTalk.com is NOT endorsed by MySQL AB in any way.
4. Please do not post any content that is harmful to MySQL or MySQL AB, meaning no misleading or obsolete information will be tolerated.
Well-founded constructive criticism meant to help the community is permitted.
5. This website is founded with the goal of improving the MySQL community.
We not only tolerate newbies, we encourage them.
Please do not ask newbies to "read the manual".