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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie .. difficulties with writing in a table

Status
Not open for further replies.

iNviNciblE4ever

Programmer
Sep 4, 2002
1
DE
// Tabelle
mysql_query("CREATE TABLE Frage1 (
Age INT ,
Geschlecht VARCHAR(30),
Schulabschluss VARCHAR(30),
ZurZeit VARCHAR(30),
UmAus VARCHAR(30)
) ");

i wanna write in the table ...

$optsex = "m"

mysql_query ("INSERT INTO Frage1 (Age,Geschlecht) VALUES ($txtAlter,$optsex)");

why it doesn't work ?
if i try it without "Geschlecht" and "$optsex" it works ...

Best Regards thE_iNviNciblE
 
you need to use single quotes around a character string value

INSERT INTO Frage1 (Age,Geschlecht)
VALUES ($txtAlter,'$optsex')

p.s. why varchar(30)?? why not just single character values like M and F (mann und frau) or M and W (männlich und weiblich)?

rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top