Jump to content

MySql variables in php application


baha

Recommended Posts

Hi all,

 

What I'm trying to accomplish should be simple, but I just cant figure it out  :( .

I'm trying to implement an affiliate program to my website and one line of code needs to be added to one page of my site so that the sale data is passed to the software. My site's MySql database handles sales data and the code that I need to enter needs to access two variables from the database. Here's what the affiliate software mfgr says to do...

The next step is to add code to your Thank you page so that the software tracks each sale. Simply add the following code to your Thank you page so that affiliate users who earn money based upon a successful sale will get credit.
<img src=https://www.mysite.com/affiliate/sale.php?amount=10&transaction=B style='visibility: hidden'>

The 'amount' variable should reflect the amount of your product or service. You can either hard code this amount or dynamically populate this field by passing a variable from your shopping cart containing the sale total. 'Transaction' variable is your customer's order number.

Ok, so definitely I need dynamic population because every product is a different price. In my MySql database, these two variables are used: total_order_amount and order_id .

 

So.... what's the syntax? I tried

<img src=https://www.mysite.com/affiliate/sale.php?amount=<?=$total_order_amount;?>&transaction=<?=$order_id;?> style='visibility: hidden'> but this didnt work (yes, I replaced 'mysite' with my domain  ;) )

 

Thanks in advance!!

 

Link to comment
https://forums.phpfreaks.com/topic/182347-mysql-variables-in-php-application/
Share on other sites

I'm thinking something like

<?php
$total_order_amount = [some type of post or get?];
$order_id = [some type of post or get?];
echo "
<img src='https://www.mysite.com/affiliate/sale.php?amount=$total_order_amount&transaction=$order_id' style='visibility: hidden'>";
?>

Explain more if this isn't any help. Try make sure your whole document is in PHP I find it keeps the dynamic approach much more simple.

I see... the 'get' will bring the variable's values to the page first... then I should be able to access them in the tracking code... very smart! However, I know nothing about 'get' functions. When you say 'some type of GET', what do you mean? Are there multiple types? I'm certainly willing to try anything.

 

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.