Geek Squad
New member
I have a mySQL database with points.. And you can spend them. How can you subtract a value form mySQL?
<?php
session_start();
// Include database information and connectivity
include 'login/db.php';
// We store all our functions in one file
include 'login/functions.php';
$a = $_POST['cred_spend'];
$b = user_info('cred');
$cred = $b - $a;
$c = user_info('username');
$con = mysql_connect("localhost","*EDIT*","*EDIT*");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pippin_prologin", $con);
mysql_query("UPDATE members SET cred = " . $cred . " WHERE username = " . $c . "");
mysql_close($con);
// echo $cred;
echo "Cred: <br>";
echo $cred . "<br>";
echo $b . " - " . $a . " = " . $cred;
?>
<?php
session_start();
// Include database information and connectivity
include 'login/db.php';
// We store all our functions in one file
include 'login/functions.php';
$a = $_POST['cred_spend'];
$b = user_info('cred');
$cred = $b - $a;
$c = user_info('username');
$con = mysql_connect("localhost","*EDIT*","*EDIT*");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("pippin_prologin", $con);
mysql_query("UPDATE members SET cred = " . $cred . " WHERE username = " . $c . "");
mysql_close($con);
// echo $cred;
echo "Cred: <br>";
echo $cred . "<br>";
echo $b . " - " . $a . " = " . $cred;
?>