hi, I am geting news out of a db and putting it on a webpage. the table structure:
uid | show | title | news | subBy | subDate
::code::
the query doesn't like the show = '1' bit.
what im trying to do is: if in the table its got 1 in the show colum, it will show the post else if its got '0' it wont.
Any ideas??
^^ link 4 query thats wrong ^^
thanx
Martin
also,is there a better way of listing data out of a db other than the while() loop? or anyother ways of using the while loop?
uid | show | title | news | subBy | subDate
::code::
Code:
<?php
include ("config.php");
$conn = mysql_connect($host, $user, $pass);
mysql_select_db($db, $conn);
$queryNewsMain = mysql_query("SELECT * FROM wnews where show= '1' ORDER by subDate DESC") or die(mysql_error());
while ($r = mysql_fetch_array($queryNewsMain)) {
$title = $r["title"];
$news = $r["news"];
$dp = $r["subDate"];
$sb = $r["subBy"];
echo("<font size=2>
<table width=400 border=0 cellspacing=0 cellpadding=0>
<tr>
<td background=$midtop>
<div align=center><font color=$txtcolor size=2><b>-</b> $title <b>-</b></font></div></td>
</tr>
<tr>
<td background=$mid>
<div align=center><font color=$txtcolor size=2>$news</font></div></td>
</tr>
<tr>
<td background=$midbot>
<div align=center><font color=$txtcolor size=2>Submitted: $dp by $sb</font></div></td>
</tr>
</table></font>")."<br><br>";
}
echo("<font size=2><a href=archive.php>News Archive</a></font>");
?>
the query doesn't like the show = '1' bit.
what im trying to do is: if in the table its got 1 in the show colum, it will show the post else if its got '0' it wont.
Any ideas??
^^ link 4 query thats wrong ^^
thanx
Martin
also,is there a better way of listing data out of a db other than the while() loop? or anyother ways of using the while loop?