I am building a script which will take a single string from a user, and compare it to a table in a mysql database, and if it matches 1 of the entries in the db, it will redirect the user to the corresponding page as indicated in the sql database. So far i have the following code, but i am slighty at loss of how to do a vital part of the code. Sorry if this question is too noobish for you guys, but maybe someone can at least point me in the right direction?
Code i have so far:
Code: Select all
<?php
$db = mysql_connect("localhost", "root", "mypass");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM TABLE1",$db);
//now i am adding the rows in the msql db to two arrays
while ($myrow = mysql_fetch_array($result)) {
$CODE[] = $myrowCode: Select all
;
$REDIR[] = $myrow[REDIR];
}
?>