php output of SQL

Soldato
Joined
1 Dec 2004
Posts
23,377
Location
S.Wales
Ok, right, just jazzing up my search feature for my catalogue, on the main catalogue department's output i have various descriptions of the product followed by an image (the link is stored in a field and called up out the output, this is placed inside img tags.

Im trying to do the same when outputting the search results but for some reason the image dont want to display.

Here is the code im using

Code:
while ($field = mysql_fetch_array($result))
{
echo '<div align="left" class="result">';
	$searchResults = $field['catagory'];
	echo '<b>Catagory: </b>';
	echo $searchResults;
	echo '<br>';
	
	$searchResults = $field['title'];
	echo '<b>Title: </b>';
	echo $searchResults;
	echo '<br>';
		
	$searchResults = $field['certificate'];
	echo '<b>Certificate: </b>';
	echo $searchResults;
	echo '<br>';
		
	$searchResults = $field['price'];
	echo '<b>Price: </b>';
	echo $searchResults;
	echo '<br>';
	

	//IMAGE CODE//
	echo '<img src='.$image.' />';

echo "</div>";
}

as you can see it outputs each field as stated above, but because the user is not searching for the image url, i have just echo'd the image src undeneath the last search result code.

$image is the field with the URL stored for the image, it does work as i have my main catalogue linked up in the same way..

http://www.caldicot-pc-helpdesk.co.uk/fcv/database/index4.php

go on there, select dvd or video on the left, see the output with images showing, then search for comedy in the DVD table, see output with no images.
 
The image is repeated because i havnt entered my data into the database yet, this is mearly test data..

Regarding the output of the image, iv tried this

Code:
while ($field = mysql_fetch_array($result))
{


echo '<div align="left" class="result">';
	$searchResults = $field['catagory'];
	echo '<b>Catagory: </b>';
	echo $searchResults;
	echo '<br>';
	
	$searchResults = $field['title'];
	echo '<b>Title: </b>';
	echo $searchResults;
	echo '<br>';
		
	$searchResults = $field['certificate'];
	echo '<b>Certificate: </b>';
	echo $searchResults;
	echo '<br>';
		
	$searchResults = $field['price'];
	echo '<b>Price: </b>';
	echo $searchResults;
	echo '<br>';
	

	//IMAGE CODE//
	$field['image'];
	echo '<img src='.$image.' />';

echo "</div>";
}


?>

no luck
 
so i cant do what i did with the output of the other table? instead of having the url in the img tags, the php pulls the url from the field and displays the url inside the img source using '$image' ?

its abit of a pain doin it that way because i will have to add each individual url in the php code, where as the easier way i can just add the url when im adding the table data.
 
Back
Top Bottom