Jump to content

[SOLVED] Can someone check my code?


Epidemic

Recommended Posts

Hello,

 

I have recently done this script for my authentication script I am making.

 

$scriptname=$item_name.'Min';
$myusername=$_COOKIE['userData'];
$mins=10000;
$sql="SELECT * FROM $tbl_name WHERE username='$myusername";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
$mytime=$rows[$scriptname];
$newtime=$mins + $mytime;
$sql="UPDATE $tbl_name SET $scriptname='$newtime' WHERE username='$myusername'";
$result=mysql_query($sql);
header("location:thankyou.php");

 

If the item name is called cool, will my code add an extra 10,000 to the MySQL database in the collum coolMin of the username found from the cookie and then redirect to thankyou.php. I think it will work but it is for my PayPal IPN and I want to be sure and get some expert advice.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/111350-solved-can-someone-check-my-code/
Share on other sites

I dont know why you are writing so much. If i am not mistaken, you want to add 10000 to some column. Then it should go

$scriptname=$item_name.'Min';
$myusername=$_COOKIE['userData'];
$mins=10000;
$sql="UPDATE $tbl_name SET `".$scriptname."`=(`".$scriptname."`+".$mins.") WHERE username='$myusername'";
$result=mysql_query($sql);
header("location:thankyou.php");

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.