riscphree Posted September 6, 2007 Share Posted September 6, 2007 I've got this form I'm trying to submit, and every time I get the error: Query was empty Here is the code used for the form: <?php if(isset($_POST['submit'])){ $profileID = mysql_query("SELECT profileid from users WHERE username='$str'"); $g=mysql_fetch_array($profileID); $profileID = $g["profileid"]; $ethnicity = $_POST['ethnicity']; $weight = $_POST['weight']; $height = $_POST['height']; $eyecolor = $_POST['eyecolor']; $haircolor = $_POST['haircolor']; $query = mysql_query("INSERT INTO profile_data(ethnicity, weight, height, eyecolor, haircolor) VALUES('$ethnicity', '$weight', '$height', '$eyecolor', '$haircolor') WHERE userid='$profileID'"); if(@mysql_query($query)){ echo "Profile Updated for $profileID"; }else{ echo "Profile Not Updated for $profileID."; echo mysql_error(); } } ?> <form action="edit_physical.php" method="post" > <div id="form1"> <div id="form1left"><strong>Ethnicity:</strong></div> <div id="form1right"><select name="ethnicity" class="basic" > <option value="AfricanAmerican"> African American <option value="AsianAmerican" > Asian American <option value="Asian" > Asian <option value="African" > African <option value="Aboriginal" > Aboriginal <option value="Caucasian" > Caucasian <option value="EasternBlock" > Eastern Block <option value="Hispanic" > Hispanic <option value="Indian" > Indian <option value="MiddleEastern" > MIddle Eastern <option value="NativeAmerican" >Native American <option value="Polynesian" > Polynesian </select></div> </div> and there are a few more <select> options, but here is my submit button: <input type="submit" name="submit" value="Save Changes"> </form> I figure its with the select's but I have no idea. Link to comment https://forums.phpfreaks.com/topic/68152-queries-coming-back-empty/ Share on other sites More sharing options...
hackerkts Posted September 6, 2007 Share Posted September 6, 2007 You are trying to INSERT or UPDATE your database? Link to comment https://forums.phpfreaks.com/topic/68152-queries-coming-back-empty/#findComment-342638 Share on other sites More sharing options...
teng84 Posted September 6, 2007 Share Posted September 6, 2007 WHERE userid='$profileID' <-- is used only for update delete select but not in insert ;D Link to comment https://forums.phpfreaks.com/topic/68152-queries-coming-back-empty/#findComment-342663 Share on other sites More sharing options...
riscphree Posted September 6, 2007 Author Share Posted September 6, 2007 I'm trying to update. teng84, thanks. I did not know that. Link to comment https://forums.phpfreaks.com/topic/68152-queries-coming-back-empty/#findComment-342738 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.