mrdeleigh Posted December 3, 2006 Share Posted December 3, 2006 Hi I a script i use there is this line: [code]<td width="59">'.date($PHP_HOUR_FORMAT,$arrNote["date"]).'</td>"[/code]i want to put another function in instead of the date, which is this:[code]<td width="59">'$check = mysql_num_rows( mysql_query( "SELECT `video` FROM `notes`"));if ($check == '0') {echo "<img src=images/blog.jpg>";}else {echo "<img src=images/vlog.jpg>";}'</td>"[/code]but i was told that there is no need to execute a separate query, you could directly use$arrNote["date"] - there is a loop there .. and atevery iteration, the array $arrNote contains the values for the note being displayed on that line. Thats were i got lost. does anyone who what that means and how to fix it?thanksmrdeleigh Link to comment https://forums.phpfreaks.com/topic/29322-script-change/ Share on other sites More sharing options...
chiprivers Posted December 3, 2006 Share Posted December 3, 2006 perhaps if you show us the rest of the script Link to comment https://forums.phpfreaks.com/topic/29322-script-change/#findComment-134413 Share on other sites More sharing options...
mrdeleigh Posted December 3, 2006 Author Share Posted December 3, 2006 Script below its a blog script[code]<?phpif(get_param("search_box") == ""){ $strLatestVideos = ' <table cellspacing=1 cellpadding=0> <tr> <td class="right_block_table_first_TD" colspan="2"> LATEST VIDEOS </td> </tr> '; $tableVideos = DataTable_Query(" SELECT author_image, date, ".$DBprefix."weblog.user, title, ".$DBprefix."notes.id FROM ".$DBprefix."notes,".$DBprefix."weblog,".$DBprefix."admin_users WHERE ".$DBprefix."notes.user=".$DBprefix."weblog.user AND ".$DBprefix."notes.user=".$DBprefix."admin_users.username AND blog_active=1 AND category_id<>-1 ".($SHOW_ONLY_NOTES_WITH_PHOTO?"AND author_image<>0":"")." AND active='YES' AND show_video=1 AND video<>'' AND (".$DBprefix."notes.title LIKE '%".get_param("search_box")."%' OR ".$DBprefix."notes.html LIKE '%".get_param("search_box")."%' OR ".$DBprefix."notes.user LIKE '%".get_param("search_box")."%' ) ORDER BY date DESC LIMIT 0,10");}$bColor = true;$iCounter = 1;while($arrLastBlog = mysql_fetch_array($tableVideos)){ if(trim($arrLastBlog["title"]) == "") { continue; } if($iCounter > $NUMBER_LATEST_NOTES) { break; } if($arrLastBlog["author_image"] > 1) { $author = "<a href='http://".BlogUrl($arrLastBlog["user"])."' target=_blank>"; if($USE_GD) { $author .= "<img src=\"thumbnail.php?id=". $arrLastBlog["author_image"]."&w=45&h=60\" width=45 height=60 border=0>"; } else { $author .= "<img src=\"image.php?id=". $arrLastBlog["author_image"]."&w=45&h=60\" width=45 height=60 border=0>"; } $author .= "</a>"; } else { $author = "<img src=ADMIN/images/no_pic.gif width=45 height=60>"; } if($arrLastBlog["user"] == "admin") { $strBlogger = '<font color=#d68449><b>'.strtoupper($arrLastBlog["user"]).'</b></font>'; } else { $strBlogger = ''.$arrLastBlog["user"].''; } echo ' <tr bgcolor='.($bColor?'#ffffff':'#FAF9DA').'> <td width="59">'.date($PHP_HOUR_FORMAT,$arrLastBlog["date"]).'</td> <td width="296"><a href="'.CreateLink4($arrLastBlog["user"],'note/'.$arrLastBlog["id"],$arrLastBlog["title"]).'" target=_blank>'.stripslashes($arrLastBlog["title"]).'</a></td> <td width="99"><a href="http://'.BlogUrl($arrLastBlog["user"]).'" target=_blank>'.$strBlogger.'</a></td> <td width=52>'.$author.'</td> </tr> '; $iCounter++; $bColor = !$bColor;}$strLatestVideos .= '[/code] Link to comment https://forums.phpfreaks.com/topic/29322-script-change/#findComment-134415 Share on other sites More sharing options...
chiprivers Posted December 3, 2006 Share Posted December 3, 2006 Try this:[code]<td width="59">'if (mysql_num_rows($tableVideos) == '0') {echo "<img src=images/blog.jpg>";}else {echo "<img src=images/vlog.jpg>";}'</td>"[/code] Link to comment https://forums.phpfreaks.com/topic/29322-script-change/#findComment-134416 Share on other sites More sharing options...
mrdeleigh Posted December 3, 2006 Author Share Posted December 3, 2006 that gave me an [code]Parse error: syntax error, unexpected T_IF, expecting ',' or ';' in /home/sporecom/public_html/extensions/video.php on line 89[/code]line 89 = if (mysql_num_rows($tableVideos) == '0') {??? Link to comment https://forums.phpfreaks.com/topic/29322-script-change/#findComment-134419 Share on other sites More sharing options...
chiprivers Posted December 3, 2006 Share Posted December 3, 2006 try taking the 0 out of the ' ' so it is:if (mysql_num_rows($tableVideos) == 0) { Link to comment https://forums.phpfreaks.com/topic/29322-script-change/#findComment-134421 Share on other sites More sharing options...
mrdeleigh Posted December 3, 2006 Author Share Posted December 3, 2006 giving the same error? Link to comment https://forums.phpfreaks.com/topic/29322-script-change/#findComment-134422 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.