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

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

bilopay 28-08-08 15:10

שאלה | איך שולפים רשומה ב php לפי id?
 
איך שולפים רשומה ב php לפי id?

ASTeam 28-08-08 15:31

זה שאילתת SQL שאתה מוציא בPHP
ואתה עושה
select * table where id=$id

oryrm19 28-08-08 16:59

PHP קוד:

SELECT FROM table WHERE id='$id' 


NoWaySkill 30-08-08 01:29

PHP קוד:

$idselect mysqlquery("SELECT * FROM yourfuckingtable WHERE ID = '$yourid'"); 

תשתמש ב$idselect

OrPol 30-08-08 13:03

זה mysql_query

bilopay 30-08-08 19:40

זה לא עובד זה נותן תשגיעה:
PHP קוד:

Mysql ErrorYou have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near 'table WHERE id='1'' at line 1 

זה הקוד של השליפה:
PHP קוד:

<?
$id
="1";
$link mysql_connect('localhost' 'root' '') or die('Mysql Error: ' mysql_error());  
mysql_select_db('bar_manor' $link) or die('Mysql Error: ' mysql_error());  
  
$query  "SELECT * FROM table WHERE id='$id'"
$Result mysql_query($query) or die('Mysql Error: ' mysql_error()); 
$N mysql_num_rows($Result);
if(
$N === false
die(
'Mysql Error: ' mysql_error()); 
if (
$N 1
    echo 
'NO RESULTS'
else 

    while(
$Liner mysql_fetch_assoc($Result)) 
    { 
        
              
echo 
$Liner["text"]; 

        
       
    } 

mysql_free_result($Result) or die('Mysql Error: ' mysql_error()); 
// סוגר את החיבור לבסיס הנתונים   
mysql_close($link)         or die('Mysql Error: ' mysql_error()); 
?>


orl2008 30-08-08 22:23

זה מאוד תלוי איזו גרסת PHP אתה מריץ =]
תנסה ככה:
PHP קוד:

  $query  = ("SELECT * FROM table WHERE id='$id'"); 

בהצלחה! =]

bilopay 31-08-08 09:09

לא כתבתי מיקודם בתעות את השם של הטבלה אבל עכשיו זה נותן תשגיעה:
PHP קוד:

Mysql ErrorUnknown column 'id' in 'where clause' 


bilopay 31-08-08 09:15

לא חשוב סידרתי את זה אפשר לנעול


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

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