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

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

Press 28-04-06 13:57

בעיה בקוד הצגת הודעות אחרונות
 
שלום כולם,
יש לי את הקוד הבא שאמור להציג את ההודעות האחרונות מהפורומים:
PHP קוד:

<?php
mysql_connect
('localhost''******''******');
mysql_select_db('******');
$r mysql_query("SELECT t.id, t.topic_title
    FROM ibf_posts p, ibf_topics t, ibf_forums f
    WHERE f.auth LIKE '0%' AND t.forum_id = f.id AND p.id = t.last_post_id
    ORDER BY p.post_time DESC LIMIT 10"
);
echo 
'<ul>';
while ( 
$out mysql_fetch_array($r) ) {
    
    echo 
'<li><a href="index.php?showtopic='.$out['id'].'">';
    echo 
htmlspecialchars($out['topic_title']).'</a></li>';
    
}
echo 
'</ul>';
?>

זה מציג לי את השגיאה הבאה:
קוד:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sport/domains/***/public_html/forum/123.php on line 9
תודה מראש.

בברכה,
עידו דרור

misterdino 28-04-06 14:01

יכול להיות שחסר הקודה-פסיק...
PHP קוד:

while ( $out mysql_fetch_array($r) ;) { 

אני לא בטוח... אבל שווה לנסות

Press 28-04-06 14:04

ציטוט:

נכתב במקור על ידי misterdino
יכול להיות שחסר הקודה-פסיק...
PHP קוד:

while ( $out mysql_fetch_array($r) ;) { 

אני לא בטוח... אבל שווה לנסות

קוד:

Parse error: syntax error, unexpected ';'

Rom 28-04-06 14:07

שחכת גרש אחד
הוספתי אותו והבלטתי

PHP קוד:

<?php 
mysql_connect
('localhost''******', [B]'[/B]******'); 
mysql_select_db('******'); 
$r mysql_query("SELECT t.id, t.topic_title 
    FROM ibf_posts p, ibf_topics t, ibf_forums f 
    WHERE f.auth LIKE '0%' AND t.forum_id = f.id AND p.id = t.last_post_id 
    ORDER BY p.post_time DESC LIMIT 10"
); 
echo 
'<ul>'
while ( 
$out mysql_fetch_array($r) ) { 
     
    echo 
'<li><a href="index.php?showtopic='.$out['id'].'">'
    echo 
htmlspecialchars($out['topic_title']).'</a></li>'
     

echo 
'</ul>'
?>


Press 28-04-06 14:09

ציטוט:

נכתב במקור על ידי DragonRom
שחכת גרש אחד
הוספתי אותו והבלטתי

PHP קוד:

<?php 
mysql_connect
('localhost''******', [B]'[/B]******'); 
mysql_select_db('******'); 
$r mysql_query("SELECT t.id, t.topic_title 
    FROM ibf_posts p, ibf_topics t, ibf_forums f 
    WHERE f.auth LIKE '0%' AND t.forum_id = f.id AND p.id = t.last_post_id 
    ORDER BY p.post_time DESC LIMIT 10"
); 
echo 
'<ul>'
while ( 
$out mysql_fetch_array($r) ) { 
     
    echo 
'<li><a href="index.php?showtopic='.$out['id'].'">'
    echo 
htmlspecialchars($out['topic_title']).'</a></li>'
     

echo 
'</ul>'
?>


כן הוספתי אותו פשוט ששיניתי שלא תראו את הפרטים אז הוא נמחק.

BlueNosE 28-04-06 14:25

PHP קוד:

<?php
mysql_connect
('localhost''******''******');
mysql_select_db('******');
$r mysql_query("SELECT t.id, t.topic_title
    FROM ibf_posts p, ibf_topics t, ibf_forums f
    WHERE f.auth LIKE '0%' AND t.forum_id = f.id AND p.id = t.last_post_id
    ORDER BY p.post_time DESC LIMIT 10"
);
if (@
mysql_num_rows ($r) == 0)
echo 
"אין תוצאות";
else {
echo 
'<ul>';
while ( 
$out mysql_fetch_array($r) ) {
    
    echo 
'<li><a href="index.php?showtopic='.$out['id'].'">';
    echo 
htmlspecialchars($out['topic_title']).'</a></li>';
    
}
echo 
'</ul>';
}
?>


Press 28-04-06 14:29

ציטוט:

נכתב במקור על ידי BlueNosE
PHP קוד:

<?php
mysql_connect
('localhost''******''******');
mysql_select_db('******');
$r mysql_query("SELECT t.id, t.topic_title
    FROM ibf_posts p, ibf_topics t, ibf_forums f
    WHERE f.auth LIKE '0%' AND t.forum_id = f.id AND p.id = t.last_post_id
    ORDER BY p.post_time DESC LIMIT 10"
);
if (@
mysql_num_rows ($r) == 0)
echo 
"אין תוצאות";
else {
echo 
'<ul>';
while ( 
$out mysql_fetch_array($r) ) {
    
    echo 
'<li><a href="index.php?showtopic='.$out['id'].'">';
    echo 
htmlspecialchars($out['topic_title']).'</a></li>';
    
}
echo 
'</ul>';
}
?>


תודה אבל עכשיו הוא כותב "אין תוצאות" ויש הודעות בפורום...
יכול להיות שלא עשיתי משהו כמו שצריך בחלק הזה?:
PHP קוד:

$r mysql_query("SELECT t.id, t.topic_title
    FROM ibf_posts p, ibf_topics t, ibf_forums f
    WHERE f.auth LIKE '0%' AND t.forum_id = f.id AND p.id = t.last_post_id
    ORDER BY p.post_time DESC LIMIT 10"
); 

אגב אני משתמש במערכת IB

BlueNosE 28-04-06 14:50

אני חושב שבשורות המה לשלוף, האליאס עוד לא מוגדר לP F ו-T, תנסה לתת נתיב מלא קודם..
חוצמזה שים לב לLIMIT שלך

Press 28-04-06 14:53

ציטוט:

נכתב במקור על ידי BlueNosE
אני חושב שבשורות המה לשלוף, האליאס עוד לא מוגדר לP F ו-T, תנסה לתת נתיב מלא קודם..
חוצמזה שים לב לLIMIT שלך

איך עושים את זה? |מסמיק|


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

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