SQL query

StanleyDev

Member
Nov 13, 2011
35
0
Im making a lotto system, and I have made most of the code but I just cant figure out how to send the SQL query into the DB to record the number that user choose/and to remove the appropriate number of lotto points(made a currency as well).

The query codes are:
PHP:
<?php
          $db = mysql_query ("INSERT INTO `lottery` (`id`, `username`, `num`) VALUES ('$uid','$id','$finalnum');"); 
          $db2 = mysql_query ("UPDATE `users` SET `lotto_points`='0' WHERE (`id`='$uid');"); // Remove 24 lotto point from the user, poor thing.
          ?>
I want it to send when the user clicks on a button

Could someone please write a code for a button so it could execute these query's when it is clicked.
 

StanleyDev

Member
Nov 13, 2011
35
0
I only gave you the example , into the isset you type the queries you want to run..
so i could do this:
Code:
if(isset($_POST['buttonname'])
{
  $db = "INSERT INTO `lottery` (`id`, `username`, `num`) VALUES ('$uid','$id','$finalnum');"
  $db2 = "UPDATE `users` SET `lotto_points`='0' WHERE (`id`='$uid');"
}
else
 

StanleyDev

Member
Nov 13, 2011
35
0
uhm im getting this error now: Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\llot.php on line 133

Line 133 =
Code:
$db = ("INSERT INTO `lottery` (`id`, `username`, `num`) VALUES ('$uid','$id','$finalnum');");
 

Users who are viewing this thread

Top