הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   שלום, צריך עזרה בהצגת שאילתה למתקדמים PHP SQL (https://hosts.co.il/forums/showthread.php?t=64276)

stel222 20-06-08 01:11

שלום, צריך עזרה בהצגת שאילתה למתקדמים PHP SQL
 
יש לי את הקוד הזה
PHP קוד:

<?  
include 'config.php';


$link mysql_connect($server$db_user$db_pass) or die(mysql_error());  
mysql_select_db("$database",$link) or die(mysql_error()); // mydb שם בסיס נתונים 
$sql1 "select * from blocks where content >'' and active = '1' and pach ='' order by 'order'";
$sql2 "select * from blocks where pach >'' and active = '1' and content ='' order by 'order'";
$result mysql_db_query($database$sql1) or die(mysql_error());

     while (
$row=mysql_fetch_array($result)) {


    echo 
"<table>";
echo 
"<td>".$row['name']."</td>";
    echo 
"<tr>";
echo 
"<td>".$row['content']."</td>";
    echo 
"<tr>";


}

$result2 mysql_db_query($database$sql2) or die(mysql_error());

     while (
$row2=mysql_fetch_array($result2)) {



echo 
"<td>".$row2['name']."</td>";
    echo 
"<tr>";
echo 
"<td>";
include 
$row2['pach'];
echo 
"</td>";
    echo 
"</table>"


}

?>

עכשיו אני רוצה שזה יסדר הכל לפי ה order ולא קודם את התבלה למעלה ואז את זאת שלמטה איזה דרך יש לעשות את זה? ניסיתי לתת תנאי בתוך הלולאה במקום זה
PHP קוד:

where content >'' and active '1' and pach ='' order by 'order'" 

ואז שיהיה רק SELECT אחד אבל זה מציג רק תוצאה אחת
מה לעשות?

mayden 20-06-08 15:53

קרא על:
DESC
ASC

http://www.1keydata.com/sql/sqlorderby.html


כל הזמנים הם GMT +2. הזמן כעת הוא 18:20.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ