PDA

View Full Version : mysql_query error



Longhorn
09-07-2008, 03:22 PM
The following is the output from the code below. Any help would be appricated. Thanks.

Resource id #1
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home2/longhor3/public_html/index.php on line 21
Couldn't execute query


<?php
$dbhost = 'localhost';
$dbuser = 'pp';
$dbpass = 'pp';
$conn = @mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql: '. mysql_error() );
echo ($conn);
$dbname = 'longhor3_Guide';
@mysql_select_db($dbname) or die ('Error selecting database: '. mysql_error() );
$query = "SELECT * FROM Camps";
$result = mysql_query($conn,$query) or die ("Couldn't execute query");
?>

Longhorn
09-07-2008, 09:07 PM
Turns out I had the params backwards in the mysql_query function.