imrie Posted August 6, 2007 Share Posted August 6, 2007 Hello...again. <?php$connect=mysql_connect('', '', '');if ($connect==false) {die('Couldn\'t Connect To Database.');}$db_select=mysql_select_db('');if ($db_select==false) {die('Couldn\'t Select Database.');}// Get all the data from the "users" table$result = mysql_query("SELECT * FROM users") or die(mysql_error()); echo "<table border='1'>";echo "<tr> <th>Name</th> <th>Userid</th> </tr>";// keeps getting the next row until there are no more to getwhile($row = mysql_fetch_array( $result )) { // Print out the contents of each row into a table echo "<tr><td>"; echo $row['username']; echo "</td><td>"; echo $row['userid']; echo "</td></tr>"; }echo "</table>";?> It needs to look something like this: http://www.gltd.com/downloads?id=(the user id number here). Right now its only producing the ids, i need the ids at the end of the url. If you can could you also put it in "<a href></a>"Thanks. Link to comment Share on other sites More sharing options...
Synook Posted August 6, 2007 Share Posted August 6, 2007 Just replace echo $row['userid']; With echo "<a href=\"http://www.gltd.com/downloads?id=$row[userid]\">$row[userid]</a>"; Also, if ($connect==false) { is the same as if (!$connect) { Link to comment Share on other sites More sharing options...
imrie Posted August 6, 2007 Author Share Posted August 6, 2007 how do i display an image also? Link to comment Share on other sites More sharing options...
Synook Posted August 6, 2007 Share Posted August 6, 2007 echo "<a href=\"http://www.gltd.com/downloads?id=$row[userid]\"><img src=\"$row[image_col_name]\" /></a>"; Where is the location of the image stored? In the table? Link to comment Share on other sites More sharing options...
imrie Posted August 6, 2007 Author Share Posted August 6, 2007 Actually its a different field, the image url is in the table.So it would be a link next to image. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.