View Single Post
ישן 15-10-07, 06:32   # 1
miniature
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 1,754

miniature לא מחובר  

[SQL+PHP] עזרה עם הפונקציה LAST

אני מנסה לשלוף מטבלה את שדה ה-"content" בעל ה-"id" הכי גבוה.. (השורה שנוספה אחרונה לצורך העניין..). ניסיתי כך ולא עבד:
PHP קוד:
$my_query = @mysql_query("SELECT LAST(id) as content FROM mytable ORDER BY id") or die (mysql_error());
$my_fetch = @mysql_fetch_array($my_query);
echo 
strip_tags($my_fetch['content']); 
ניסיתי גם עם:
PHP קוד:
LAST(`id`) 
ובשני המקרים זה החזיר לי את השגיאה:
קוד:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id) as content FROM mytable ORDER BY id' at line 1
תודה,
__________________
יואב.

דרכים ליצירת קשר:

אימייל: thebigfire@walla.co.il
הודעה פרטית