Jump to content

imimin

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Posts posted by imimin

  1. No.

     

    I now have:

     

    <?php
    
    /* Enable displaying of errors */
    error_reporting(E_ALL);
    ini_set('display_errors', 'On');
    
    $cat = $_GET['cat'];
    $get_items = "SELECT * FROM poj_products WHERE cat='$cat'";
    $get_items = mysql_query($get_items);
    if($get_items){
       $item_row = mysql_fetch_assoc($get_items);
       echo '<a href="'.$sitelocation.$item_row['url'].'?item_desc='.$item_row['id'].'>view details/order</a>';
       echo $_GET['cat'];
    }else{
       die("Unable to connect to database.".mysql_error());
    }
    
    ?>

     

    Does everything look right?

  2. You're executing the query, but not assigning its results;

     

    <?php
    $cat = $_GET['cat'];
    $get_items = "SELECT * FROM poj_products WHERE cat='$cat'";
    $get_items = mysql_query($get_items);  
    
    
    $results = mysql_fetch_assoc($get_items);
    
    
    echo '<a href="'.$sitelocation.$results['url'].'?item_desc='.$iresults['id'].'>view details/order</a>';
    

     

    After modifying the code above to suite my situation to:

     

    <?php
    $cat = $_GET['cat'];
    $get_items = "SELECT * FROM poj_products WHERE cat='$cat'";
    $get_items = mysql_query($get_items);
    
    
    $item_row = mysql_fetch_assoc($get_items);
    
    
    echo '<a href="'.$sitelocation.$item_row['url'].'?item_desc='.$item_row['id'].'>view details/order</a>';
    
    ?>

     

    It is still not working?  Still not echoing??

  3. I am definitely a rookie with php and hope I am asking this right!  What I am trying to do is send the id of the product to the next page and in that page load the product description (desc).  What I have so far is:

     

        <?php
             $cat = $_GET['cat'];
             $get_items = "SELECT * FROM poj_products WHERE cat='$cat'";
             $get_items = mysql_query($get_items);      
    
    echo '<a href="'.$sitelocation.$item_row['url'].'?item_desc='.$item_row['id'].'>view details/order</a>';
    
    ?>

     

    but url link is not echoed.  Any ideas on this?

     

    Thank you!

  4. 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!

  5. 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! 

  6. Thanks, that did the trick.  I am now longer getting the error and my web page is loading but my DB data is not being populated in my variable.  When I look at the source of my web page I get this for the metatags:

     

    		<TITLE>$item_title</TITLE>
    			<meta name="description" content="$item_desc">
    			<meta name="keywords" content="$item_keywords">
    

     

    Any additional help would be appreciated!

  7. I have the following code that I am trying to use to dynamically pull data from a database to fill my metatags.  I have confirmed I have correctly connected to the DB.  I am getting the following error:

     

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /homepages/27/d120150310/htdocs/poj/index.php on line 23

     

    Which is line 8 below.

     

    The code I am using is:

     

    		<?php
        $cat = $_GET['page'];
        $get_items = "SELECT * FROM head_data WHERE page='index.php'";
        $get_items = mysql_query($get_items);
    
    	while($item_row = mysql_fetch_array($get_items)){
    		$item_title = $item_row['title'];
    		$item_desc = $item_row['desc'];
    		$item_keywords = $item_row['keywords'];
    
    		echo "<TITLE>$item_title</TITLE>
    			<meta name="description" content="$item_desc">
    			<meta name="keywords" content="$item_keywords">";
    }
    
    ?>

     

    I am not very good at this stuff yet, but am trying to learn.

     

    Thanks!

  8. I need the substr() to truncate my desc data on this thumbnail page.  The next page will show all the desc TEXT.  The substr() works fine for the data if I do not use the <table> tag. Would it help if I sent you the web page links so you can see what is going on?

  9. Everything seems to work fine with other HTML tags (like <B>, <BR>, etc) but for some reason it does not like my <TABLE> tag??? It breaks the echo output at the point of the table and prints the table inside my page that should only be displaying thumbnail images and a truncated description.  The code is as such:

     

    			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>
    		      <center><b>$item_prod_name</b></center>
    		      <HR width=80%>
    		      ".substr($item_desc,0,85)."...
    		      <BR><BR>

     

    The data (TEXT data type)that seems to be causing the the problem is:

     

    Little Big Pants (drawstring waist)  unisex sizes range teen-adult
    Causal fun style beach towel comfort pant for coming and going from the beach resort or pool, perfect for kicking back around the house.  KIDS LOVE THEM! Mid calf length, sizes are generous:<BR><BR>
    <div align="left">
    <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>
      <td align="left">Extra Large</td>
    </tr>
    <tr>
      <td align="left">Waist</td>
      <td align="left">26-28</td>
      <td align="left">30-32</td>
      <td align="left">34-36</td>
      <td align="left">36-46</td>
    </tr>
    <tr>
      <td align="left">Inseam</td>
      <td align="left">17</td>
      <td align="left">18</td>
      <td align="left">19</td>
      <td align="left">20</td>
    </tr> 
    </table>
    </div>

     

    Any ideas?

  10. I am having problems with some code. I am echoing the following:

     

    			      <HR width=80%>
    		      ".substr($item_desc,0,85)."...

     

    When I use VARCHAR as the data type, it works well with short text.  If I place a large amount of text in using TEXT as the data type and have a table in with the text, it breaks the iteration it is in. 

     

    Can someone tell me what is going on?

  11. Should this work the same way if I set it up like this (see approximately line 12):

     

    <?php
    				$item_selected_style = $_GET['item_selected_style'];
    				$item_prod_name = $_GET['item_prod_name'];
    				$item_retail = $_GET['item_retail'];
    				$item_weight = $_GET['item_weight'];
    				$item_img = $_GET['item_img'];
    
    				echo "
    				<INPUT TYPE=HIDDEN NAME=name VALUE='$item_prod_name'>
    				<INPUT TYPE=HIDDEN NAME=price VALUE='$item_retail*.75'>
    				<INPUT TYPE=HIDDEN NAME=sh VALUE='$item_weight'>
    				<INPUT TYPE=HIDDEN NAME=img    VALUE='https://secure.impact-impressions.com/poj/includes/img_resize3.php?src=$sitelocation$item_img&width=100&height=100&qua=50'>
    				<INPUT TYPE=HIDDEN NAME=img2 VALUE=''>
    				<INPUT TYPE=HIDDEN NAME=return VALUE='http://www.patternsofjoy.com'>
    				<INPUT TYPE='RADIO' NAME='custom20' VALUE='Style: $item_selected_style' CHECKED='CHECKED' style='display:none'>
    				<B>Garment Style: </B>$item_selected_style
    				<BR>"
    				?>

     

    I tried this and it did not pass the value?

×
×
  • 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.