1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP and MySQL question

Discussion in 'PHP' started by tushardhoot1, Sep 7, 2007.

  1. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #21
    nico_swd, Sep 11, 2007 IP
  2. tushardhoot1

    tushardhoot1 Active Member

    Messages:
    3,013
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    90
    #22
    tushardhoot1, Sep 11, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #23
    
    <?
    session_start();
    //Check to make sure they're logged in.
    include 'check.php';
    //Include the config panel into the page.
    include 'config.php';
    //Get on with the page
    echo "Welcome, $username";
    mysql_connect($server, $db_user, $db_pass)or die ($theError);
    mysql_select_db($database)or die ($theError);
    $query = mysql_query("select balance from `users` where `username`= '" .mysql_real_escape_string($username) . "' LIMIT 1")or die($theError);
    $userinfo = mysql_fetch_array($query);
    
    echo 'You currently have a balance of ' . $userinfo['balance'];
    ?>
    
    PHP:
     
    nico_swd, Sep 11, 2007 IP
  4. johngodfrey122

    johngodfrey122 Peon

    Messages:
    115
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #24
    You escape when you actually want to output a quote.

    echo "hello \"I said Hello\" ";
     
    johngodfrey122, Sep 11, 2007 IP
  5. sea otter

    sea otter Peon

    Messages:
    250
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #25
    sea otter, Sep 11, 2007 IP
  6. tushardhoot1

    tushardhoot1 Active Member

    Messages:
    3,013
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    90
    #26
    Thanks everyone!!

    Usually I'd say I'll try it out in the morning, but right now I can't wait so I'll try it out right now :p


    Edit:

    Yippeee!!

    Its working!

    Thanks for all the help everyone!
     
    tushardhoot1, Sep 11, 2007 IP
  7. leeann.william

    leeann.william Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #27
    yes, you can do this by writing the statement mysql_query("Select col1, col2, col3, clo4 from table name where col1='your selection'");

    Try this to select multiple column.

    you can also do by this method:-
    mysql_query("Select * from table name where col1='your selection'");
     
    leeann.william, Dec 17, 2009 IP