Jump to content

Help with a select command.


imrie

Recommended Posts

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

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

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

Archived

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

×
×
  • Create New...