mannrazz Posted December 14, 2015 Share Posted December 14, 2015 (edited) predict.php <body> <!--contact form start here--> <h1>Smart Medical Application</h1> <div class="contact"> <div class="contact-top"> <h2>PREDICTION - Enter Your Symptom</h2> </div> <div class="fiel"> <form> <form action="what.php" method = "post" > <input placeholder="First Symptom" name = "first" type="text" > <input placeholder="Second Symptom" name = "second" type="text" > <input placeholder="Third Symptom" name = "third" type="text" > </form> </div> <div class="send"> <form> <input type="submit" name="submit" value="PREDICT!"/> </form> <br></br> <a href="../main/main.php"><button>BACK</button></a> </div> </div> <div class="copyright"> <p>© 2015 All rights reserved | MannRazz Dev Team</p> </div> <!--contact form end here--> </body> what.php <?php $first = $_POST['first']; $second = $_POST['second']; $first = stripcslashes($first); $second = stripcslashes($second); $first = mysql_real_escape_string($first); $second = mysql_real_escape_string($second); mysql_connect("localhost", "root", ""); mysql_select_db("predict"); $result = mysql_query("SELECT * FROM predict WHERE first = '$first' AND second = '$second'"); or die ("Failed to query database".mysql_error()); $row = mysql_fetch_array($result); if ($row['first'] == $first && $row['second'] == $second) { echo "LOGIN SUCCES WELCOME ".$row['first']; } else { "Failed to login"; } ?> **** - i want to conect with the database when both of the query is correct.. and when both is correct... i wanted to call and display the third data from the database (etc : welcome, SAM - SAM is the data that i wanted to call) but it seem doesnt working at the moments... any help will be much appreciated....thanz Edited December 14, 2015 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted December 14, 2015 Share Posted December 14, 2015 The database connection needs to be made before you can use mysql_real_escape_string(). http://php.net/manual/en/function.mysql-real-escape-string.php Also, there is a syntax error here: $result = mysql_query("SELECT * FROM predict WHERE first = '$first' AND second = '$second'"); or die ("Failed to query database".mysql_error()); There shouldn't be a semi-colon before "or". $result = mysql_query("SELECT * FROM predict WHERE first = '$first' AND second = '$second'") or die ("Failed to query database".mysql_error()); And in case you're not aware, mysql_* functions have been deprecated and will be removed in PHP 7. More information can be found here: http://php.net/manual/en/mysqlinfo.api.choosing.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.