hi..The problem is that the data is not saved in the database
Knowing he was not shown to me any errors in the code, but does not store data in the database
<?
class myclass{
function __construct(){
$conn=mysql_connect("localhost","root","1");
mysql_select_db("society",$conn);
}
function validlogin($t1,$t2)
{ $res = mysql_query("select * from admin where username = '$t1' and pass = '$t2'");
$count = mysql_num_rows($res);
if($count== 0)
return false;
else
return true;
}
function addnews($t2,$t1,$f1,$date){
mysql_query("insert into news(title,content,pic,date) values('$t1','$t2','$f1','$time') ");
}
}
?>
$t1,$date,$newimg);
}
?>
Knowing that he enters the database when they connect and check the user name and password
//////////////////////////
<?
session_start();
include("myclass.class.php");
function genRandomString() {
$length = 10;
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$string = "";
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
?>
/////////////////////////
<?
class myclass{
function __construct(){
$conn=mysql_connect("localhost","root","1");
mysql_select_db("society",$conn);
}
function validlogin($t1,$t2)
{ $res = mysql_query("select * from admin where username = '$t1' and pass = '$t2'");
$count = mysql_num_rows($res);
if($count== 0)
return false;
else
return true;
}
function addnews($t2,$t1,$f1,$date){
mysql_query("insert into news(title,content,pic,date) values('$t1','$t2','$f1','$time') ");
}
}
?>