Jump to content

I think this MySQL is proper Syntax, but not getting any results or errors


suttercain

Recommended Posts

Hello,

 

I have

$query = mysql_query("SELECT *, STR_TO_DATE(comics.cover_date,'%m/%d/%Y') as Mydate FROM comics, titleSheet WHERE comics.comic_id ='titleSheet.comic_id' ORDER BY Mydate, comics.issue_number") or die(mysql_error());
$tscount = mysql_num_rows($query);
echo $tscount;

 

It echos 0 when it should be 300 and something... any help.

 

Thanks.

your query

 

SELECT *, STR_TO_DATE(comics.cover_date,'%m/%d/%Y') as Mydate FROM comics, titleSheet WHERE comics.comic_id ='titleSheet.comic_id' ORDER BY Mydate, comics.issue_number

 

should be

 

SELECT *, STR_TO_DATE(comics.cover_date,'%m/%d/%Y') as Mydate FROM comics, titleSheet WHERE comics.comic_id =titleSheet.comic_id ORDER BY Mydate, comics.issue_number

 

if you quote titleSheet.comic_id mysql will take it as a string

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.