SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question on returning 1 row of data

    if' i'm trying to grad just a 1 row of data i should use fetch_row right?

    i'm having some problems.
    i'm not getting any data back from my query. could it be because i'm using fetch_row wrong? here's my code:
    PHP Code:
    <?
    $user_id 
    $id;

    $font "<font size=\"2\" color=\"#FFFFFF\" face=\"Verdana\">";
    $endfont "</font>";

    $profile_query "SELECT id,username,email,dis_email,reg_date,url,icq,aim,yahoo,msn,interests,comments,verify from 3dartisan_users";
    $profile_query.= " WHERE id='$id'";

    $run_query mysql_db_query ($dbname$profile_query$db_connect);
    $profile_reults mysql_fetch_row($run_query);

    include (
    'http://www.3dartisan.net/head.php');
    ?>
    <body bgcolor="#000000" text="#FFFFFF" link="#808080" vlink="#CCCCCC" alink="#FFFFFF" topmargin="0">
    <center><img src="/images/nav2.jpg" border="0" usemap="#FPMap0" width="800" height="100"></center>
    <br>
    <br>
    <br>
    <table width="80%" cellspacing="2" cellpadding="3" border="0" align="center">
     <tr>
      <td width="30%" nowrap bgcolor="#555555"><? print $font ?>Username<? print $endfont ?></td>
      <td width="70%" nowrap bgcolor="#520608"><? print $profile_results[username]; ?></td>
     </tr>
     <tr>
      <td width="30%" nowrap bgcolor="#555555"><? print $font ?>Email<? print $endfont ?></td>
      <td width="70%" nowrap bgcolor="#520608">
      <?
        
    // Check the display email option.
        
    if ($profile_reults[dis_email]=="1"){
        print 
    "<a href=\"mailto:$profile_results[email]\">$profile_results[email]</a></td>\n";
        } else {
        print 
    "<font size=\"2\" color=\"#FFFFFF\">Email Witheld</font></td>"; } ?>
     </tr>
      <td width="30%" nowrap bgcolor="#555555"><? print $font ?>Date Registered<? print $endfont ?></td>
      <td width="70%" nowrap bgcolor="#520608"><? print $profile_results[reg_date?></td>
     </tr>
    The script is'nt quite done, but so far, i'm not displaying any data except where the email is. It only displays "Email Witheld", yet the id i'm passing has dis_email set to 1.
    any ideas what i've screwed up this time?
    Last edited by Defender1; Jul 30, 2001 at 22:38.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just to note: mysql_fetch_array() doesn't work for me either.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    SitePoint Zealot alexk's Avatar
    Join Date
    Nov 2000
    Location
    Sydney, Australia
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should use either
    $profile_results["dis_email"] & mysql_fetch_array() - mind the quotes!
    or
    $profile_results[3] & mysql_fetch_row() - 3 is the position of column in your SELECT query

    also, you've got some misspellings of profile_results, naming it profile_reults sometimes

    HTH

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and here i thought i had the thing w/o spelling errors!
    those 2 mispellings of $profile_results are what caused no data!
    thx dude.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


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
  •