View Single Post
ישן 20-06-08, 01:11   # 1
stel222
חבר מתקדם
 
מיני פרופיל
תאריך הצטרפות: Mar 2008
הודעות: 399

stel222 לא מחובר  

שלום, צריך עזרה בהצגת שאילתה למתקדמים 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 אחד אבל זה מציג רק תוצאה אחת
מה לעשות?
  Reply With Quote