![]() |
Could someone please tell me what I did wrong?
Here is a script I have started working on.
My web host uses PHP 4.2.2 and MySql 3.23.51 <? // Database Variables $server = "localhost"; $database = "tsdbase"; $username = "frank"; $password = "chicken"; $table = "names"; // Connect to Database $db = mysql_connect($server,$username,$password,$database); $res = mysql_query("SELECT * FROM $table", $db); $data = mysql_fetch_array($res); ?> When I run the script, I get the following error : "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource" What am I doing wrong? All I want to do is to open a database and display a table to the browser. Todd |
<?
// Database Variables $server = "localhost"; $database = "tsdbase"; $username = "frank"; $password = "chicken"; $table = "names"; // Connect to Database $dbcnx = @mysql_connect($server,$username,$password) or die ("Database Connection Error"); $dbhandle = mysql_select_db($database, $dbcnx); $res = mysql_query("SELECT * FROM '$table'", $dbhandle); $data = mysql_fetch_array($res); ?> |
Thanks
That made it work!
Thank you! Todd |
You're welcome. :cool:
|
| All times are GMT +1. The time now is 04:58 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.