Can't retrieve data from tables in phpmyadmin
Posted by: leomic (212.50.110.---)
Date: March 10, 2010 06:50PM

Having some difficulties with retrieving data from a database that i've created in phpmyadmin. I used a simple script to retrieve data from a table from the database and i'm getting the below message:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\wamp

\www\readrecord2.php on line 16


This is the script that i used:

<?PHP

$user_name = "user";
$password = "password";
$database = "dtbase";
$server = "localhost";

$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {

$SQL = "SELECT * FROM tb_people";
$result = mysql_query($SQL);

while ($db_field = mysql_fetch_assoc($result))
{

print $db_field['id'] . "<BR>";

print $db_field['name'] . "<BR>";

}

mysql_close($db_handle);

}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}

?>


I used $result = mysql_query($SQL);or die(mysql_error()); and i get this message

Table 'test.tb_people' doesn't exist



Does anyone have any idea whats going wrong? I've spend a lot of time of searching and reading but i haven't found a solution. I appreciate every response in advance.

Options: ReplyQuote
Re: Can't retrieve data from tables in phpmyadmin
Posted by: stevenmartin99 (---.b-ras2.blp.dublin.eircom.net)
Date: March 10, 2010 08:09PM

well print isnt really to be used like this...


its

echo


secondl shud u be using mysql_fetch_assoc


maybe try

mysql_fetch_array

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: Can't retrieve data from tables in phpmyadmin
Posted by: leomic (212.50.110.---)
Date: March 10, 2010 10:08PM

Thanks Steve but it doesnt work.Still getting the same message

Options: ReplyQuote
Re: Can't retrieve data from tables in phpmyadmin
Posted by: yfastud (Moderator)
Date: March 10, 2010 11:41PM


Options: ReplyQuote


Sorry, only registered users may post in this forum.