Jump to content

Queries coming back empty


riscphree

Recommended Posts

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