Connecting Tech Pros Worldwide Forums | Help | Site Map

Weird PHP/SQL problem

Newbie
 
Join Date: Feb 2007
Posts: 5
#1: Feb 27 '07
Ok so i have a PHP/SQL menu, and a PHP/SQL script that pulls posts from the database. When the user posts they choose which page they want to post to ie index.

Well i can get the page to display all the posts of the relevant pages, but if i try to put the menu in at the top of the page it all goes horribly wrong :(

here is my php ro pull the data

[PHP]<? $result=mysql_query("SELECT * FROM north WHERE page='$page'");
while ($row=mysql_fetch_array($result))

{
echo "<br><div class='article1'>{$row["title"]} <br><img src='images/{$row["image"]}'>";
echo "{$row["info"]}<br /></div><br/>";
} ?>[/PHP]

here is my php for the menu

[PHP]<? $sqlquery = "SELECT DISTINCT (page) FROM north ORDER BY page";

if ($x = mysql_query($sqlquery))
{
$number = mysql_num_rows($x);

$i = (0);

if ($number < 1)
{
print '';
}
else
{
while($row = mysql_fetch_assoc($x))
{


print '<a href="data.php?page='.$row ['page'].'">'.$row ['page'].'</a>';

}
}
}

mysql_close ();
?>[/PHP]

If anyone has any suggestions that would be great, oh and the menu has to be generated as its for a content management system :)

Thanks

Harry

Reply