Can anyone show me in basic php or asp how to allow a user to enter keywords into a text field and have the database return entries with the keyword they typed in? I know the SQL for it, but how do you define a variable that will store the keyword the user enters and how do you put it into the SQL query? Please help!
So, you know SQL and I assume you know HTML too. You want to start server side programming today, am I right? See the PHP way: <?php $keyword = $_POST['your_text_field_name']; //$_POST if the HTML form is submitted using POST method, $_GET if in GET method mysql_connect("DB_SERVER","DB_USERNAME","DB_PASSWORD"); mysql_select_db("DB_NAME"); //these are all PHP library functions like mysql_connect, mysql_select_db, mysql_query, mysql_fetch_array - click on the hyperlinked function names to explore the ref page from PHP.net site $rowset = mysql_query("SELECT * FROM table_name WHERE col_name LIKE '%".$keyword."%'"); //Use the most appropriate query, I used wildcards while($row = mysql_fetch_array($rowset)) { Print $row['col_name1'] . " " . $row['col_name2'] . "<br>"; //concatenated columns... you can produce ur own output... } ?> PHP: That's for basic. But, if you really want to learn in details, want to explore, don't post such 'how to start' queries on forum. It takes more time to learn from forum posts/ asking questions, than that of learning from a tutorial and trying yourself. When you learn the basics, ask on forums to get solution for your individual queries, specific problems. Get the best reference for beginning here: http://www.w3schools.com/php/php_mysql_intro.asp http://www.w3schools.com/asp/asp_ado.asp Best of luck for Happy Reading!!!