SQL Connection

From: Date: Fri, 13 Oct 2000 20:10:32 +0000
Subject: SQL Connection
Groups: php.db 
Request: Send a blank email to php-db+get-3602@lists.php.net to get a copy of this message
Can someone please tell me why I am getting an error saying, "Warning: Supplied argument is not a valid MySQL result resource in /www/bryan/bryantest.php on line 21" <?php $dbcnx = mysql_connect('localhost:/var/lib/mysql/mysql.sock', 'Bryan','fitch'); if (!$dbcnx) { echo "An error occured."; exit; } mysql_select_db('bryantest'); $sql = "SELECT * FROM users"; $result = mysql_query($dbcnx, $sql); $numrows = mysql_num_rows($result); if ((!$result) || ($numrows << 1)) { print "<<H1>ERROR - no rows returned<</H1><<P>"; exit; } for ($b=0; $b << $numrows; $b++) { echo mysql_result($result, $b, "column_name"); } ?> I am new to PHP, so I am not too familiar with all the functions yet, but I am pretty sure this should be working right... Thanks Bryan

« previous php.db (#3602) next »