blade_922
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by blade_922
-
-
Disregard this post. I had set the Order by wrong. it should have been ordered by another field.
-
K here is my query
[code]
$hotmain=mysql_query("select * from mos_content ORDER BY `id` DESC LIMIT 2") or die(mysql_error());
while ($donnee = mysql_fetch_array($hotmain))
{ $title= $donnee['title'];
$introtext=$donnee['introtext'];
$author=$donnee['created_by'];
}
[/code]
For some reason if i just want to display 2 items like i have done i typed 2 and it doesnt display anything, if i change the limit to 9 then it displays 2.
Is there somethin wrong -
[code]
<td>
<input type="checkbox" name="mainhot" value="" <?php echo $row->mainhot ? 'checked="checked"' : ''; ?> />
</td>
[/code]
K so thats the code above. What im doing is creating a check box. So if the checkbox is checked then value in database will change to '1' if its then unchecked it will change to '0'
Ok so with this code i manage to change the value in the database to 1 for the first time. Then when i try to uncheck it and click save on my page it ends up staying checked and the value doesnt go back to 0.
I dont have a clue why its doing this. Hope you can assist.
Regards
Displaying results horizontally instead of vertically.
in PHP Coding Help
Posted
[code]
<table class='tablefull' >
<?php
$hotmain=mysql_query("select * from mos_content ORDER BY 'mainhot' DESC LIMIT 2 ") or die(mysql_error());
while ($donnee = mysql_fetch_array($hotmain))
{ $title= $donnee['title'];
$introtext=$donnee['introtext'];
$author=$donnee['created_by'];
$sectionid=$donnee['sectionid'];
$displayhot=$donnee['displayhot'];
$mainhot=$donnee['mainhot'];
$mainhot_img=$donnee['mainhot_img'];
if ($mainhot==1)
{
echo "<tr><td id='maintitle'> EXCLUSIVE </td></tr>";
echo " <tr><td id='image'> <center> <a href='http://www.pspcave.com/'> <img src='$mainhot_img'></a></center></td></tr>";
echo "<tr><td id='articletitle'><center><a href='http://www.pspcave.com/'>";
echo $title;
echo "</a></center></td></tr>";
}
}
?>
</table>
[/code]
Ok so now the problem. This code manages to display 2 x the result since i set the Limit to 2. But it displays it one on top of each other, vertically.
Like
[result1]
[result2]
But i want it to display it horizontally, side by side
like
[result1] [result2]
I know the <td> and <tr> tags should be changed. but i have been sitting around messing around with them but have no idea how to do it to display correct.
Regards