Jump to content

[SOLVED] Displaying mysql records individually


Thauwa

Recommended Posts

just have it dynamicly echo out links

 

say

 

page.php?item=$itemName

 

 

then on page.php

MEH SOMETHING LIKE THIS

 

	$itemName = mysql_escape_string(trim(htmlentities($_GET['itemName'])));
				$query = "SELECT * FROM ITEMS WHERE itemName = '$itemName'";	
				$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

so... I do something like

 

$data = mysql_query("SELECT * FROM items") or die(mysql_error()); 
while($info = mysql_fetch_array( $data )) //array
{ 

$item= $info['item']

echo 'Item: <a href=http://www.ilovedoingstuff.com/items.php?item=$item>' .$info['item'] . ' </a>'; 
}

but is my code correct ?  ???

I am still a simple programmer!  :P

 

$data = mysql_query("SELECT item FROM items") or die(mysql_error());
while($info = mysql_fetch_array( $data )) //array
{
   echo "Item: <a href=\"http://www.ilovedoingstuff.com/items.php?item={$info['item']}\">{$info["item"]}</a>";
}

 

I believe that should do it.

Archived

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

×
×
  • Create New...

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.