sungpeng Posted April 2, 2009 Share Posted April 2, 2009 <?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 Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 2, 2009 Share Posted April 2, 2009 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'"); Quote Link to comment Share on other sites More sharing options...
sungpeng Posted April 2, 2009 Author Share Posted April 2, 2009 Thank is working now.. Check with you yesideez why need to put '' ''' on top then it work. Sometime I don't put '''''' on top it also work? Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 2, 2009 Share Posted April 2, 2009 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' Quote Link to comment Share on other sites More sharing options...
sungpeng Posted April 2, 2009 Author Share Posted April 2, 2009 Thank a lot Quote Link to comment Share on other sites More sharing options...
sungpeng Posted April 2, 2009 Author Share Posted April 2, 2009 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.. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 2, 2009 Share Posted April 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
sungpeng Posted April 2, 2009 Author Share Posted April 2, 2009 Thank again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.