--- whoisquilty <[EMAIL PROTECTED]> wrote:

> I switched web hosts and I'm trying to get everything up and going. But, the
> queries that had worked before, don't work anymore.
> 
> If there is a variable passed, it doesn't work:
> 
> "SELECT *
>       FROM productions
>       WHERE showno = $prodvar
>       ORDER BY yearopen";
> 
> If I put the variable that $prodvar is set to in the query instead of
> $prodvar, it works fine. So, 
> why is this wrong on a different server?
> 
> Thanks for the help.
> 
> Jer

Is showno an integer?  Even if it is you may want to surround the variable in
single quotes:

WHERE showno = '$prodvar'

This way, if $prodvar is empty or not defined then it will equate to 0 on an
integer field.  The SQL will still be valid but may not return any rows.  As
you have it, if the variable is not set, the SQL will break and return an
error.


You also don't say how $prodvar is populated or validated.  If you are using an
assumption that REGISTER_GLOBALS is on, a modern server with it off could
create surprising results like this.


In brief, you don't supply us with enough information.  I get that it doesn't
work but you don't say what errors are generated, whether you can successfully
connect to the database on this new server, etc.

James Keeline

Reply via email to