[PHP-DB] Re: Newbie Setup Trouble
Hi! first of all, the fatal error indicates that the mysql extension is missing or just disabled. To find out what's wrong check for the file php_mysql.(so|dll) [using *nix|Windows] in the php-extension directory. If present, then open the php.ini file and search for the string extension=php_mysql and delete the ; in front of it, if present. Stop and start webserver and try again. Alternatively you should install XAMPP or similar which installs Apache, PHP and MySQL at once. This makes life easier for beginners. Stefan Mike Rondeau wrote: Hello, I have just begun study of using PHP, MySQL and Apache server. Right now I'm following a book, PHP and MySQL For Dummies and am having trouble already. I must be a REAL dummy! I have installed all 3 programs but something is not right somewhere. Being so new to this I am having a real time trying to figure out which program is messed up. Certain things work, but others don't. For instance, my book told me how to make a phpinfo.php page, which works fine. But it also tells me to create some other pages to test if PHP and MySQL are working or not. I followed the scripts provided exactly but keep getting syntax errors, even though the script is just what the authors wrote. For instance, it said to make a page and call it mysql_up.php. Here's the script for it: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost; $user=blablablabla; $password=blablabla; mysql_connect($host,$user,$password); $sql=show status; $result = mysql_query($sql); if ($result == 0) { echo bError . mysql_errno() . : . mysql_error() . /b; } else { ? !-- Table that displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html But when I open it in my browser I get this error: Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 10 Could anyone of you smart people point me in the right direction? I'd be pulling my hair out if I had any left :) I can't make any progress with this study until I know my 3 programs are talking to eachother properly, but my book gives no info on this error. Thanks a millionfold for any advice, and I appologise for the length of this post. Sincerely, Mike Rondeau -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Newbie Setup Trouble
The code appears to be correct. But it sounds like a problem with the php/mysql integration. Try reinstalling PHP with the correct mysql libraries. In phpinfo check that mysql support is enabled. If you are not technical and would just like to learn the PHP language not how to configure it etc. I would recommend you use a PHP software installation package (it basically installs everything for you). I think this installation kit supports windoze + Linux:- http://www.apachefriends.org/en/xampp.html Hope that helps, Gareth On 7 Feb 2005, at 14:55, [EMAIL PROTECTED] wrote: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost; $user=blablablabla; $password=blablabla; mysql_connect($host,$user,$password); $sql=show status; $result = mysql_query($sql); if ($result == 0) { echo bError . mysql_errno() . : . mysql_error() . /b; } else { ? !-- Table that displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Newbie Setup Trouble
Mike, There is no database sepcified in your code anywhere. The line: $result = mysql_query($sql); does not specify which database you are connecting to either. You can specify the database in the line: $link = mysql_connect($host,$user,$password,$database);//or in a separate line with the function mysql_select_db(database name,$link)//where $link is the connection info above And then use in the line: $result = mysql_query($link, $sql); //this enable the query to find the connection and the code. I hope this makes sense. I have only been doing this a couple of weeks. Some books have the ($link,$sql) order reversed which will also give you an error. IN ADDITION, if you are using mysqli you need to enter this ext in the PHP.ini file. I can only connect using mysqli and not mysql. Good luck, jzf This should help you. Mike Rondeau wrote: Hello, I have just begun study of using PHP, MySQL and Apache server. Right now I'm following a book, PHP and MySQL For Dummies and am having trouble already. I must be a REAL dummy! I have installed all 3 programs but something is not right somewhere. Being so new to this I am having a real time trying to figure out which program is messed up. Certain things work, but others don't. For instance, my book told me how to make a phpinfo.php page, which works fine. But it also tells me to create some other pages to test if PHP and MySQL are working or not. I followed the scripts provided exactly but keep getting syntax errors, even though the script is just what the authors wrote. For instance, it said to make a page and call it mysql_up.php. Here's the script for it: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost; $user=blablablabla; $password=blablabla; mysql_connect($host,$user,$password); $sql=show status; $result = mysql_query($sql); if ($result == 0) { echo bError . mysql_errno() . : . mysql_error() . /b; } else { ? !-- Table that displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html But when I open it in my browser I get this error: Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 10 Could anyone of you smart people point me in the right direction? I'd be pulling my hair out if I had any left :) I can't make any progress with this study until I know my 3 programs are talking to eachother properly, but my book gives no info on this error. Thanks a millionfold for any advice, and I appologise for the length of this post. Sincerely, Mike Rondeau -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Newbie Setup Trouble
Its very likely that he has installed the latest versions of mysql and php and is using the incorrect library to try and make it go...change to the latest mysqli librabry and try again basiten From: Stefan Reimers [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] Re: Newbie Setup Trouble Date: Mon, 07 Feb 2005 16:17:45 +0100 Hi! first of all, the fatal error indicates that the mysql extension is missing or just disabled. To find out what's wrong check for the file php_mysql.(so|dll) [using *nix|Windows] in the php-extension directory. If present, then open the php.ini file and search for the string extension=php_mysql and delete the ; in front of it, if present. Stop and start webserver and try again. Alternatively you should install XAMPP or similar which installs Apache, PHP and MySQL at once. This makes life easier for beginners. Stefan Mike Rondeau wrote: Hello, I have just begun study of using PHP, MySQL and Apache server. Right now I'm following a book, PHP and MySQL For Dummies and am having trouble already. I must be a REAL dummy! I have installed all 3 programs but something is not right somewhere. Being so new to this I am having a real time trying to figure out which program is messed up. Certain things work, but others don't. For instance, my book told me how to make a phpinfo.php page, which works fine. But it also tells me to create some other pages to test if PHP and MySQL are working or not. I followed the scripts provided exactly but keep getting syntax errors, even though the script is just what the authors wrote. For instance, it said to make a page and call it mysql_up.php. Here's the script for it: html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost; $user=blablablabla; $password=blablabla; mysql_connect($host,$user,$password); $sql=show status; $result = mysql_query($sql); if ($result == 0) { echo bError . mysql_errno() . : . mysql_error() . /b; } else { ? !-- Table that displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html But when I open it in my browser I get this error: Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 10 Could anyone of you smart people point me in the right direction? I'd be pulling my hair out if I had any left :) I can't make any progress with this study until I know my 3 programs are talking to eachother properly, but my book gives no info on this error. Thanks a millionfold for any advice, and I appologise for the length of this post. Sincerely, Mike Rondeau -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Newbie Setup Trouble
To all, I am sorry the correct line is: mysql_select_db($link,database name) If you are missing the database name you will get an error concerning undefined function. jzf J. Connolly wrote: Mike, There is no database sepcified in your code anywhere. The line: $result = mysql_query($sql); does not specify which database you are connecting to either. You can specify the database in the line: $link = mysql_connect($host,$user,$password,$database);//or in a separate line with the function mysql_select_db(database name,$link)//where $link is the connection info above And then use in the line: $result = mysql_query($link, $sql); //this enable the query to find the connection and the code. I hope this makes sense. I have only been doing this a couple of weeks. Some books have the ($link,$sql) order reversed which will also give you an error. IN ADDITION, if you are using mysqli you need to enter this ext in the PHP.ini file. I can only connect using mysqli and not mysql. Good luck, jzf -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Newbie Setup Trouble
To: php-db@lists.php.net From: Mike Rondeau [EMAIL PROTECTED] Date: Sun, 6 Feb 2005 17:57:17 -0800 Subject: Newbie Setup Trouble Hello, Hi :) I have just begun study of using PHP, MySQL and Apache server. Right now I'm following a book, PHP and MySQL For Dummies and am having trouble already. I must be a REAL dummy! That is where your wrong in my opinion, only dummies would understand that book, smart people would NOT understand it. So your the smart one. :) I have installed all 3 programs but something is not right somewhere. Your not a dummy if you know there is something wrong, somewhere. ;) (seriously) Being so new to this I am having a real time trying to figure out which program is messed up. We all learn and start somewhere. ;) Certain things work, but others don't. Reminds me of Windows! ;) For instance, my book told me how to make a phpinfo.php page, which works fine. Your phpinfo() is working. YAY! But it also tells me to create some other pages to test if PHP and MySQL are working or not. I followed the scripts provided exactly but keep getting syntax errors, even though the script is just what the authors wrote. Yes depends on PHP version, mysql version to start with, some are different and also can depend on linux type/version if things work or not exactly as they are written. For instance, it said to make a page and call it mysql_up.php. Here's the script for it: Lets see! html headtitleTest MySQL/title/head body !-- mysql_up.php -- ?php $host=localhost; $user=blablablabla; $password=blablabla; mysql_connect($host,$user,$password); $sql=show status; $result = mysql_query($sql); if ($result == 0) { echo bError . mysql_errno() . : . mysql_error() . /b; } else { ? !-- Table that displays the results -- table border=1 trtdbVariable_name/b/tdtdbValue/b /td/tr ?php for ($i = 0; $i mysql_num_rows($result); $i++) { echo TR; $row_array = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo TD . $row_array[$j] . /td; } echo /tr; } ? /table ?php } ? /body/html But when I open it in my browser I get this error: Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\mysql_up.php on line 10 Could anyone of you smart people point me in the right direction? I'd be pulling my hair out if I had any left :) First off is the database name and password created as the code says? You need to create the connection to the database as a username before php can use it. I can't make any progress with this study until I know my 3 programs are talking to eachother properly, but my book gives no info on this error. Thanks a millionfold for any advice, and I appologise for the length of this post. Sincerely, Mike Rondeau That's a starting point.. http://mysql.net Search : Creating a User Account ...Reveals how to... Than Search : Connection String or Creating a Connection String ...Reveals how to... Experiment with the site and or http://mysql.com and http://php.net with the search terms above. If it relates to database be on mysql site and if it relates to using php to use mysql look on php site. Learn to use the site with the search, instead of us posting URL's here for you as shortcuts and you not learning how to use the site I suggest you try the site and if problems occour mail us. :) I hope this helps somewhat and points you into the right direction. J Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Newbie Setup Trouble
Hello list, I'd just like to thank everyone who jumped right in with their insights and suggestions to my troubles. There's a lot to get me going there! Every one of those posts was helpful. I have downloaded XAMPP and am going to install it here in a minute. Armed with that, and the use of search as Jerry suggested, I bet all will go much more smoothely now, hehe. Just wanted to affirm to you all that your assistance was appreciated :) ~Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php