Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange result 1

Status
Not open for further replies.

Trusts

Programmer
Feb 23, 2005
268
US
Hi all,

I am trying to list the tables using Show Tables. I don't get a list of tables, I get "id resource #3"

Anyone know about this?

Here is the code:

<?php
$connection=mysql_connect(myIP, myname, mypassword) or die ('unable to connect');
mysql_select_db("mydb", $connection);
$ssql="Show Tables";
$result=mysql_query($ssql,$connection);
echo $result;
mysql_close($connection);
?>


Thanks,
KB
 
mysql_query returns a resource not a set of text.

try
Code:
$result = mysql_query ("show tables");
while ($row = mysql_fetch_assoc($result)){
 echo "<pre>;
 print_r($row);
 echo "</pre>"'
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top