I am trying to select something in my table for a specific userId. Everything seems to be ok. But he doesn't echo it. This is my php:
<?php
$con=mysqli_connect(HOST,USER,PASS,DATABASE);
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysql_query($con,"SELECT punten FROM users WHERE userId ='1'") or die (mysql_error());
$row = mysql_fetch_assoc($result);
$id = $row['punten'];
echo $id;
?>
Somebody knows how to fix this?
Okay, I am connecting with mysqli and ant to select with mysql, but now it is still not working:
<?php
$con=mysqli_connect(localhost,moneyzcl_m,AJ22082002,moneyzcl_m);
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else{
echo 'connected';
}
$sql = "SELECT punten FROM users WHERE userId = 1";
$result = mysqli_query($conn, $sql);
echo $result;
?>
But it is saying connected. So, how to fix this?