Jump to content

HELP with <table> data passing through <php> script in strange way!


imimin

Recommended Posts

Are there any formatting problems in using _GET  to pass <table>, <tr> and <td> from a database?  I have the code below in a DB field (field name: 'desc' and the data type is TEXT):

 

<table border="1" width="100%" cellpadding="1" cellspacing="1">
<tr>
  <td align="left"> Size </td>
  <td align="left"> Small </td>
  <td align="left"> Medium </td>
  <td align="left">Large</td>
</tr>
<tr>
  <td align="left"> Garment<BR>Length (inches)</td>
  <td align="left">20</td>
  <td align="left">28</td>
  <td align="left">35(Not available in purple hibiscus or 100 Dollar Bill)</td>
</tr>	
</table>

 

and using the following <php> code to pull the data from the DB and echo it:

 

		<?php
    $cat = $_GET['cat'];
    $get_items = "SELECT * FROM poj_products WHERE cat='$cat'";
	$get_items = mysql_query($get_items);

	echo "<CENTER>";
	echo "<TABLE WIDTH=\"90%\" CELLSPACING=\"10\">";
	echo "<TR>";

	$rowbreaks = 1;
	while($item_row = mysql_fetch_array($get_items)){
		$item_desc = $item_row['desc'];
		$item_url = $item_row['url'];
		$item_img = $item_row['img'];
		$item_prod_name = $item_row['prod_name'];
		$item_prod_code = $item_row['prod_code'];
		$item_retail = $item_row['retail'];
		$item_available_colors = $item_row['available_colors'];
		$item_available_sizes = $item_row['available_sizes'];
		$item_selected_style = $item_row['selected_style'];
		$item_selected_color = $item_row['selected_color'];
		$item_selected_size = $item_row['selected_size'];
		$item_weight = $item_row['weight'];

		echo "<TD class=\"preview-images\" VALIGN=\"top\" WIDTH=\"25%\">
		      <CENTER><A HREF=\"$sitelocation" . "$item_url" . "?" . "item_desc=" . "$item_desc" . "&" ."item_prod_name=" . "$item_prod_name" . "&" ."item_available_colors=" . "$item_available_colors". "&" ."item_available_sizes=" . "$item_available_sizes". "&" ."item_retail=" . "$item_retail". "&" ."item_prod_code=" . "$item_prod_code". "&" . "item_img=" . "$item_img" . "&" ."item_selected_style=" . "$item_selected_style". "&" ."item_selected_color=" . "$item_selected_color". "&" . "item_selected_size=" . "$item_selected_size" . "&" . "item_weight=" . "$item_weight\">
		      <IMG SRC=\"includes/img_resize3.php?src=$sitelocation$item_img&width=144&height=144&qua=50\" BORDER=\"0\"></A>
		      <BR>
		      <CENTER><A HREF=\"$sitelocation" . "$item_url" . "?" . "item_desc=" . "$item_desc" . "&" ."item_prod_name=" . "$item_prod_name" . "&" ."item_available_colors=" . "$item_available_colors". "&" ."item_available_sizes=" . "$item_available_sizes". "&" ."item_retail=" . "$item_retail". "&" ."item_prod_code=" . "$item_prod_code". "&" . "item_img=" . "$item_img" . "&" ."item_selected_style=" . "$item_selected_style". "&" ."item_selected_color=" . "$item_selected_color". "&" . "item_selected_size=" . "$item_selected_size" . "&" . "item_weight=" . "$item_weight\">view details/order</A>

		      <center><b>$item_prod_name</b></center>
		      <HR width=80%>
		      ".substr($item_desc,0,85)."...
		      <BR><BR>
		      $item_prod_code
		      <BR>
		      <B>$item_retail</B></P>
		      <BR></TD>";

		if($rowbreaks == 4){
			echo "</TR><TR>";
			$rowbreaks = 0;
		}

		$rowbreaks++;
	}

	echo "</TR>";
	echo "</TABLE>";
	echo "</CENTER>";

?>

 

The problem is for some reason the TABLE data minus the tags (<table>,<tr> and <td>) is echoing along with all the HREF data starting with "item_prod_name=" ??? I checked to see if the 'substr' function may be causing the problem, but that is working perfectly.  It has something to do with passing the <table> data from the data base field to the web page.

 

Thank you for your help! 

Everything works fine BEFORE I try to put a table in the DB.  I have an array of photos with descriptions under the photos.  When this problem occurs, it only affects the first photo/desc in the array.  THAT IS BECAUSE IT IS THE ONLY ONE AT THIS POINT THAT HAS <TABLE> DATA IN THE DATA BASE ASSOCIATED WITH IT.

 

Does anyone have any knowledge on this (passing the <table> data from the data base field to the web page). 

 

Thank you!

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.