On Tue, 24 Jul 2001 14:10, Chris Cocuzzo wrote:
>
> ----- Original Message -----
> From: Christopher Ostmo <[EMAIL PROTECTED]>
> To: Chris Cocuzzo <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 23, 2001 10:38 PM
> Subject: Re: [PHP]MySQL error, what's wrong here..
>
> > Chris Cocuzzo pressed the little lettered thingies in this order...
> >
> > > alright, new problem, no more errors, but there's just
> > > nothing...here's
>
> the
>
> > > code:
> > >
> > >   $query = "SELECT name FROM mp3 WHERE songid = '" .$id."'";
> > >
> > > <a href="http://www.fplg.net/stream.php?songid=2"; class="hov1"></a>
> >
> > Uhh... maybe I'm missing something here, but the URL supplies
> > $songid and the query is getting $id.  Unless your getting $id from
> > somewhere other than the URL, you're going to be getting only results
> > with an empty songid field.  Another thing to try is to "or die" your
>
> query
>
> > to check to see if the SQL syntax is OK:
> > $result=mysql_query($query,$connection) or die(mysql_error());
> >
> > Good luck...
> >
> maybe my sql syntax is completely wrong, but the "$id" part was a
> random number i generated, and then I was saying WHERE songid(which is
> the database field) is equal to $id. is that the wrong way?
>
> the reason why it's songid in that second <a> tag is because I wanted
> the random number to indentify the song pulled from the database..so
> the database uses that number in the part where it
> says..."stream.php?songid=<?php echo $id;?>
>
> tell me if I need to clarify!
> chris

Well. if the random number created is outside the range of actual songid 
values that are in the database, you're not going to get any rows 
returned, are you? You could confirm by echoing your query and trying the 
same query, with the randomly generated number, in the mysql console. Or 
by checking the number of rows returned by your query with 
mysql_num_rows()

Incidentally, if songid is an int type, you don't want to pass it a value 
in quotes; only char types need to be quoted.

-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   The Hubbell works fine; all that stuff IS blurry!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to