Hope someone can help me with this issue...

I'm running a query from my database:

$comp = mysql_query("SELECT company FROM user WHERE username='credo'");

And further down i have:

<td align="center" class="row2">Welcome, <?php echo $comp ?></td>

but when I run the page I'm getting this:

Welcome, Resource id #5

instead of displaying the actual value of $comp - which should be rwarchitect (Welcome, rwarchitect). What does that mean, and why is it displaying that instead of the actual value of the "company" cell?

    because unlike ASP, PHP returns a handle to the dataset, not the actual data itself...

    try this:

    
    $row = mysql_fetch_array($comp);
    
    ?>
    
    <td align="center" class="row2">Welcome, <?php echo $row['comp']; ?></td> 
    
    

      hmm... now it doesn't display anything. Any other suggestions?

        show all code

        edit --> that field should be company not comp

        <td align="center" class="row2">Welcome, <?php echo $row['company']; ?></td>

          so this is what I should have?

          $comp = mysql_query("SELECT company FROM user WHERE username='".$username."'");
          $row = mysql_fetch_array($comp);
          $compname = $row['company'];
          

          then

          <td align="center" class="row2">Welcome, <?php echo $compname; ?></td>

            That did it! Thank you very much for your help!!! I really appreciate it! 😃

            Cheers!

              Write a Reply...