Forum Moderators: coopster
<?php
$db = mysql_connect("localhost","testdb","testdb");
mysql_select_db ("testdb");
$result = mysql_query("SELECT id, name FROM user") or die ('Queryproblem:' . mysql_error());
if (mysql_num_rows($result) >= 1){
while ($rows = mysql_fetch_row($result)) {
echo "<tr><td><a href='$rows[2]'>$rows[1]</a></td></tr>";
}
} else {
echo 'No records returned';
}
?>
returns Queryproblem:Table 'testdb.user' doesn't exist
why is it bringing in the testdb.user part when it should only be looking for table user
mysql_select_db ("testdb");
Are you sure your database is named testdb? Its adding the .user because thats what its trying to find.
Double check your syntax:
$db = mysql_connect("localhost","username","password");
mysql_select_db ("database_name");
in this script
<?php
$db = mysql_connect("localhost","testdb","testdb");
mysql_select_db ("testdb");
if (!$db) {
die('Could not connect');
}
?>
it returns nothing - which means it connected with testdb? Is there a way to make it return something so that I know that it did connect? And how about connecting to the table user and having it return something like "YES WE ARE CONNECTED"?
Thanks for your help
[edited by: jatar_k at 7:34 pm (utc) on July 15, 2004]
[edit reason] no personal urls thanks [/edit]