[PHP-DB] anonymous select error
To: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I'm trying this query: $link = mysql_connect( $site, $id, $pass ); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfullybr'; $db = mysql_select_db( $dbname, $link); if( !$db ) { echo DB falsebr; exit; } $result = mysql_query( 'Select * From newsletter_subscribers;', $db ); if (!$result) { echo DB Error, could not list tablesbr; echo 'MySQL Error: ' . mysql_error(); exit; } with this output: Connected successfully DB Error, could not list tables MySQL Error: I dont understand why there is an error, but it prints nothing for the error. Any ideas? Thanks, Josh __ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] anonymous select error
I'm not sure you need a semi-colon after the table name. $result = mysql_query( 'Select * From newsletter_subscribers', $db ); To: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I'm trying this query: $link = mysql_connect( $site, $id, $pass ); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfullybr'; $db = mysql_select_db( $dbname, $link); if( !$db ) { echo DB falsebr; exit; } $result = mysql_query( 'Select * From newsletter_subscribers;', $db ); if (!$result) { echo DB Error, could not list tablesbr; echo 'MySQL Error: ' . mysql_error(); exit; } with this output: Connected successfully DB Error, could not list tables MySQL Error: I dont understand why there is an error, but it prints nothing for the error. Any ideas? Thanks, Josh
Fwd: [PHP-DB] anonymous select error
I agree about the semi-colon: not allowed. But also, specify '$link' in your mysql_error(). This tells it explicitly what the error is referring to, even though it should be able to figure it out on it's own. echo 'MySQL Error: ' . mysql_error($link); Hope this helps - seems to work for me. ~Philip I'm not sure you need a semi-colon after the table name. $result = mysql_query( 'Select * From newsletter_subscribers', $db ); To: [EMAIL PROTECTED] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I'm trying this query: $link = mysql_connect( $site, $id, $pass ); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfullybr'; $db = mysql_select_db( $dbname, $link); if( !$db ) { echo DB falsebr; exit; } $result = mysql_query( 'Select * From newsletter_subscribers;', $db ); if (!$result) { echo DB Error, could not list tablesbr; echo 'MySQL Error: ' . mysql_error(); exit; } with this output: Connected successfully DB Error, could not list tables MySQL Error: I dont understand why there is an error, but it prints nothing for the error. Any ideas? Thanks, Josh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php