Re: Quotes are getting in my way
| From: | Joe Kaiping | Date: | Sat, 06 Oct 2001 20:23:34 +0000 |
| Subject: | Re: Quotes are getting in my way | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70247@lists.php.net to get a copy of this message | ||
Quick first glance shows you are just missing a $ before the
sqlstatement.
-Joe
Rw wrote:
>
> 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!!!