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. Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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. 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.