Jump to content

Image hyperlink to parse recordID


yandoo

Recommended Posts

Hi there,

 

I was hoping for a little help  and guidance please :)

 

I have an image that is hyperlinked and i want to parse a value of the image as a url parameter to determine which records will be displayed..

 

Im thinking that assigning a static value to the image may do the trick (but tried and failed :( )and that value is then parsed....Is this possible?? How do i do this??

 

Any help much appreciated

 

Thank you :)

Link to comment
https://forums.phpfreaks.com/topic/105278-image-hyperlink-to-parse-recordid/
Share on other sites

Hi there,

 

Im kind of getting there, i modified this line to code to:

<a href="products.php?recordID=T-Shirts"><img src="Images/t-shirt.jpg" alt="T-Shirts" width="100" height="72" border="0" /></a>

 

I manually added the recordID as T-shirts.

 

The problem is when trying to echo out the results as nothing appears??

 

Im using

 <?php echo $row_products ['ProductName'];?>

 

It doesnt work??? Is this even possible? So it appears the value "T-Shirts" is not getting parsed..??

 

Please help me

 

Thanks :)

Hi there,

 

Thanks for the speedy reply, I have tried the change you  suggested (deleting space) and still have no records outputted???

 

Theres almost nothing to the code:

 <a href="products.php?recordID=T-Shirts"><img src="Images/t-shirt.jpg" alt="T-Shirts" width="100" height="72" border="0" /></a>

<?php echo $row_products['ProductName'];?>

 

Am i missing something here??

 

Thank You :)

Hi there,

 

Sorry im being a doughnut here the SELECT query im using (which makes up entire page with image link and output code)

 

code:

<?php
$colname_products = "-1";
if (isset($_GET['recordID'])) {
  $colname_products = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);
}
mysql_select_db($database_RFW, $RFW);
$query_products = sprintf("SELECT * FROM products WHERE ProductName = '%s'", $colname_products);
$products = mysql_query($query_products, $RFW) or die(mysql_error());
$row_products = mysql_fetch_assoc($products);
$totalRows_products = mysql_num_rows($products);

 

Its wired because when i test it the url address bar shows CORRECT details. i.e.....products.php?recordID=T-Shirts.

 

The SELECT query is suppose to output all products that have the same product name i.e. T-Shirts.

 

Hope this helps

 

Thank You :)

Hi there,

 

For the purposes of testing i was trying it with out the While Loop, assuming ONLY the first record of the list is echoed. I have since then tried it with a while loop:

 <?php do { ?>
          <?php echo $row_products['ProductName'];?>
          <?php } while ($row_products = mysql_fetch_assoc($products)); ?>  

 

The thing is still Nothing is outputted???

 

I then tried the query SELECT FROM * products WHERE 'ProductName' = T-Shirt.....Within  phpmyadmin and it is working fine also there....

 

I initially thought parsing a url parameter from an image would be quite straight forward....

 

But something is a miss as still not working?? :(

 

Please Help - eek!

 

Thanks

 

:)

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.