Hi Daniweb,I'm trying to modify and upgarde My codes from Native mysql to mysqli.
My trail seems to be somehow good as I got My hands with the Php Manual Documentation so forth.
The Only point I got stuck is where I implimented the mysql's mysql_affeted_rows() and so changed it to mysqli and used an Object to refference it $Query->affected_rows but it gives Me No affetceted rows.But when I use the native way the code get to execute fine.
Here is what I have in class_connection.php
<?php
class Database_Connection
{
public $Error_Message;
private $Host,$Username,$Password,$dbName;
public function Database_Connect()
{
$this->Host="localhost";
$this->Username="root";
$this->Password="";
$this->dbName="MydbName";
$Connector=@mysqli_connect($this->Host,$this->Username,$this->Password,$this->dbName);
if(mysqli_connect_errno())
{
$this->Error_Message="<br/><br/><div class='error'>Please try again Later</div>";
die($this->Error_Message);
}
else
{
//This is the handle I'll be needing to accomplish MySqli method calling
return $Connector;
}
}
}
?>
And in the other file class_login I have this code
<?php
include("class_connection.php");
class User_Login
{
//This Function will be instantiating My Link and returns its Handle whenever called
protected function MySqli_Instantiator()
{
$Connector=new Securities_Set();
return $Connector->Database_Connect();
}
//Not to Worry about this being private there is a Public Function to invoke it
private function Login_Tracker($idLogin)
{
$Login_Date=date("Y-m-d");
$Login_Time=date("H:i:s");
$Logout_Time="00:00:00";
//Calling this so as to have the DB Link handle
$MySqli=$this->MySqli_Instantiator();
$Sql="INSERT INTO login_tracker (idLogin,Login_Date,Login_Time,Logout_Time)
VALUES(".$idLogin.",'".$Login_Date."','".$Login_Time."','".$Logout_Time."')";
$Query=$MySqli->query($Sql);
//Here is where I wonder whats wrong that I cant get it working when use OOP of mysqli style?
$dbRows_Affected=$Query->affected_rows;
if($dbRows_Affected!=0 && $dbRows_Affected!=-1)
{
$this->Registered_Username($MySqli,$idLogin);
}
//I Only get to execute this statement here
elseif($dbRows_Affected==0)
{
$this->Error_Message="<div class='info'>Sorry,the System can not give You the Authentications for now as there Seems to be some Technical issue going on wait and try again afterwards.</div>";
}
elseif($dbRows_Affected==-1)
{
$this->Error_Message="<div class='error'>Sorry,there seems to be a Problem to Login please try again in few Minutes afterwards.</div>";
}
}
}
?>
I decided to find some resources more online but This Link seems to prove Me no wrong to My understanding.Any help please?...