I am trying to query one row from the table 'account'. I kind of messed up MYSQLI, so I need some advice. How can i do this?
$link = mysqli_connect("localhost","root","","database") or die("Error " . mysqli_error($link));
$query = "SELECT * FROM account WHERE username='".$user."' AND password='".$passcode."' LIMIT 1";
$result = $link->query($query) or die("Error " . mysqli_error($link));
$numrow = $result->num_rows;
$res = $result->fetch_assoc();
After the request, I want to copy the data to the session, I do like this:
session_start();
$tableau = array($res['cod_acc'],$res['username'],$res['password']);
$_SESSION['tableau'] = $tableau;
And after that, how can I print the data?
$tableau = $_SESSION['tableau'];
echo "$tableau['username']";
source
share