Jump to content

Archived

This topic is now archived and is closed to further replies.

Wes1890

Help with using varaibles to retrieve data from...

Recommended Posts

First off, here is my code:

 

<?php

// Connect

include("connect.php");

 

// Make the DB info into variables

$getnews = mysql_query("SELECT * FROM news ORDER BY news_id DESC"); }

 

// Set a function for easier reading down below 

function get_uidlink()

{

  $getuid = mysql_query("SELECT * FROM members WHERE username='".$user."'") or die ("Error: I need to talk to kylah more");

  $trowuid = mysql_fetch_array($getuid);

}

 

// Display the news

while($r=mysql_fetch_array($getnews))

{

  extract($r);

  $title = stripslashes($title);

  $message = stripslashes($message);

  get_uidlink();

    echo "<TABLE cellSpacing=0 cellPadding=4 width='100%' align=center>

  <TBODY>

    <TR>

    <TD class=memberbar><b>$title</b><br><i>Posted by </i><b><a href='members.php?mem_id=$member_id>$user</a></b><i> on </i><b>$date</b> at </i><b>$time</b></td>

    </TR>

    <TR>

    <TD class=newsmessage>$message</td>

    </TR>

  </TBODY>

  </TABLE><br>";

}

 

?>

 

Note the bold part...

 

That code displays a new section for each row of news is in the database.

And in the row of news, it has the news article creator's name, which is Wes (me).

 

I'm wanting to take that name "Wes" and get it's member id number (which is #1) and i want it to link to the members.php page where it will show the profile information for Wes...

 

But the username will not always be "Wes", so it needs to be selected inside the WHILE loop... I hope i'm making sence to ya'll phpFreaks...

 

Anyways, help would be awesome

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.