I have a PHP script designed to answer a users question. Currently I use arrays to provide the programmed questions and then echo the answer for that question. Instead, I want the script to search a MySQL database for questions and their answer. How can I do this in PHP?
I hope you can understand my question.
Here is my PHP code:
<?php
if(stripos($_GET['q'],'what is my ip')===0){
echo "Your IP address is <b>{$_SERVER['REMOTE_ADDR']}</b>";
}
?>
<form method='get' action=''>
<input type='text' name='q'>
<input type='submit'>
</form>