cyrus709
09-18-2009, 06:05 PM
<?php
// Check to see if session is not registered, if it is not redirect to .inex.php
// Put this code in first line of every web page that you only want logged-in users to see.
session_start();
if($_SESSION['logged'] != 1){ header("location:index.php"); }
$con= mysql_connect("localhost", "root", "pass");
if(!$con)
{
die('could not connect to mysql');
}
mysql_select_db("mydb", $con);
//username variable
$convert= $_SESSION['username'];
$result = mysql_query("SELECT * FROM mail
WHERE username='$convert' AND mnum='1'");
while($row = mysql_fetch_array($result))
{
$rock = $row['reply'];
$road = $row['reply1'];
$replyinc = $rock + 1;
$replyarc = $road + 1;
}
print $replyarc . " " . $replyinc;
mysql_query("UPDATE mail SET reply = '$replyinc'
WHERE username = '$convert' AND mnum = '1'");
mysql_query("UPDATE mail SET reply = '$replyarc'
WHERE username = '$convert' AND mnum = '1'");
?>
What this is supposed to do is get a number from the DB and add one to that number, then insert it into the DB. It does add one to the previous number, but it does not re insert the number :(
// Check to see if session is not registered, if it is not redirect to .inex.php
// Put this code in first line of every web page that you only want logged-in users to see.
session_start();
if($_SESSION['logged'] != 1){ header("location:index.php"); }
$con= mysql_connect("localhost", "root", "pass");
if(!$con)
{
die('could not connect to mysql');
}
mysql_select_db("mydb", $con);
//username variable
$convert= $_SESSION['username'];
$result = mysql_query("SELECT * FROM mail
WHERE username='$convert' AND mnum='1'");
while($row = mysql_fetch_array($result))
{
$rock = $row['reply'];
$road = $row['reply1'];
$replyinc = $rock + 1;
$replyarc = $road + 1;
}
print $replyarc . " " . $replyinc;
mysql_query("UPDATE mail SET reply = '$replyinc'
WHERE username = '$convert' AND mnum = '1'");
mysql_query("UPDATE mail SET reply = '$replyarc'
WHERE username = '$convert' AND mnum = '1'");
?>
What this is supposed to do is get a number from the DB and add one to that number, then insert it into the DB. It does add one to the previous number, but it does not re insert the number :(