PDA

Click to See Complete Forum and Search --> : Else error :S


I_Love_My_Vans
Apr 25th, 2006, 03:22 PM
Big problem, the code below is returning an error (unexpected else)

I do not know what i have done wrong?

This (http://www.meltdownsoftware.co.uk/content/index.php?page=download) is the page i am getting the error on :S

<?php
$db = mysql_connect("***", "***", "***");

mysql_select_db("***",$db);

$result = mysql_query("SELECT * FROM meltdown_download Where category='programs'",$db);



while ($myrow = mysql_fetch_row($result)) {


$imgQuery = mysql_query("SELECT * FROM meltdown_images Where download_id='" . $myrow[0] . "' LIMIT 1",$db);

$num_rows = mysql_num_rows($imgQuery);

if (!$num_rows==0);

echo $imgQuery[1];

else

echo("<table class=\"content_main\" cellspacing=\"0\" cellpadding=\"0\" >\n");
echo(" <tr>\n");
echo(" <td class=\"content_tl\"></td>\n");
echo(" <td class=\"content_t\">" . $myrow[2] . "</td>\n");
echo(" <td class=\"content_tr\"></td>\n");
echo(" </tr>\n");
echo(" <tr>\n");
echo(" <td class=\"content_stl\"></td>\n");
echo(" <td class=\"content_stm\"></td>\n");
echo(" <td class=\"content_str\"></td>\n");
echo(" </tr>\n");
echo(" <tr bgcolor=\"#FFFFFF\">\n");
echo(" <td class=\"content_l\"></td>\n");
echo(" <td class=\"content_m\">" . $myrow[3] . "</td>\n");
echo(" <td class=\"content_r\"></td>\n");
echo(" </tr>\n");
echo(" <tr>\n");
echo(" <td class=\"content_sbl\"></td>\n");
echo(" <td class=\"content_sbm\"></td>\n");
echo(" <td class=\"content_sbr\"></td>\n");
echo(" </tr>\n");
echo(" <tr>\n");
echo(" <td class=\"content_bl\"></td>\n");
echo(" <td class=\"content_b\"></td>\n");
echo(" <td class=\"content_br\"></td>\n");
echo(" </tr>\n");
echo("</table>\n");
echo("<br>\n");


}

?>

visualAd
Apr 25th, 2006, 03:32 PM
I am going to do you a favour ....

visualAd
Apr 25th, 2006, 03:53 PM
First, take a look at this: http://www.vbforums.com/showpost.php?p=2440249&postcount=7

Now your code should be looking something like:

<?php
$db = mysql_connect("***", "***", "***");

mysql_select_db("***",$db);

$result = mysql_query("SELECT * FROM meltdown_download Where category='programs'",$db);

while ($myrow = mysql_fetch_row($result)):
$imgQuery = mysql_query("SELECT * FROM meltdown_images Where download_id='" . $myrow[0] . "' LIMIT 1",$db);
$num_rows = mysql_num_rows($imgQuery);

if (!$num_rows==0):
/* to echo the first row */
echo (mysql_result($imgQuery, 0));
else: // remember PHP is embedded inside HTML
?>
<table class="content_main" cellspacing="0" cellpadding="0" >
<tr>
<td class="content_tl"></td>
<td class="content_t"><?php echo($myrow[2]) ?></td>
<td class="content_tr"></td>
</tr>
<tr>
<td class="content_stl"></td>
<td class="content_stm"></td>
<td class="content_str"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="content_l"></td>
<td class="content_m"><?php echo($myrow[3]) ?></td>
<td class="content_r"></td>
</tr>
<tr>
<td class="content_sbl"></td>
<td class="content_sbm"></td>
<td class="content_sbr"></td>
</tr>
<tr>
<td class="content_bl"></td>
<td class="content_b"></td>\
<td class="content_br"></td>
</tr>
</table> <br />
<?php
endif;
endwhile;
?>