Whats wrong with my syntax?

Discussion in 'PHP' started by NITRO23456, Jul 26, 2009.

  1. #1
    PLease help!!! can't figure out whwats wrong:

    
    global $dal;
    $rs = $dal->details->[B]Query("city='".$value."'","");[/B]
    $datatmp = db_fetch_array($rs);
    $value = "<a href=\"details_view.php?editid1=".$datatmp["ID"]."\">".$value."</a>";
    
    Code (markup):
    The php error points towards something around the bit in bold!
     
    NITRO23456, Jul 26, 2009 IP
  2. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #2
    code seems ok , just paste complete error
     
    crivion, Jul 26, 2009 IP
  3. NITRO23456

    NITRO23456 Well-Known Member

    Messages:
    516
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #3
    The error is:

    
    PHP error happened
    
    Technical information 
    Error type 256 
    Error description 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='orlando'' at line 1 
    URL [url]www.****.com/project/details//output/details_list.php?[/url]  
    Error file /home/content/******/html/project/details/output/include/dbconnection.php 
    Error line 34 
    SQL query select * from `details` where city='orlando' 
    Solution This is a general error. It occurs when there is an error in event code or in SQL.
    
    Code (markup):
     
    NITRO23456, Jul 26, 2009 IP
  4. stOK

    stOK Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Check the value of $value before execution.
    How came you have id instead of city?
     
    stOK, Jul 26, 2009 IP
  5. ankit_frenz

    ankit_frenz Active Member

    Messages:
    1,111
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    63
    #5
    this is the query you are using:-

    but the error says

    that sounds weired....how an argument to value city is grabbed by id ? ..check the sql query properly..
    Thanks
     
    ankit_frenz, Jul 26, 2009 IP
  6. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Just chiming in since it seems like he went offline, I just fixed his code bout an hour ago to do what he wants. I guess worry not so much about the error returned and code structure since it was changed before posting to protect the nature of the script.
     
    kblessinggr, Jul 26, 2009 IP