in php using mysql query with joins not returing any values
Posted: Mon Mar 06, 2017 2:20 am
the code mentioned here is that i am running a query which works fine in mysql without any user input i am trying to execute it with user input
the form part where the user input is taken
<form action="result.php" method="post">
<input type="text"name="input"size=40>
<input type="submit"value="SUBMIT">
and the result part
the issue here is that the query gets the output instead of the mysql rows values please help me out thanks in advance
the form part where the user input is taken
<form action="result.php" method="post">
<input type="text"name="input"size=40>
<input type="submit"value="SUBMIT">
and the result part
Code: Select all
<?php
$dbuser = 'root';
$dbpass = '';
$db='owaiskhan';
$dbhost='localhost';
$conn = mysqli_connect($dbhost,$dbuser,$dbpass,$db);
if(! $conn )
{
die('Could not connect: ' . error);
}
$input = mysqli_real_escape_string($conn, $_POST['input']);
$result="SELECT answers_1.*, answers_2.*, answers_3.*, answers_4.*, biodata.* FROM answers_1 INNER JOIN answers_2 ON
answers_1.anseng_id = answers_2.anseng_id AND answers_1.anseng_id INNER JOIN biodata ON biodata.anseng_id = answers_1.anseng_id INNER JOIN
answers_3 ON biodata.anseng_id = answers_3.anseng_id INNER JOIN answers_4 ON biodata.anseng_id=answers_4.anseng_id WHERE biodata.anseng_id='".$input."' " ;
//echo "$query";
echo"$result";
?>