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
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'");

Link to comment
Share on other sites

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'

Link to comment
Share on other sites

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..

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.