SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy $SELECT and $RESULT

    Hi all, Im new here so please look at this from a newbies point of view

    What I'm trying to do is SELECT a table and then show the RESULT, this is the code so far :

    ############################################

    // Request the Member and Profile
    $result = @mysql_query('SELECT Profile FROM Profile_manager');
    if (!$result) {
    die('<p>Error performing query: ' . mysql_error() . '</p>');
    }

    // Display the Member and Profile
    while ( $row = mysql_fetch_array($result) ) {
    echo('<font face="Arial, Helvetica, sans-serif"><p>' . $row['Profile'] . '</p></font>');
    }


    ############################################

    pulling the Profile is not the problem, the problem is I also would like to pull out ['Member'] and display it in the same paragraph - would look like this...

    Napoleon['Member']

    Here's Napoleons Profile, blah blah blah ['Profile']

    Ive tried all kinds of things but can't seem to extract the Members name.

    Thx for your time and effort
    Deano
    Last edited by Deano; Apr 5, 2003 at 08:08.

  2. #2
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just add the column name to the SELECT statement...

    SELECT Profile, Member FROM .......

  3. #3
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Phil.Roberts
    Just add the column name to the SELECT statement...

    SELECT Profile, Member FROM .......
    Hi There, I tried that and all that appears now is the Members name without the Profile !

    This is how i did it

    'SELECT Member Profile FROM Profile_manager'

    anyother ideas ?

    Cheers Deano

  4. #4
    SitePoint Guru Marc's Avatar
    Join Date
    Nov 2000
    Location
    New York
    Posts
    765
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You forgot a comma... it should be
    SELECT Member, Profile FROM Profile_manager
    Marc Gugliuzza
    marc.gugliuzza.com



  5. #5
    SitePoint Evangelist Deano's Avatar
    Join Date
    Mar 2003
    Location
    Derbyshire, UK
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Marc
    You forgot a comma... it should be
    SELECT Member, Profile FROM Profile_manager

    Thx Marc it worked a treat.

    Thx all for helping me out with this one


Bookmarks

Posting Permissions

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