SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Is my SELECT syntax correct?

  1. #1
    SitePoint Guru solidcodes's Avatar
    Join Date
    Jul 2006
    Posts
    642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is my SELECT syntax correct?

    Hi guys I have query codes below,

    Code:
    $offering = 'test';
    $query = $this->db->query("SELECT * FROM swap WHERE offering = $offering");
    if ($query->num_rows() > 0)
    {
       $row = $query->row(); 
       $swapid = $row->swap_id;
    }
    Is my SELECT codes correct?
    Please correct me if I'm wrong.

    Thanks in advanced.

  2. #2
    From Italy with love bronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    8,654
    Mentioned
    77 Post(s)
    Tagged
    4 Thread(s)
    No. $offering contains a string, so you should put quotes around it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •