السلام عليكم
عندي هذا الكود
كود PHP:
<?
// show headline with photo
$querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 0,1";
$qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
while ($pub = mysql_fetch_array ($qrypub)) {
echo "
<div class=\"newssubtitle\">$pub[subtitle]</div>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$pub[id]\">$pub[title]</a></div>
<div class=\"newsdate\">$pub[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
<div class=\"fotodesc\">$pub[photodesc]</div>";
} else {
}
echo "
$pub[intro]";
}
?>
المشكلة اني اذا كررت نفس الاستعلام في الصفحة يلخبط
يعني
لاحظ السطر الأول
$querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 0,1";
انا يهمني
DESC limit 0,1";
لو كررت الاستعلام في نفس الصفحة
DESC limit 1,2";
وكررته مره ثالثة
DESC limit 2,4";
باعتبار اني اريد كل استعلام منفصل والغرض هو ترتيب تصميم الصفحة لعرض كل خبر منفصل عن الاخر
طبعا المشكلة اني اذا كررت الكود اكثر من ثلاث مرات تقريبا في الصفحة
يصير يطلعلي في الاستعلام الثاني خبرين وانا اطلب خبر واحد فقط
وهذا الكود الي يتلخبط معي
كود PHP:
<?
// show headline with photo
$querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 0,1";
$qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
while ($pub = mysql_fetch_array ($qrypub)) {
echo "
<div class=\"newssubtitle\">$pub[subtitle]</div>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$pub[id]\">$pub[title]</a></div>
<div class=\"newsdate\">$pub[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
<div class=\"fotodesc\">$pub[photodesc]</div>";
} else {
}
echo "
$pub[intro]";
}
?>
<?
// show headline with photo
$querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 1,2";
$qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
while ($pub = mysql_fetch_array ($qrypub)) {
echo "
<div class=\"newssubtitle\">$pub[subtitle]</div>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$pub[id]\">$pub[title]</a></div>
<div class=\"newsdate\">$pub[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
<div class=\"fotodesc\">$pub[photodesc]</div>";
} else {
}
echo "
$pub[intro]";
}
?>
<?
// show headline with photo
$querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 2,3";
$qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
while ($pub = mysql_fetch_array ($qrypub)) {
echo "
<div class=\"newssubtitle\">$pub[subtitle]</div>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$pub[id]\">$pub[title]</a></div>
<div class=\"newsdate\">$pub[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
<div class=\"fotodesc\">$pub[photodesc]</div>";
} else {
}
echo "
$pub[intro]";
}
?>
<?
// show headline with photo
$querypub = "SELECT * FROM news_publish WHERE frontpage=1 ORDER BY id DESC limit 3,4";
$qrypub = @mysql_query($querypub,$connect) or die ("Query salah");
while ($pub = mysql_fetch_array ($qrypub)) {
echo "
<div class=\"newssubtitle\">$pub[subtitle]</div>
<div class=\"newstitle\"><a href=\"news.php?go=fullnews&newsid=$pub[id]\">$pub[title]</a></div>
<div class=\"newsdate\">$pub[ldate]</div>";
if ($pub[pq]==1) {
echo "<a href=\"news.php?go=fullnews&newsid=$pub[id]\"><img src=\"$urlpath/newsgfx/$pub[photo]\" alt=\"\" border=\"0\" width=\"300\" align=\"center\" vspace=\"5\" hspace=\"5\"></a>
<div class=\"fotodesc\">$pub[photodesc]</div>";
} else {
}
echo "
$pub[intro]";
}
?>
في انتظار الخبراء