Hello and welcome to our community! Is this your first visit?
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
    Jun 2002
    United States
    Thanked 0 Times in 0 Posts

    Mysql - grabbing information

    Could someone please show me code to select "information" as the table and search the column "uid" and look through it until it find a uid that matches $UID and now that it knows where $uid matches with $UID i want it to echo the username in that row under column "username"

  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 92 Times in 90 Posts
    in what language ??

    the query would be

    "SELECT uid,username FROM information WHERE uid=$UID"

    (assuming uid in the DB is an integer else put quotes around it (WHERE uid='$UID')

    I assume you mean PHP (cos of the '$' - but could be PERL as well?)

    anyway in PHP (and I am assuming there can only be one row returned)

    PHP Code:
    =mysql_query("SELECT uid,username FROM information WHERE uid=$UID")or die(mysql_error());
    <html><body.... etc etc
    <tr><td><?echo $row[0];?></td><td><?echo $row[1];?></td></tr>
    blah blah.... etc
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    Posting Permissions

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