hello every one, i have a problem to execute the second SQL query, its working fine on my local machine and when i uploaded it to the server but suddenly stoped functioning and keep showing error on the numRows after the query in line 213, any suggestion will be appreciated
<?php
session_start();
$_SESSION['url'] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
include_once("include/db_connection.php");
function cleanQuery($string)
{
if(get_magic_quotes_gpc()) // prevents duplicate backslashes
{
$string = stripslashes($string);
}
if (phpversion() >= '4.3.0')
{
$string = mysql_real_escape_string($string);
}
else
{
$string = mysql_escape_string($string);
}
return $string;
}
?><head>
<script type="text/javascript" language="javascript" src="js/behavior.js"></script>
<script type="text/javascript" language="javascript" src="js/rating.js"></script>
<script type="text/javascript">
function AddToFavorites()
{
url = (document.location.href);
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
return true; }
}
</script>
<link rel="stylesheet" type="text/css" href="css/rating.css" />
</head><?
include_once("include/header.php");
$thisVideo_id = $_REQUEST['video_idField'];
$thisOrder = $_REQUEST['order'];
$thisVideo_id = cleanQuery($thisVideo_id);
$thisOrder = cleanQuery($thisOrder);
$sql = "SELECT v.prog_id, v.vid_atitle , v.video_ad , v.vid_length , v.vid_thumb , v.vview , v.added_date , p.artitle , p.ar_des , p.categ
FROM video v JOIN programs p
WHERE video_id = '$thisVideo_id' AND v.prog_id = p.prog_id";
$result = MYSQL_QUERY($sql);
$numberOfRows = MYSQL_NUMROWS($result);
if ($numberOfRows == 0){
echo 'bad request';
}
else {
$i=0;
$thisProg_id = MYSQL_RESULT($result,$i,"prog_id");
$thisVid_atitle = MYSQL_RESULT($result,$i,"vid_atitle");
$thisVideo_ad = MYSQL_RESULT($result,$i,"video_ad");
$thisVid_length = MYSQL_RESULT($result,$i,"vid_length");
$thisVid_thumb = MYSQL_RESULT($result,$i,"vid_thumb");
$thisViewd = MYSQL_RESULT($result,$i,"vview");
$thisDdate = MYSQL_RESULT($result,$i,"added_date");
$thisArtitle = MYSQL_RESULT($result,$i,"artitle");
$thisAr_des = MYSQL_RESULT($result,$i,"ar_des");
$thisCat = MYSQL_RESULT($result,$i,"categ");
$thisViewd++;
$sql = "UPDATE video SET vview = '$thisViewd' WHERE video_id = '$thisVideo_id'";
$result = MYSQL_QUERY($sql);
require('_drawrating.php');
?>
<table border="0" width="778" bgcolor="#FFFFFF" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="12" height="12" valign="top" align="left">
<img src="images/up_left_corner.jpg" width="12" height="12" border="0"></td>
<td width="754" height="12"> </td>
<td width="12" height="12" valign="top" align="right">
<img src="images/up_right_corner.jpg" width="12" height="12" border="0"></td>
</tr>
<tr><td colspan="3" align="center" height="12">
<?
include_once("search_form.php");
$pathos = '#EEEEEE';
$pathos_text='#000000';
$lecture = '#EEEEEE';
$lecture_text='#000000';
$variety = '#EEEEEE';
$variety_text='#000000';
$programs = '#EEEEEE';
$programs_text='#000000';
$visits = '#EEEEEE';
$visits_text='#000000';
$prayers = '#EEEEEE';
$prayers_text='#000000';
switch ($thisCat) {
case ($thisCat == 'Pathos'):
{
$pathos = '#333333';
$pathos_text='#FFFFFF';
}
break;
case ($thisCat == 'Lectures' ):
{
$lecture = '#333333';
$lecture_text='#FFFFFF';
}
break;
case ($thisCat == 'Variety'):
{
$variety = '#333333';
$variety_text='#FFFFFF';
}
break;
case ($thisCat == 'Programs'):
{
$programs = '#333333';
$programs_text='#FFFFFF';
}
break;
case ($thisCat == 'Visits'):
{
$visits = '#333333';
$visits_text='#FFFFFF';
}
break;
case ($thisCat == 'Prayers'):
{
$prayers = '#333333';
$prayers_text='#FFFFFF';
}
break;
}
?>
<table cellpadding="0" cellspacing="0" border="0" width="740" align="center" bgcolor="#CCCCCC">
<tr>
<td colspan="13"> </td>
</tr>
<tr>
<td width="20%" align="center"> </td>
<td width="10%" align="center" bgcolor="<? echo $pathos;?>">
<a href="/forums/cat.php?catField=Pathos" style="text-decoration:none; color:<? echo $pathos_text?>;"><b>مراثي</b></a>
</td>
<td width="2px" bgcolor="#CCCCCC"> </td>
<td width="10%" align="center" bgcolor="<? echo $lecture;?>">
<a href="/forums/cat.php?catField=Lectures" style="text-decoration:none; color:<? echo $lecture_text;?>"><b>محاضرات</b></a>
</td>
<td width="2px" bgcolor="#CCCCCC"> </td>
<td width="10%" align="center" bgcolor="<? echo $variety;?>">
<a href="/forums/cat.php?catField=Variety" style="text-decoration:none; color:<? echo $variety_text;?>"><b>منوع</b></a>
</td>
<td width="2px" bgcolor="#CCCCCC"> </td>
<td width="10%" align="center" bgcolor="<? echo $programs;?>">
<a href="/forums/cat.php?catField=Programs" style="text-decoration:none; color:<? echo $programs_text;?>"><b>برامجنا</b></a>
</td>
<td width="2px" bgcolor="#CCCCCC"> </td>
<td width="10%" align="center" bgcolor="<? echo $visits;?>">
<a href="/forums/cat.php?catField=Visits" style="text-decoration:none; color:<? echo $visits_text;?>"><b>زيارات</b></a>
</td>
<td width="2px" bgcolor="#CCCCCC"> </td>
<td width="10%" align="center" bgcolor="<? echo $prayers;?>">
<a href="/forums/cat.php?catField=Prayers" style="text-decoration:none; color:<? echo $prayers_text;?>"><b>ادعية</b></a>
</td>
<td width="20%" align="center"> </td>
</tr>
</table>
<div align="right" style="color:#CC0000; padding:20px"><b><? echo $thisArtitle;?></b></div>
<div style="height:310px">
<div align="right" style=" width:338px; color:#CC0000;float:left; padding-left:20px; padding-right:10px; direction:rtl">العنوان : <font color="#0099CC"><? echo $thisVid_atitle;?></font><br />
تاريخ الاضافة : <font color="#0099CC"><? echo $thisDdate;?></font>
<br />التفاصيل : <font color="#666666"><? echo $thisAr_des;?></font>
</div>
<div style="width:360px; height:322px; float:right; padding-right:20px; background-color:#FFF; vertical-align:top">
<embed src="<? echo $thisVideo_ad;?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="360" height="322" allowFullScreen="True"></embed>
</div>
</div><br />
<div style="background-color:#000;" align="left">
<div style="width:230px; float:right; height:30px; color:#CCCCCC; border-left:solid">
<? echo rating_bar($thisVideo_id,'5'); ?>
</div>
<div style="height:30px; width:20%; float:right; border-left:solid; color:#CCCCCC;" align="center">
<font color="#CC0000"><b>عدد المشاهدات</b></font>
<font color="#0099CC"><? echo $thisViewd;?></font>
</div>
<div style="float:right; width:20%; height:30px; color:#CCCCCC; border-left:solid; font-weight: bold;" align="center">
<a href="/forums/javascript:AddToFavorites();" style="text-decoration:none; color:#666666"><img src="images/fav.png" border="0" /> اجعلها مفضلة
</a>
</div>
<div style="float:right; width:20%; height:30px; color:#CCCCCC; font-weight: bold;" align="center">
<a href="/forums/form.php" target="page" style="text-decoration:none; color:#666666" onClick="window.open('','page','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=550,height=410,left=50,top=50,titlebar=yes')"><img src="images/env.png" border="0" /> ارسلها الى صديق
</a>
</div>
</div>
<br />
<br />
<br />
<?
// here is the problem
$sqlmy = "SELECT prog_id , video_id , vid_atitle , vid_length , vid_thumb , vview , added_date
FROM video
WHERE prog_id = '$thisProg_id' AND video_id != '$thisVideo_id'
ORDER BY added_date DESC";
$result = mysql_query($sqlmy);
$numRows = mysql_num_rows($result);
if ($numRows > 0){
$k=0;
while ($k < $numRows)
{
$thisVideo_id = MYSQL_RESULT($result,$k,"video_id");
$thisVid_atitle = MYSQL_RESULT($result,$k,"vid_atitle");
$thisVid_length = MYSQL_RESULT($result,$k,"vid_length");
$thisVid_thumb = MYSQL_RESULT($result,$k,"vid_thumb");
$thisViewd = MYSQL_RESULT($result,$k,"vview");
$thisDdate = MYSQL_RESULT($result,$k,"added_date");
?>
<table width="100%" height="100px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"align="right" height="20px" width="520px">
<div style="width:380px; float:right;color:#09F;; padding-right:20PX"><a href="<? echo 'view.php'; ?>?video_idField=<? echo $thisVideo_id; ?>" style="color:#09F; text-decoration:none"><? echo $thisVid_atitle;?></a> <img src="images/01.gif" border="0"/>
</div>
<div style="width:100px; float:left;color:#09F;"></div>
</td>
<td rowspan="3" height="100px" align="right" style="padding-right:50px" valign="top">
<a href="<? echo 'view.php'; ?>?video_idField=<? echo $thisVideo_id; ?>">
<img src="<? echo $thisVid_thumb;?>" border="0" style="background-color:#FFF; vertical-align:top;" height="100px"/></a>
</td>
</tr>
<tr>
<td colspan="2" height="5px">
<hr style="color:#CCC;" align="center" width="95%"/>
</td>
</tr>
<tr>
<td style="color:#0099CC" align="right" valign="top">
<? echo $thisVid_length;?> <br />
<? echo $thisViewd;?><br />
<?
$f = 0;
$sqlQuery2 = "SELECT * FROM ratings WHERE id = '$thisVideo_id'";
$result2 = mysql_query($sqlQuery2);
@$value = MYSQL_RESULT($result2,$f,"total_value");
@$votes = MYSQL_RESULT($result2,$f,"total_votes");
@$rater_rating = ($value/$votes);
if ($rater_rating <= 0 ){$rater_stars = "images/00star.gif";$rater_stars_txt="لا يوجد تصويت";}
if ($rater_rating >= 0.5){$rater_stars = "images/05star.gif";$rater_stars_txt="0.5";}
if ($rater_rating >= 1 ){$rater_stars = "images/1star.gif";$rater_stars_txt="1";}
if ($rater_rating >= 1.5){$rater_stars = "images/15star.gif";$rater_stars_txt="1.5";}
if ($rater_rating >= 2 ){$rater_stars = "images/2star.gif";$rater_stars_txt="2";}
if ($rater_rating >= 2.5){$rater_stars = "images/25star.gif";$rater_stars_txt="2.5";}
if ($rater_rating >= 3 ){$rater_stars = "images/3star.gif";$rater_stars_txt="3";}
if ($rater_rating >= 3.5){$rater_stars = "images/35star.gif";$rater_stars_txt="3.5";}
if ($rater_rating >= 4 ){$rater_stars = "images/4star.gif";$rater_stars_txt="4";}
if ($rater_rating >= 4.5){$rater_stars = "images/45star.gif";$rater_stars_txt="4.5";}
if ($rater_rating >= 5 ){$rater_stars = "images/5star.gif";$rater_stars_txt="5";}?>
<? echo $rater_stars_txt;?> <img src="<? echo $rater_stars;?>" border="0" />
</td>
<td align="right" valign="top" style="padding-right:20px; color:#CC0000" width="20%">
مدة المقطع<br />
عدد المشاهدات<br />
معدل التصويت</td>
</tr>
</table>
<br />
<br />
<?
$k++;
} // end while loop
// echo memory_get_usage() . "\n";
}
?>
</td>
</tr>
<tr align="center">
<td width="12" height="12" valign="bottom" align="left">
<img src="images/down_left_corner.jpg" width="12" height="12"></td>
<td width="754" height="12"> </td>
<td width="12" height="12" valign="bottom" align="right">
<img src="images/down_right_corner.jpg" width="12" height="12"></td>
</tr>
</table>
<? }
include_once("include/footer.php"); ?>