Afficher un message
Vieux 01/10/2007, 09h52   #2
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Variable in Select statement?

On Mon, 01 Oct 2007 10:50:53 +0200, GarryJones <morack@algonet.se> wrote:

> I am writing a mysql select statement in php and I would like to
> include a variable in it but cant grasp the syntax.
>
> // Example
>
> What I want to do
>
> if ($forma == "mot" ) {
> $fishnet = "(1,2,3,4)";
> } else {
> $fishnet = "(3,4,7)";
> }
>
> $ml_collect='SELECT * FROM ml_lopp WHERE ml_lopp.sank IN $fishnet
> ORDER BY date1, ml_lopp.loppnum';


Change the single to double quotes. If you'd have echo()ed your query
before sending it to MySQL you would have spotted the error instantly.
--
Rik Wasmus
  Réponse avec citation
 
Page generated in 0,04490 seconds with 9 queries