MySQL and PHP programe ?

keshav

New member
now i have a text box if a user enters a text in that box and clicks a command button then it should fetch the related data like
SELECT * FROM table_name WHERE 'column_name' ='textbox_value';
on the button i used GET method
 
----test.html---
<form method="post" action="submit.php">
<input type="text" name="stuffToInput" />
<input type="submit" name="submit" value="Select the stuff!" />
</form>

---submit.php-----
<?php
$db = new mysqli($host,$user,$pass,$db_name);
$fetchData = $db->query(sprintf("SELECT column_name FROM table_name WHERE column_name = '%s'",
$db->real_escape_string ($_POST['stuffToInput'])));
while($record = $fetchData->fetch_array(MYSQLI_ASSOC)) {
echo $record['column_name']."< br />"; //first column name, however many records
}
mysqli_close($db);
?>
 
Which command button will the user click? Try using the help that comes with your mysql programe.
 
Back
Top