Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT INTO Query Failing for no reason :(

Status
Not open for further replies.

simptech

Programmer
May 8, 2002
4
0
0
US
I have worked with SQL in other DBs before and figured that MySql and PHP would be effortless... BUT...

I have tried inserting values into my table(structure example on request) and it fails miserably every time.

i have tried many variations, with quotes, w/o quotes, w/ quotes for string vars only :(

Nothing seems to get past my problem. The query currently is as follows:

$query = "INSERT INTO users (rid, email, mail_access, connection, password, first_name, last_name, addr_1, addr_2, city, state, postal_code, country, addr_type, household_rid, birth_date, edu_highest, edu_status, emp_status, mar_status, ethnicity, in_household, gender, industry, industry_other, comp_role, comp_area, find_site, income) VALUES ('', '$email', $access_type, $connection, '$crypt_pass', '$first_name', '$last_name', '$addr_1', '$addr_2', '$city', $state, $postal, $country, $addr_types, NULL, '$birthdate', $edu_level, $edu_status, $emp_status, $mar_status, $ethnicity, $household, '$gender', $industry, '$industry_other', $comp_role, $comp_area, $found_site, $gross_income)";
 
Joined tek-tips for replies.

Thanx for any help on the above issue :)
 
hi,

what is the function of the ri field? is it your prim. key?

thomas
 
the rid is auto-increment(pri + idx) and the date is being sent in the "0000-00-00" string format(assumed that this format would work)

$birthdate = $bYear."-".$bMonth."-".$bDay;

1977-07-14
 
Thanx for the help... decided to use an error_no check as opposed to die() and found the error. was sending a NULL value to a field that was named incorrectly in the data submission page :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top