Re: Inserting variables

From: Date: Tue, 09 Oct 2001 11:28:43 +0000
Subject: Re: Inserting variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70449@lists.php.net to get a copy of this message
> I have a form which variables ($q1 and $q2) to a PHP script and the sql > statment is also passed as a hidden vriable called $sqlstatement Is the statement passed allready with those variables built in, or without (You hope to place them into it after retrieving them from posted form)? In the first case You have to parse the statement and reinsert values. > When I set $sqlstatement = INSERT INTO tdefa8 VALUES ("$q1", "$q2", > "2001-10-09") > THEN it inserts "$q1" and "$q2" into the database - rather than their > assigned values > > When I set $sqlstatement = INSERT INTO tdefa8 VALUES ($q1, $q2, > "2001-10-09") > THEN it doesn't insert ANYTHING Try: $sqlstatement = "INSERT INTO tdefa8 VALUES ('$q1', '$q2', '2001-10-09')"; $result = MYSQL_QUERY($sqlstatement); Kamil 'Hilarion' Nowicki

« previous php.general (#70449) next »