Good day!
I felt difficulties today because my boss told me that I should separate my html and php code and I should use template to call my html code and used function in template. In opendb function they used mysql_fetch_array, in my old code I used mysql_num_rows how can I adopt the function of opendb for my if condition
here is my code:
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
include('includes/config.sender.php');
include('includes/template.inc');
session_start();
if (isset($_SESSION['logged_in'])) {
header('Location:machine1.php');
die();
}
if (isset($_POST['submit'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$username = addslashes_gpc($username);
$password = addslashes_gpc($password);
$sql_select = "SELECT
username,
password
FROM
machine_problem_rhoda_user
WHERE
username='$username'
AND
password='$password'
";
$result = $_DB->opendb($sql_select);
var_dump($result);
//var_dump($sql_select);
//$result=mysql_query($sql_select);
//$count = $_DB->countdata($result
//$count=mysql_num_rows($result);
//as I sain in opendb them used mysql_fetch_array now my problem is what should i put in my if condition and also on my var_dump($result) the output is array(),it means it cannot get or see the data in my database?
if($count==1){
$_SESSION['logged_in'] = true;
header("location:machine1.php");
}
else {
echo "<center>";
echo "Wrong Username or Password";
echo "</center>";
}
}
$tpl = new Template('.', 'keep');
$tpl->set_file(array('handle' => 'html/index.html'));
$tpl->parse('handle', array('handle'));
$tpl->p('handle');
?>
I'm sorry, but the template is not my code and i dont have the rights to change it.
I hope somebody can help me.