Hello, I have a problem with this script when i will check it in the browser, the output is :
"Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\doto\php\new_case.php on line 8
SELECT * FROM disp_type ORDER BY t_naam ASC
Resource id #3"

$password ="";
 $db=mysql_connect($host, $username, $password) or die (mysql_error());
 mysql_select_db($dbnaam, $db) or die (mysql_error());

 $query_test = "SELECT * FROM disp_type ORDER BY t_naam ASC";
 if(!$result = mysql_query($db,$query_test))
	 echo($query_test . '<br>');
 while($record = mysql_fetch_array($result))
	 echo "ID : {$record['t_id']}<br>Naam: {$record['t_naam']}<br>";

As you can see, echo($db) = Recource ID #3 ??
Can you please help me?

Recommended Answers

All 4 Replies

sorry line 11


Your parms are reversed and the databse parm can be left out if you wish to use the last link open. Most pages only open one link anyway

The Syntax (from the manual) is:
resource mysql_query ( string $query [, resource $link_identifier ] )

You should write like this.

if(!$result = mysql_query($query_test,$db))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.