Basically what im wanting to do is select a problem from the table on the database and echo it. I have the following code;
<?php
$UserID = `UserIDProblem`;
if(isset($_POST['track']))
{
$username = "student";
$password = "student";
$hostname = "localhost";
$db = "details";
$link = new mysqli($hostname, $username, $password, $db);
if(! $link )
{
die('Could not connect: ' . mysql_error());
}
if(isset($_POST[`UserIDProblem`])){ $UserID = $_POST[`UserIDProblem`]; }
$USERID = $_POST['UserIDProblem'];
$sqli = "SELECT * FROM problem WHERE UserIDProblem = '$UserID'";
$UserID = mysqli_real_escape_string($link, $_POST['UserIDProblem']);
$retval = mysqli_query( $link,$sqli );
if(! $retval )
{
die('Could not find data: ' . mysqli_error($link));
}
echo "Data found successfully\n";
echo $sqli;
mysqli_close($link);
}
else
{
?>
But its not working. Am I doing the statement wrong? Basically if the USER ID is say for example 3, I want it to echo the results for USER ID being 3 but its not working. Any help? I'm not sure how to fix this. Thanks.
Aucun commentaire:
Enregistrer un commentaire