Okay I have this code and I have narrowed it down to one line that is causeing the problem. The clause is new to me so I am not familar coding it and would like some help please, please, please.
Here is the full code.
$query = $db->sql_query("SELECT userid FROM dt_gallery WHERE id = '".$las."' LIMIT 1");
if ($db->sql_numrows($query) > 0)
{
list($userid) = $db->sql_fetchrow($query);
$db->sql_freeresult($query);
$res1 = $db->sql_query("SELECT m.mid, m.cid, m.uid, m.datetime, m.mtitle, m.mimage, m.mshort, m.mextend, m.mlink, m.mviews, m.mscore, m.mvotes, m.mapprove, m.mtags, m.himage, m.lastview, m.mcomment, m.membed, m.pid, c.cimage, t.timage, t.tdefault FROM cms_movie_movie AS m LEFT JOIN cms_movie_cat AS c ON (c.cid=m.cid) LEFT JOIN cms_movie_type AS t ON (t.tid=m.tid) WHERE m.uid = '".$userid."'AND m.pid = '".$las."' AND m.mapprove=1
'.((count($CATS))?' AND m.cid IN ('.implode(',',$CATS).')':'').' ORDER BY m.datetime DESC LIMIT 1");
list($res1) = $db->sql_fetchrow($res1);
$db->sql_freeresult($res1);
Here is the line below giving me the problem as you can see it's with the count and implode line. I do not have it coded correctly. When I take this out of the query the error goes away. Any assistance on the syntax for these two clauses will be greatly appreciated.
'.((count($CATS))?' AND m.cid IN ('.implode(',',$CATS).')':'').' ORDER BY m.datetime DESC LIMIT 1");
Here is the error message.
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 ''.((count(Array))?' AND m.cid IN ('.implode(',',Array).')':'').' ORDER BY m.date' at line 2.