Wes1890 Posted November 2, 2005 Share Posted November 2, 2005 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.