Query execution problem

Discussion in 'PHP' started by computerzworld, Jun 6, 2007.

  1. #1
    Hi. I am having the problem in executing the query in PHP. Here is the query which I have written.
    mysql_query("delete from '.$tblname.' where '.$col.'= '.$val.'")

    Here $val can be string value or integer value. What should I do? Please help me. Thanks in advance.
     
    computerzworld, Jun 6, 2007 IP
  2. raredev

    raredev Peon

    Messages:
    49
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try this one
    
    if (is_string($val)) $val = '\''.$val.'\'';
    mysql_query('delete from `'.$tblname.'` where '.$col.'= '.$val) 
    
    PHP:
     
    raredev, Jun 6, 2007 IP
  3. computerzworld

    computerzworld Active Member

    Messages:
    214
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    sorry but problem solved..........:)
     
    computerzworld, Jun 6, 2007 IP