--- whoisquilty <[EMAIL PROTECTED]> wrote:
> You have an error in your SQL syntax. Check the manual that corresponds to
> your MySQL server version for the right syntax to use near 'ORDER BY
> yearopen' at line 4
>
> Looking at my code:
>
> "SELECT *
> FROM productions
> WHERE showno = $prodvar
> ORDER BY yearopen";
>
> ...the Where statement is the problem. If I remove the Where statement, it
> works fine. I tried the previous suggestion of putting $prodvar as
> '$prodvar' or ".$prodvar." Neither worked. '$prodvar' returned no results.
> And ".$prodvar." gave me the same error as above.
It sounds like your variable $prodvar is empty, not set. Before making your
database call, print out the variable $prodvar to see what it contains.
The reason that '$prodvar' works -- doesn't generate an error -- is that it is
valid SQL with an empty value for $prodvar. Your other methods break the SQL
because it effectively reads as:
"SELECT *
FROM productions
WHERE showno =
ORDER BY yearopen";
You now need to figure out why this variable does not have an expected value.
James Keeline