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 Coder
    Join Date
    Dec 2011
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Echo a database field based on the value of another field?

    Okay so I have a database with two columns, name and image_link.

    How would I echo the value of the image link based upon the name?

    Thanks

  • #2
    New Coder
    Join Date
    Nov 2011
    Location
    New England
    Posts
    62
    Thanks
    0
    Thanked 10 Times in 10 Posts
    does this work?

    PHP Code:

    $con 
    mysql_connect("localhost","user","password");

    mysql_select_db("my_db"$con);

    $query="SELECT * FROM NameOfTable WHERE 'name' = 'nameofpicture'  "

    $result mysql_query($query)

    echo 
    "image link: " $result[0]["image_link"]; 
    Last edited by mvmacd; 12-19-2011 at 04:11 PM.
    For programming information, visit irnsystems.com
    Also check out Points2Survey and earn items.


  •  

    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
    •