Jump to content

Not a valid result resource?


gergy008

Recommended Posts

	$run=mysql_query("SELECT `verifid` FROM `users` WHERE `login`=$user", $link);
	if(mysql_num_rows($run)==1){

 

These lines seem to be giving me the 'Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource' error. Looks fine to me, But probably my fault.

 

Thanks in advance.

 

Here is the whole function if you need it:


function getverid($user){
	global $link;
	$run=mysql_query("SELECT `verifid` FROM `users` WHERE `login`=$user", $link);
	if(mysql_num_rows($run)==1){
		$item=mysql_fetch_array($run);
		echo($item[0]);
		return($item[0]);
	}
}

 

The fuction is called with getverid($_POST["login"]) which I know is set... So what's going on?

Link to comment
https://forums.phpfreaks.com/topic/203127-not-a-valid-result-resource/
Share on other sites

You have a syntax error in your query. If you replace

<?php
$run=mysql_query("SELECT `verifid` FROM `users` WHERE `login`=$user", $link);
?>

with

<?php
$q = "SELECT verifid FROM `users` WHERE `login`=$user", $link";
$run = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());
?>

It would show the error.

 

The error is WHERE `login`=$user", $link -- what's the , $link? (nevermind)

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.