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
https://forums.phpfreaks.com/topic/68152-queries-coming-back-empty/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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