Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    format for php variable in select statement?

    Hello I have a formatting problem.

    I have an mysql select statement which works fine:

    // good $sql = 'SELECT * FROM `country` WHERE `country_3_code` = CONVERT(_utf8 \'usa\' USING latin1) COLLATE latin1_swedish_ci';

    I would like to put a php variable where "usa" is now.

    I have a variable = usa called $xx

    I cannot get it to work, i have tried single quotes, double quotes, back quotes, no quotes, etc.

    Plz help. Thank you.

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chingching View Post
    Hello I have a formatting problem.

    I have an mysql select statement which works fine:

    // good $sql = 'SELECT * FROM `country` WHERE `country_3_code` = CONVERT(_utf8 \'usa\' USING latin1) COLLATE latin1_swedish_ci';

    I would like to put a php variable where "usa" is now.

    I have a variable = usa called $xx

    I cannot get it to work, i have tried single quotes, double quotes, back quotes, no quotes, etc.

    Plz help. Thank you.
    PHP Code:
    $sql 'SELECT * FROM `country` WHERE `country_3_code` = CONVERT(_utf8 \'' $xx '\' USING latin1) COLLATE latin1_swedish_ci'


  •  

    Posting Permissions

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