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
    Nov 2010
    Location
    England
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question MySQL and PHP Database question

    Hi all,

    Just wandering how i would go about showing the database entry with the same ID number as the value of a variable.

    Lets for now say this said variable is called $Current_Item.

    If $Current_Item = 5, i want to show the Database record with the ID number 5.


    I know how to echo the values of the database, but i cant seem to work this out.

    Any help is greatly appreciated! Thanks.

  • #2
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts
    you probably have to concatenate the value out of the statement, maybe like:
    PHP Code:
    $sql "select whatever from table where field = '" $current_item "'"
    I believe that's only for strings though.


  •  

    Tags for this Thread

    Posting Permissions

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