Here is the lean, corrected code:
<?php
$link = mysql_connect( $site, $id, $pass ) or die ("error connecting");
echo 'connection ok<br>';
mysql_select_db( $dbname, $link) or die ("eror selecting db");
echo 'selected db ok'<br>;
$result = mysql_query( 'Select * From newsletter_subscribers',$link) or die
("error query");
// some here code to disply result
?>
It is easier to evaluate each time the return of the functions using the
expression "or die...".
Also some sintax error:
resource mysql_query(string query [, connection id], int result mode])
you used the mysql_select_db() return instead of mysql_connect() return
value (altough it is optional), also it is not necessary to write ";" at the
end of the query string inside the function.Bye "Joshuah Goldstein" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > > 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 successfully<br>'; > > $db = mysql_select_db( $dbname, $link); > if( !$db ) { > echo "DB false<br>"; > exit; > } > > $result = mysql_query( 'Select * From > newsletter_subscribers;', $db ); > > if (!$result) { > echo "DB Error, could not list tables<br>"; > 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
