Re: PHP and MySQL help please !
Hello, Try this ? function samp_db_connect() { $hostname = localhost; $username = joe; $password = user; $dbName = test; $link = @mysql_pconnect($hostname, $username, $password); if ($link mysql_select_db($dbName)) return $link; return FALSE; } samp_db_connect() or exit(); ? good luck Andrew Rich wrote: Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL help please !
Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL help please !
Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php + I think my PHP does not have mysql included, although I put in the ./configure --with mysql=/usr/local/mysql \ + When I type which mysql it says /usr/bin/msql + So should I put:- ./configure --with-mysql=/usr/local/mysql OR ./configure --with-mysql=/usr/bin/mysql ? I am not sure if the include statement is design to add mysql BINARIES or SOURCE CODE ?? Lost. Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:28 AM To: Andrew Rich; [EMAIL PROTECTED] Subject: RE: PHP and MySQL help please ! Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: PHP and MySQL help please !
I am not sure if the include statement is design to add mysql BINARIES or SOURCE CODE ?? Neither. It's eventually going to link the final php binary with the mysql shared libraries (probably libmysqlclient). I'm not too familiar with PHP, so I don't know if '--with-mysql=' wants the location of the MySQL root directory (typically /usr/local/mysql for source installations) or the directory that contains the libraries (like above, but /usr/local/mysql/lib). Check to see if /usr/local/mysql exists first. Better yet, try this: find /usr -name libmysqlclient* Hopefully, it will show you the location of one (or more) MySQL client libraries. Start there. Michael On Thu, 25 Apr 2002, Andrew Rich wrote: Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php + I think my PHP does not have mysql included, although I put in the ./configure --with mysql=/usr/local/mysql \ + When I type which mysql it says /usr/bin/msql + So should I put:- ./configure --with-mysql=/usr/local/mysql OR ./configure --with-mysql=/usr/bin/mysql ? I am not sure if the include statement is design to add mysql BINARIES or SOURCE CODE ?? Lost. Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:28 AM To: Andrew Rich; [EMAIL PROTECTED] Subject: RE: PHP and MySQL help please ! Further to this, I removed the @ symbol and got:- Fatal Error: Call to undefined function: mysql_connect() in /var/www/html/results.php @ $db = mysql_pconnect(localhost, user, password); $db = mysql_pconnect(localhost, user, password); Ideas ? Why is it now a undefined function ? Andrew -Original Message- From: Andrew Rich [mailto:[EMAIL PROTECTED]] Sent: Thursday, 25 April 2002 11:14 AM To: [EMAIL PROTECTED] Subject: PHP and MySQL help please ! + PHP Installed and going - I can write to files, retrieve flatfiles + Apache running servers outpages nop probes Trying to talk to SQL using PHP. -- html body h1Go to SQL now/h1 ? echo looking; @ $db = mysql_pconnect(localhost, user, password); if (!$db); { echo Error: Could not connect to database. Please try again later.; exit; } mysql_select_db(test); $query = select * from logbook ; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo pNumber of books found: .$num_results./p; ? /body /html - What gets me if I can do all this from the mysql prompt:- laptopmysql -u user -p (enterpassword gets me in) mysqluse test; OK mysqlselect * from logbook; OK (shows entries no probs); - What am I doing wrong ? It doesnt get past the @ $db = mysql_pconnect(localhost, user, password); in the code. ?? Andrew --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm --- Andrew Rich Callsign: VK4TEC [EMAIL PROTECTED] www.users.bigpond.com/andrew.rich/vk4tec.htm - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- /*-- * It might look like I'm doing nothing, but at the cellular level * I'm really quite busy. * ---anonymous * * * -BEGIN GEEK CODE BLOCK- * Version: 3.1 * GCS/P/H/L/O d- s-:-- a26 C++(+++) UL+++$ P++ L+++ !E W+++ N- o? K- * w--(---) !O M+ !V PS+ PE- Y-- PGP- t+ 5-(--) X(-) R* tv b+ DI-- D-- G e+++ * h+ r* y-- * --END GEEK CODE BLOCK-- --*/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http