|
Posted by David Haynes on 12/17/64 11:52
Frankie wrote:
> Hello:
>
> New user here...first post to group.
>
> I'm getting an SQL syntax error when I try to run the following query:
>
> $query = sprintf("SELECT itemNumber, entryDate, modifyDate, thumbnailURL,
> title, price FROM '%s' WHERE itemNumber = '%s'", $_POST['selectCategory'],
> $_POST['tfItemNum']);
>
> I've tested the variables and they are populated.
>
> Strangely, the query works with a variable in the WHERE clause, but not in
> the FROM clause.
>
> Any tips appreciated,
>
> Frank H
> Austin, TX
>
>
Your FROM clause would be FROM 'foo'. It should be FROM foo instead.
Try:
$query = sprintf("SELECT itemNumber, entryDate, modifyDate,
thumbnailURL, title, price FROM %s WHERE itemNumber = '%s'",
$_POST['selectCategory'], $_POST['tfItemNum']);
-david-
Navigation:
[Reply to this message]
|