Jump to content

[SOLVED] error message mysql num rows


sungpeng

Recommended Posts


<?php


if($_POST[action]=="Update")
{	
include ("".$_SERVER['DOCUMENT_ROOT']."/housing/includes/config.php");
$indexnumber=$_GET[llid];		
$user=$_POST[user];
$passwd=$_POST[pass];
echo $user;
echo $passwd;
echo $indexnumber;

$check_result=0;
$check_login=mysql_query("select * from users where email=$user and passwd=$passwd and llid=$indexnumber");
$check_result=mysql_num_rows($check_login);
echo $check_result;



}else{ ?>






<html>

<title>Upload an image to a database</title>


<body>




<h2>Update with new information</h2>

<form name="form" enctype="multipart/form-data" method="post" action="<?php echo"$PHP_SELF?llid=$_GET[llid]"; ?>">
Please insert the images
<input type='file' name='imagefile'><br>


<br>
USER : <input name="user"><br>
PASSWORD : <input name="pass"><br>


<input type="submit" name="action" value="Update">
</form>

</body>
</html>

<?php
} ?>




 

Can help I keep having error message warning: mysql_num_row(): supplied argument is not a valid MySql result resource in insertphoto.php on line 17

Link to comment
https://forums.phpfreaks.com/topic/152203-solved-error-message-mysql-num-rows/
Share on other sites

Check your query as something is wrong with it.

 

You using the field names correctly? I'd also advise on trying this:

$check_login=mysql_query("SELECT * FROM `users` WHERE `email`='$user' AND `passwd`='$passwd' AND `llid`='$indexnumber'");

Probably to do with spaces in the user input. Without surrounding the variables with single quotes MySQL wold parse variables with spaces differently. Example (I'll replace variable names with actual contents for sake of typing:

 

Let's say we're searching for "car parts" in a table...

SELECT * FROM table WHERE field=car parts

 

MySQL would read "car" as the value and fall over with "parts" thinking you were sending it a command. Enclosing "car parts" in single quotes tells MySQL that everything inside them is the value:

SELECT * FROM table WHERE field='car parts'

hi Yesideez, ask you again,

$image_path=$folder_path.$_FILES['images']['name]['$key'];

$image_path=$folder_path.$_FILES['images']['name'][$key];

Why cannot write ['$key'] and must write [$key] bec I am puzzle sometime need to put """ sometime no need..

 

The single quotes don't allow PHP to parse the contents so '$key' would literally be passing $key

 

Try this as an example:

$myvar=13;
echo 'Variable: $myvar<br />';
echo "Variable: $myvar<br />";

 

That'll explain it better than I can with words.

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.