Jump to content

Could Use Some Help


xpack

Recommended Posts

How do I do something like this

$promotionalcode = $db->query("SELECT * FROM `<PRE>promotions` WHERE `amount` = '{$main->getvar['promo']}'");

 

I want it to check what the user typed in the box and look for that in the promotions table 'promo' and from there take the amount 'amount' and make that equal to $promotionalcode

Link to comment
https://forums.phpfreaks.com/topic/208380-could-use-some-help/
Share on other sites

Well the <PRE> works thats not a problem.

 

But I tried this

 

$sql = "SELECT `amount` FROM `<PRE>promotions` WHERE `promo`  = '{$main->getvar['promo']}'"; 
echo $sql; // does this give the query that you are looking for??
$code = $db->query($sql);
$amount = $amountinfo['monthly'] - $code

 

But when Tried that and I got

 

78634558.png

 

As you can see it echoed sql as a string and there is a value promo in the table and when I try that in phpmyadmin it shows the correct value

 

Oh and btw I want it to find amount from promotions table where promo = what the user entered

Link to comment
https://forums.phpfreaks.com/topic/208380-could-use-some-help/#findComment-1090438
Share on other sites

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.