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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP SQL

Status
Not open for further replies.

Flipster

MIS
Jun 25, 2001
38
0
0
US
I am attempting to display an entire database (its not large- only 125 rows for people to see, not touch) I am getting a result of:
"
Client 3.X Users
Resource id #2
"
on the website. Am I doing something wrong? This is my first pass at PHP. Any help would be appreciated. By the way, throwing it into a cool looking table would be ideal.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<h2> Client 3.X Users</h2>

<?php
$username = &quot;username&quot;;
$password = &quot;password&quot;;
$host = &quot;localhost&quot;;
$database = &quot;database&quot;;

mysql_connect($host,$username,$password) or die(&quot;Cannot connect to the database.<br>&quot; . mysql_error());

mysql_select_db($database) or die(&quot;Cannot select the database.<br>&quot; );

$result = mysql_query(&quot;SELECT * FROM upgrade&quot;);

echo &quot;$result&quot;;

?>
 
Yes, you forgot to fetch the data returned by your query. $result is the resource handle to the data, not the data itself.

Take a look at the online documentation for mysql_fetch_array() ( Pay particular attention to the example scripts on that page.
Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top