You are here:  » Standalone PHP to call image2_url


Standalone PHP to call image2_url

Submitted by CashNexus on Sat, 2019-11-02 14:16 in

Hello, David, hope you're doing well !
I try to create PHP file calling as iFrame additional image from image2_url field I've added.
I know you can say it could be done simpler - but due to some reasons I need the one as standalone calling this file from html/header.php using script

{code saved}

This part of code works well, tested with various simple PHP files.
Test site {link saved}
Image2 will be shown under Tab4 under

div id=#panel4

But now I need standalone PHP what works on the product page and call image2_url - or no matter image_url by product ID.
I've tried to use the basis of default jump.php but my file does not work.
Could you look and advise what's wrong ?

<?php
ini_set
('display_errors','on');error_reporting(E_ALL);
require(
"includes/common.php");
$txt "See test message";
echo 
"<br>";
echo 
$txt;
echo 
"<br>";
  
$id = (isset($_GET["id"])?intval($_GET["id"]):"");
  if (!
$id) exit();
  
$sql "SELECT image_url FROM `".$config_databaseTablePrefix."products` WHERE id='".database_safe($id)."'";
  if (
database_querySelect($sql,$rows))
  {
    
$product $rows[0];
  }
echo 
'<iframe style="vertical-align: top;" src=".$product["image_url"]" width="80%" height="900px" frameborder="0" scrolling="auto"></iframe>';
?>

Thanks in advance ! Have a nice weekend !
Serge

Submitted by support on Mon, 2019-11-04 10:45

Hello Serge,

That script looks fine as far as I can tell - have you double checked by viewing source that the product page is generating the URL with the ID correctly, e.g. by using something like:

your_script.php?id=<?php print $product_main["id"]; ?>

...or maybe in PHP mode something like:

"yourscript.php?id=".$product_main["id"];

Cheers,
David.
--
PriceTapestry.com