Quotes are getting in my way
| From: | Rw | Date: | Sat, 06 Oct 2001 19:59:19 +0000 |
| Subject: | Quotes are getting in my way | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70245@lists.php.net to get a copy of this message | ||
Quotes in PHP drive me nuts at times.
I have variables from a form which go to create an SQL statement to a
variable name.
Here is what I have:
$t1 = "'";
$t2 = ", ";
$sqlstatement = "INSERT INTO $tablename VALUES (";
$i = 0;
WHILE ($i < $noquestions):
$q[$i] = "Q" . ($i+1);
PRINT "$q[$i]<br>";
PRINT '<textarea rows="9" name="';
ECHO $q[$i];
PRINT '" cols="52"></textarea><br><br>';
sqlstatement = $sqlstatement . $t1 . $q[$i] . $t1 . $t2;
$i++;
ENDWHILE;
The statement causing the problem is:
sqlstatement = $sqlstatement . $t1 . $q[$i] . $t1 . $t2;
Any ideas?
Thanks a lot!!!