By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,092 Members | 561 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,092 IT Pros & Developers. It's quick & easy.

Weird PHP/SQL problem

P: 5
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 '';
while($row = mysql_fetch_assoc($x))

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


mysql_close ();

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


Feb 27 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.