PHP - Mysql Search Help, Cannot Get This To Work
Hi everyone,
Would someone be able to help me out here, I cannot get this to work. Basically I have 3 pages, I with a search box which then run's a search script to display the results. Then the results are clickable, the idea is when the user clicks the result it takes them to another page which I want to display the info from the database.....if that makes sense, but when the link is clicked nothing is displaying. So here is what I have done so far: index.php - This is the page with the search box, code is : Code: [Select] <?php $dbhost = 'localhost'; $dbuser = '*********'; $dbpass = '********'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = '***********'; mysql_select_db($dbname); ?> <form name="form" action="search.php" method="get"> <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form> When they hit submit it takes them to the results page, code is: Code: [Select] <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","********","********"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("**********") or die("Unable to select database"); //select which database we're using // Build SQL Query $query = "select * from Fish where Commonn like \"%$trimmed%\" order by Commonn"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results<br><br>"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["Commonn"]; echo "$count.) <a href='info.php?ID=$ID'>$title</a>" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> When they click the results from this page it takes them to another page which should (but doesnt) display the info from the mysql database, code is: Code: [Select] <?php // now you can display the results returned echo "$title" ; ?> Im really sorry if this is obvious or if I have dont something completely wrong but im very new to php and trying to learn on the job. Many Thanks in advance Jay Similar TutorialsNeed some help I have 2 tables in a database and I need to search the first table and use the results from that search, to search another table, can this be done? and if it can how would you recommend that I go about it? Thanks For Your Help Guys! The result pages is supposed to have pagination like google help me please
Hi all How do I modify the below code to search multiple tables in mySQL database? $query = "select * from store_items where description like \"%$trimmed%\" or title like \"%$trimmed%\" or dimensions like \"%$trimmed%\" order by id ASC"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); It is for a search function and I need it to search another table called 'about_text' and 'faq_text' Thanks Pete Good evening, I am a newbie when it comes to programming, and I am yet learning. With several help from this forum, and other websites, I am able to finish my very first PHP project. It worked fine, as well as the search engine. However, it is foreseen that the application will be utilizing huge amount of data which would require pagination when viewing. And so I found a tutorial from php freaks as well. However, after I integrated the codes from my web application, the search engine suddenly stopped working. It is still, when I leave the field blank, which would display all data. However, if I type down a search query on the field, it still displays all data. Can anyone help me on this? Here's my complete code: <link href="add_client.css" rel="stylesheet" type="text/css"> <?PHP include("dbconnection.php"); $query = "SELECT * FROM records"; if(isset($_POST["btnSearch"])) { $query .= " WHERE last_name LIKE '%".$_POST["search"]."%' OR first_name LIKE '%".$_POST["search"]."%'OR territory LIKE '%".$_POST["search"]."%'OR job_title LIKE '%".$_POST["search"]."%'OR title LIKE '%".$_POST["search"]."%'OR employer LIKE '%".$_POST["search"]."%' ORDER BY territory ASC" ; $result = mysql_query($query, $connection) or die(mysql_error()); } ?> <table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="760" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="199" align="center" valign="top"><a href="login.html"><img src="invent-asia.gif" alt="" width="152" height="58" border="0" /></a> <script type="text/javascript" src="menu.js"></script></td> <td width="176" align="right" valign="bottom"><a href="main.php"><img src="Home.jpg" width="104" height="20" border="0"/></a></td> <td width="130" align="right" valign="bottom"><img src="View.jpg" width="104" height="20" border="0"/></td> <td width="146" align="right" valign="bottom"><a href="add_client.php"><img src="Add.jpg" width="104" height="20" border="0"/></a></td> <td width="109" align="right" valign="bottom"> </td> </tr> </table></td> </tr> <tr> <td><table width="760" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="200" height="3" bgcolor="#1B1C78"><img src="images/topspacerblue.gif" alt="" width="1" height="3" /></td> <td width="560" bgcolor="#0076CC"><img src="images/topspacerlblue.gif" alt="" width="1" height="3" /></td> </tr> </table></td> </tr> <tr> <td height="553" align="center" valign="top" bgcolor="#F3FAFE"><br /> <form name="form" action="view_client.php" method="post"> <br /> <table width="351" border="0"> <tr> <td width="137" align="left" valign="middle">SEARCH RECORD:</td> <td width="144" align="center" valign="middle"><input type="text" name="search" /></td> <td width="56" align="left" valign="middle"><input type="submit" name="btnSearch" value="Search" /></td> </tr> </table> <br /> <table border="0" cellpadding="3" cellspacing="1" bordercolor="38619E" > <tr> <th width="80" align="center" bgcolor="#E0E8F3">Territory</th> <th width="330" align="center" bgcolor="#E0E8F3">Employer</th> <th width="160" align="center" bgcolor="#E0E8F3">Name</th> <th width="80" align="center" valign="middle" bgcolor="#E0E8F3"> </th> </tr> <?php $conn = mysql_connect('localhost','root','') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('invent-asia',$conn) or trigger_error("SQL", E_USER_ERROR); $sql = "SELECT COUNT(*) FROM records"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; $rowsperpage = 10; $totalpages = ceil($numrows / $rowsperpage); if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { $currentpage = (int) $_GET['currentpage']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $sql = "SELECT * FROM records LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); if($result) { for($i=0; $i<mysql_num_rows($result); $i++) { $id = trim(mysql_result($result, $i, "id")); $territory = trim(mysql_result($result, $i, "territory")); $employer = trim(mysql_result($result, $i, "employer")); $first_name = trim(mysql_result($result, $i, "first_name")); $last_name = trim(mysql_result($result, $i, "last_name")); echo "<td>".$territory."</td>"; echo "<td>".$employer."</td>"; echo "<td>".$last_name.", ".$first_name."</td>"; echo "<td><a href='edit_client.php?id=".$id."'>edit</a> | <a href='delete_client.php?id=".$id."'>delete</a> </td>"; echo "</tr>"; } } $range = 3; if ($currentpage > 1) { echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; $prevpage = $currentpage - 1; echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo " [<b>$x</b>] "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } } } if ($currentpage != $totalpages) { $nextpage = $currentpage + 1; echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } ?> </table> <p> <br /> </p> </form> <p> </p></td> </tr> <tr> <td height="38"><table width="760" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="200" height="35" align="center" bgcolor="#1B1C78" class=white><img src="images/topspacerblue.gif" alt="" width="1" height="3" /> <a href="disclaimer.html"><font color="#FFFFFF">Legal Disclaimer</font></a> </td> <td width="560" align="center" bgcolor="#0076CC" class=white><img src="images/topspacerlblue.gif" alt="" width="1" height="3" /> Copyright © 2006 - 2010 InventAsia Limited. All rights reserved. </td> </tr> </table></td> </tr> </table> Immediate response is very well appreciated. Thank you very much ^^ Hey all, I need your help! So, I am the web designer for a small company, but I use that term loosely as I for the most part am limited to design through Dreamweaver and Muse. I know a decent amount of HTML off the top of mey head, but when it comes to PHP, yikes... My company asked me to make a simple searchable web page based on their price guide/catalog, built into their website. I have MySQL set up within their godaddy. I can use the SQL search functions to get the exact results back that I need, and the SQL cPanel gives me the following code: SELECT * FROM `SMQSQL` WHERE `Scott` = '(Whatever I search for)' ORDER BY `LINEID` ASC This makes sense to me up to here; this is very simple language, However, I have been pulling my hair out for days trying to get a simple search function as an actual PHP *PAGE* going. Basically, I need to set up a PHP form search (not hard) that will go back and log in to my SQL database named SMQ (not too bad yet), perform a search out of a specific column named Scott (getting a little harder, and somewhat lost), take the search results from specific columns (getting harder), and display them in a neat little table (now I'm lost). My SQL database is set up with the following columns: LINEID, Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, 98, 98J, 100 Where LINEID is the index. LINEID is set to INT (5 char), the next 4 are TEXT (255 char, item descriptors), and the rest INT (9 char; prices). When the results are displayed, I would like all but the LINEID visible. I have tried and tried and tried playing with my PHP coding but am ready to shoot my computer. Here it is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Online Search</title> </head> <body> <h3>Search Online</h3> <p>You may search by Catalog number. Please use the exact Catalog number or you may receive an error. Please note that if searching for more than a basic item, include the full Catalog number WITHOUT spaces.</p> <form method="post" action="search.php?go" id="searchform"> <input type="text" name="Scott"> <input type="submit" name="submit" value="Search"> </form> <?php if(isset($_POST['submit'])){ if(isset($_GET['go'])){ $Scott=$_POST['Scott'];; $db=mysql_connect ("localhost", "guestuser", "guestuser") or die ('Error connecting to the database. Error: ' . mysql_error()); $mydb=mysql_select_db("SMQ"); $sql="SELECT Scott, Den, Color, Cond, 70, 70J, 75, 75J, 80, 80J, 85, 85J, 90, 90J, 95, 95J, P98, 98J, 100 FROM SMQ WHERE Scott LIKE '%" . $Scott . "%'; $result=mysql_query($sql); while($row=mysql_fetch_array($result)){ $Scott=$row['Scott']; $Den=$row['Den']; $Color=$row['Color']; $Cond=$row['Cond']; $70=$row['70']; $70J=$row['70J']; $75=$row['75']; $75J=$row['75J']; $80=$row['80']; $80J=$row['80J']; $85=$row['85']; $85J=$row['85J']; $90=$row['90']; $90J=$row['90J']; $95=$row['95']; $95J=$row['95J']; $98=$row['98']; $98J=$row['98J']; $100=$row['100']; echo "<ul>\n"; echo "<li>" . "<a href=\"SMQ.php?id=$Scott\">" .$Scott . " " . $Den . " " . $Color . " " . $Cond . " " . $70 . " " . $70J . " " . $75 . " " . $75J . " " . $80 . " " . $80J . " " . $85 . " " . $85J . " " . $90 . " " . $90J . " " . $95 . " " . $95J . " " . $98 . " " . $98J . " " . $100 . "</a></li>\n"; echo "</ul>"; } } else{ echo "<p>Please enter a search query</p>"; } ?>I know it's probably pretty bad, but hopefully at least you can get an idea of what I'm trying to accomplish. Please dear God tell me what I am doing wrong! I'm sure it will take a knowledgeable user 5 minutes to fix this, but you would be saving my skin! THANKS!!! Edited by mac_gyver, 14 August 2014 - 11:04 AM. removed link to op's cp and code tags please when posting code As per the code below I am trying to create a search page which enable people to search different databases in a simple method. However, the code searches each other. So if I put "What is your name?" into "Questions" it shows: Questions: "What is your name?" Answer: "Sorry, but we can not find an entry to match your query" But I am not searching the Answer database so it should just remain blank and should show: Questions: "What is your name?" Answer: (Blank) Does anyone know why it is doing this? Code: [Select] <h2>Questions</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="category">Category</option> <Option VALUE="question">Question</option> <Option VALUE="notes">Notes</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <? //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM questions WHERE upper($field) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['category']; echo " <br>" ; echo $result['question']; echo "<br>"; echo $result['notes']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } // close connection mysql_close(); ?> <h2>Answers</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="answer">Answer</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <? //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM answers WHERE upper($field) LIKE'%$find%' LIMIT 0,10 "); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['answer']; echo " <br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> I found this nice search database script on line but the pagination does not work can someone tell me what is wrong with it ???? so i can work with it !!! here is the full code : Code: [Select] <?php // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; } // check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; } //connect to your database ** EDIT REQUIRED HERE ** mysql_connect("localhost","username","password"); //(host, username, password) //specify database ** EDIT REQUIRED HERE ** mysql_select_db("database") or die("Unable to select database"); //select which database we're using // Build SQL Query $query = "select * from the_table where 1st_field like \"%$trimmed%\" order by 1st_field"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $title = $row["1st_field"]; echo "$count.) $title" ; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; ?> Ok so a few days ago I was alerted that my site was vulnerable to XSS injections in my search form. I modified the php script to prevent any malicious activity by adding this to it: Code: [Select] "/\<(script).*\>.*\<\/(script)\>/isU", " ", But now anytime I put anything into the search form nothing is returned. Please advice. Here is the script in it's entirety. Code: [Select] <?php mysql_connect ("localhost", "","") or die (mysql_error()); mysql_select_db (""); $search = mysql_real_escape_string(preg_replace('/[^\w\'\"\@\-\.\,\(\) ]/i', '', "/\<(script).*\>.*\<\/(script)\>/isU", " ", $_POST['search'])); $sql = mysql_query("SELECT * FROM sales WHERE contact LIKE '%$search%' OR phone LIKE '%$search%' OR office LIKE '%$search%' OR town LIKE '%$search%' OR cross_streets LIKE '%$search%' OR description LIKE '%$search%' OR email LIKE '%$search%' OR price LIKE '%$search%' order by `date_created`"); echo "<strong>Click Headers to Sort</strong>"; echo "<br/><strong>Your Results for: </strong>"; echo $_POST['search']; echo "<table border='0' align='center' bgcolor='#999969' cellpadding='3' bordercolor='#000000' table class='sortable' table id='results'> <tr> <th> Title </th> <th> Price </th> <th> Bed </th> <th> Bath </th> <th> Contact </th> <th> Office </th> <th> Phone </th> </tr>"; while ($row = mysql_fetch_array($sql)){ echo "<tr> <td bgcolor='#FFFFFF' style='color: #000' align='center'> <a href='classified/sales/index.php?id=".$row['id']."'>" . $row['title'] . "</a></td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>$" . $row['price'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rooms'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['bath'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['contact'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['office'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['phone'] . "</td> </tr>"; } echo "</table>"; print_r($apts) ?> Thanks Hi Guys, I am trying to get the below code to work - search form with textbox, dropdown and submit button. I found scripts on the web but the addition of the pagination just causes an error. I spent hours tweaking it but alas I cant see the solution. Perhaps someone could help please. I would love to see an example with 1 textbox, 2 dropdowns and a submit button or a link to such a tutorial. My googling has hit a dead end. In the below code I can run a search and the reults are listed on results.php. Results get screwed up when I go to pagination page 2,3,4 etc...I think i need to integrate $max somewhere in the Code: [Select] $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'"); Thanks Code: [Select] <h2>Search</h2> <form name="search" method="post" action="results.php"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="fname">First Name</option> <Option VALUE="lname">Last Name</option> <Option VALUE="result">Profile</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> //results.php <? // Grab POST data sent from form $field = @$_POST['field'] ; $find = @$_POST['find'] ; $searching = @$_POST['searching'] ; //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("mysql.yourhost.com", "user_name", "password") or die(mysql_error()); mysql_select_db("database_name") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'"); //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> <?php if(!isset($_REQUEST['pagenum'])) { $pagenum=1; } else { $pagenum=$_REQUEST['pagenum']; } //Here we count the number of results //Edit $data to be your query $rows = mysql_num_rows($data); //This is the number of results displayed per page $page_rows = 4; //This tells us the page number of our last page $last = ceil($rows/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //This sets the range to display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it //$data = mysql_query("SELECT * FROM topsites $max") or die(mysql_error()); this works with pagination hmmm //This is where you display your query results //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['fname']; echo " "; echo $result['lname']; echo "<br>"; echo $result['info']; echo "<br>"; echo "<br>"; } echo "<p>"; // This shows the user what page they are on, and the total number of pages echo " --Page $pagenum of $last-- <p>"; // First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page. if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> "; } //just a spacer echo " ---- "; //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> "; } ?> Hello I wonder if it is possible to make a search form with different fields where all conditions should be met if the field is set. I have this code: $sel = "SELECT * FROM database "; $sel .= "WHERE ((test1 = '$test1' "; $sel .= "AND test2 = '$test2' "; $sel .= "AND test3 = '$test3' "; $sel .= "ORDER BY id "; $query = mysql_query($sel) or die(mysql_error()); if (mysql_num_rows($query) == 0){ echo ("No result"); exit; When I use this and leave for example 1 field empty I get the error: No result. Is it possible to make smothing so the condition only should be met if the field is set? So If test1 and test3 are set these condition should be met.. I hope you can help! Thanks in advance! - Frederik Hello, I'm working on a site search which I've never done from scratch before and I've run into a couple road blocks along the way. The first problem is that in my search form it seems that there is no minimum amount of characters that can be searched. For example I enter no value into the text box and hit enter or click submit and all my database items are displayed. My second issue is simply with the criteria of the search. say I were to search for something like 48 x 12 I would get nothing when in fact there is an item in my database with those characters in the description however they are seperated in this fashion 48 in X 12 in. Lastly is the problem where when I search for results that should produce a message stating that my search returned no results instead I get my blank results table. I'm sure that there are some easy solution and minor tweaks that can be made to my code to rectify some or all of these issues and would appreciate those willing to help to share their knowledge with me. Here is my code: <?php require_once('Connections/price_db.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_Recordset1 = "-1"; if (isset($_GET['title'])) { $colname_Recordset1 = $_GET['title']; } mysql_select_db($database_price_db, $price_db); $query_Recordset1 = sprintf("SELECT * FROM price_db WHERE tb_name LIKE %s OR tb_desc LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"),GetSQLValueString("%" . $colname_Recordset1 . "%", "text")); $Recordset1 = mysql_query($query_Recordset1, $price_db) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> and the html is as follows: <div id="search_results"> <?php do { ?> <table width="208" border="0" align="left" style="margin-right:20px;"> <tr> <td width="220"><img width="175px" height="175px" src="<?php echo $row_Recordset1['tb_img']; ?>" /></td> </tr> <tr> <td height="45"><h2><?php echo $row_Recordset1['tb_name']; ?></h2> <div id="search_desc"><?php echo $row_Recordset1['tb_desc']; ?></div></td> </tr> <tr> <td height="37"><div id="search_price">$ <?php echo $row_Recordset1['tb_price']; ?> <form action="/save_to_cart.php" method="get" style="padding-top:15px;"> <input type="text" name="quantity" size="10" value="Quantity" style="margin-right:12px; color:#666" onfocus="this.value=''"/> <input type="button" name="Add" value="Select" onclick="this.form.submit()"/> </form> </div></td> </tr> </table> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </body> </html> <?php mysql_free_result($Recordset1); ?> Thanksagain for all help I found an article on how to implement a mysql search (http://www.iamcal.com/publish/articles/php/search/) and it seemed like a good way to go, but I can't get it up and running. Here is my code: Code: [Select] <?php $db_host = 'localhost'; $db_user = 'username'; $db_pwd = 'password'; $database = 'dbname'; $table = 'Principals'; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); $searchterms = 'dorr oliver'; function search_split_terms($terms){ $terms = preg_replace("/\"(.*?)\"/e", "search_transform_term('\$1')", $terms); $terms = preg_split("/\s+|,/", $terms); $out = array(); foreach($terms as $term){ $term = preg_replace("/\{WHITESPACE-([0-9]+)\}/e", "chr(\$1)", $term); $term = preg_replace("/\{COMMA\}/", ",", $term); $out[] = $term; } return $out; } function search_transform_term($term){ $term = preg_replace("/(\s)/e", "'{WHITESPACE-'.ord('\$1').'}'", $term); $term = preg_replace("/,/", "{COMMA}", $term); return $term; } function search_escape_rlike($string){ return preg_replace("/([.\[\]*^\$])/", '\\\$1', $string); } function search_db_escape_terms($terms){ $out = array(); foreach($terms as $term){ $out[] = '[[:<:]]'.AddSlashes(search_escape_rlike($term)).'[[:>:]]'; } return $out; } function search_perform($terms){ $terms = search_split_terms($terms); $terms_db = search_db_escape_terms($terms); $terms_rx = search_rx_escape_terms($terms); $parts = array(); foreach($terms_db as $term_db){ $parts[] = "Principals RLIKE '$term_db'"; } $parts = implode(' OR ', $parts); $sql = "SELECT * FROM Principal WHERE $parts"; $rows = array(); $result = mysql_query($sql); while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $row[score] = 0; foreach($terms_rx as $term_rx){ $row[score] += preg_match_all("/$term_rx/i", $row[Principals], $null); } $rows[] = $row; } uasort($rows, 'search_sort_results'); return $rows; } function search_rx_escape_terms($terms){ $out = array(); foreach($terms as $term){ $out[] = '\b'.preg_quote($term, '/').'\b'; } return $out; } function search_sort_results($a, $b){ $ax = $a[score]; $bx = $b[score]; if ($ax == $bx){ return 0; } return ($ax > $bx) ? -1 : 1; } function search_html_escape_terms($terms){ $out = array(); foreach($terms as $term){ if (preg_match("/\s|,/", $term)){ $out[] = '"'.HtmlSpecialChars($term).'"'; }else{ $out[] = HtmlSpecialChars($term); } } return $out; } function search_pretty_terms($terms_html){ if (count($terms_html) == 1){ return array_pop($terms_html); } $last = array_pop($terms_html); return implode(', ', $terms_html)." and $last"; } # # do the search here... # $results = search_perform($searchterms); $term_list = search_pretty_terms(search_html_escape_terms(search_split_terms($searchterms))); The table name is 'Principals' and the field name I am trying to search is 'Principal'. I am getting an error on the line: while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ The error is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Can anyone shed some light on this for me? Hey guys, I'm a newbie to PHP and MySql, and I need some help! For the record, I am a web developer and designer, who always put off learning , due to fear, but realized I had to do it. Anyways, my problem is this. I am creating a website, where there has to be a seach box where people can lookup names, and or keywords, that are stored into my db. I've googled it a billion times, and got everything to almost work. I know how to set-up a database, tables, insert info, and all the real basics of mysql. I am running my site on MAMP right now, and here is the code that I am trying to use. <?php /* DON'T DISPLAY ANY PHP ERRORS OR WARNINGS (optional) comment out in development -----------------------------------------------*/ error_reporting(0); /*DATABASE INFO --------------------------*/ $hostname_logon = 'localhost'; //Database server LOCATION $database_logon = ''; //Database NAME $username_logon = ''; //Database USERNAME $password_logon = ''; //Database PASSWORD /*MYSQL TABLE TO SEARCH --------------------------*/ //update these values to table you want to search $db_table = ''; //TABLE NAME $row_id = ''; //TABLE ROW ID $title_field = ''; //FIELD CONTAINING ITEM TITLE $content_field = ''; //FIELD CONTAINING ITEM CONTENT $link_field = ''; //FIELD CONTAINING ITEM URL $limit = 10; //NUMBER OF RESULTS PER PAGE /*SEARCH SCRIPT FILENAME --------------------------*/ //get the name of this file,so you can name this file whatever you want. This is used in the action parameter of the search form $currentFile = $_SERVER["SCRIPT_NAME"]; $parts = explode('/', $currentFile); $currentFile = $parts[count($parts) - 1]; /*CONNECT TO THE DATABASE --------------------------*/ //open database connection $connections = mysql_connect($hostname_logon, $username_logon, $password_logon) or die ( "Unabale to connect to the database" ); //select database mysql_select_db($database_logon) or die ( "Unable to select database!" ); /*GET SEARCH PARAMETERS --------------------------*/ //get the search parameter from URL $var = mysql_real_escape_string(@$_REQUEST['q']); //get pagination $s = mysql_real_escape_string(@$_REQUEST['s']); //set keyword character limit if(strlen($var) < 3){ $resultmsg = "<p>Search Error</p><p>Keywords with less then three characters are omitted...</p>" ; } //trim whitespace from the stored variable $trimmed = trim($var); $trimmed1 = trim($var); //separate key-phrases into keywords $trimmed_array = explode(" ",$trimmed); $trimmed_array1 = explode(" ",$trimmed1); // check for an empty string and display a message. if ($trimmed == "") { $resulterror = "<p>Search Error</p><p>Please enter a search...</p>" ; } // check for a search parameter if (!isset($var)){ $resulterror = "<p>Search Error</p><p>We don't seem to have a search parameter! </p>" ; } //make sure search keyword is at least 2 characters. (buggy if not) if(strlen($trimmed) < 2){ $resulterror = "<p>Search Error</p><p>Your keyword has to be at least two characters long! </p>" ; } /*CREATE SEARCH FORM --------------------------*/ $search_form = '<form class="search-form" action="'.$currentFile.'" method="GET"> <div> <input name="q" type="text" value="'.$q.'"><input name="search" type="submit" value="Search"> </div> </form>'; /*DISPLAY QUERY ERRORS OR DO THE SEARCH --------------------------------------------*/ if($resulterror){ $resultmsg = $resulterror; }else{ // Build SQL Query for each keyword entered foreach ($trimmed_array as $trimm){ // MySQL "MATCH" is used for full-text searching. Please visit mysql for details. $query = "SELECT *, MATCH (".$title_field.",".$content_field.") AGAINST ('".$trimm."') AS score FROM ".$db_table." WHERE MATCH (".$title_field.",".$content_field.") AGAINST ('+".$trimm."' IN BOOLEAN MODE) HAVING score > 0.01 ORDER BY score DESC"; // Execute the query to get number of rows that contain search kewords $numresults=mysql_query ($query) or die ("Error in query: $query. " . mysql_error()); $row_num_links_main =mysql_num_rows ($numresults); //If MATCH query doesn't return any results due to how it works do a search using LIKE if($row_num_links_main < 1){ $query = "SELECT * FROM ".$db_table." WHERE ".$title_field." LIKE '%".$trimm."%' OR ".$content_field." LIKE '%".$trimm."%' ORDER BY ".$row_id." DESC" ; $numresults=mysql_query ($query); $row_num_links_main =mysql_num_rows ($numresults); } // next determine if 's' has been passed to script, if not use 0. // 's' is a variable that gets set as we navigate the search result pages. if (empty($s)) { $s=0; } // now let's get results. $query .= " LIMIT $s,$limit" ; $numresults = mysql_query ($query) or die ("Error in query: $query. " . mysql_error()); $row= mysql_fetch_array ($numresults); //store record id of every item that contains the keyword in the array we need to do this to avoid display of duplicate search result. do{ $adid_array[] = $row[ 'news_id' ]; }while( $row= mysql_fetch_array($numresults)); } //end foreach /*Display a message if no results found --------------------------*/ if($row_num_links_main == 0 && $row_num_links_main1 == 0){ $resultmsg = "<p>Search results for: ". $trimmed."</p><p>Sorry, your search returned zero results</p>" ; } //delete duplicate record id's from the array. To do this we will use array_unique function $tmparr = array_unique($adid_array); $i=0; foreach ($tmparr as $v) { $newarr[$i] = $v; $i++; } //total number of results $row_num_links_main = $row_num_links_main + $row_num_links_main1; if($resultmsg != ""){ $resultmsg = "<p>Search results for: <strong>" . $var."</strong></p>"; } /* FETCH RESULTS BASED ON THE ID --------------------------------------------*/ foreach($newarr as $value){ // EDIT HERE and specify your table and field unique ID for the SQL query $query_value = "SELECT * FROM ".$db_table." WHERE ".$row_id." = '".$value."'"; $num_value=mysql_query ($query_value); $row_linkcat= mysql_fetch_array ($num_value); $row_num_links= mysql_num_rows ($num_value); //create summary of the long text. For example if the field2 is your full text grab only first 130 characters of it for the result $introcontent = strip_tags($row_linkcat[$content_field]); $introcontent = substr($introcontent, 0, 130)."..."; //now let's make the keywods bold. To do that we will use preg_replace function. //Replace field $title = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $row_linkcat[ $title_field] ); $desc = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $introcontent); //COMMENT OUT THIS LINE: If using database ID field to drive links $link = preg_replace ( "'($var)'si" , "<strong>\\1</strong>" , $row_linkcat[$link_field] ); //UNCOMMENT and EDIT THIS LINE: If using database ID field to drive links //$link = 'http://yourdomain.com/pageid='. $row_linkcat[$link_field]; foreach($trimmed_array as $trimm){ if($trimm != 'b' ){ $title = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $title); $desc = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $desc); $link = preg_replace( "'($trimm)'si" , "<strong>\\1</strong>" , $link); }//end highlight }//end foreach $trimmed_array //format and display search results $resultmsg.= '<div class="search-result">'; $resultmsg.= '<div class="search-title"><a href="'.$link.'">'.$title.'</a></div>'; $resultmsg.= '<div class="search-text">'; $resultmsg.= $desc; $resultmsg.= '</div>'; $resultmsg.= '<a href="'.$link.'" class="search-link">'; $resultmsg.= $link; $resultmsg.= '</a>'; $resultmsg.= '</div>'; } //end foreach $newarr /* CREATE PAGINATION --------------------------------------------*/ if($row_num_links_main > $limit){ // next we need to do the links to other search result pages if ($s >=1) { // do not display previous link if 's' is '0' $prevs=($s-$limit); $resultmsg.= '<div class="search-previous"><a href="'.$PHP_SELF.'?s='.$prevs.'&q='.$var.'">Previous</a></div>'; } // check to see if last page $slimit =$s+$limit; if (!($slimit >= $row_num_links_main) && $row_num_links_main!=1) { // not last page so display next link $n=$s+$limit; $resultmsg.= '<div class="search-next"><a href="'.$PHP_SELF.'?s='.$n.'&q='.$var.'">Next</a></div>'; } }//end if $row_num_links_main > $limit }//end if no errors ?> <?php //display form echo $search_form; //display results echo $resultmsg; ?> I know that this might be asking a lot, but can someone who is smarter than me please give me instructions on how to set this up. I am at a complete loss. I've tried everything. I can connect to the db, and all, but it returns errors, and or blank screens. I will owe everyone. Thank you. Hello friends,
I am a novice in php. Though I create 2 scripts:
1. students registration form
2. search students by Registration Number
Our students' Registration Numbers are as follows: nifeA001, nifeA002 & so on...
But when someone enter just "nife" or "n" or "A" etc all the students's data is showing.
I want that students can search data by entering only Full Registration Number not a Part.
I am placing the search.php code below. Please help me out....
----------------- Search.php ------------------
<?php
mysql_connect("localhost", "root", "") or die("could not connect");
mysql_select_db("student") or die("could not connect");
//collect
if(isset($_POST['search'])) {
$searchq = $_POST['search'];
$searchq = preg_replace("#[^0-9a-z]#i", "", $searchq);
//here
$query = mysql_query("SELECT * FROM user WHERE registration LIKE '%$searchq%'") or die("could not search!");
$count = mysql_num_rows($query);
if($count == 0){
$output = 'There was no search results!';
}else{
while($row = mysql_fetch_array($query)) {
$fname = $row['firstname'];
$lname = $row['surname'];
$id = $row['registration'];
$output .= '<div> '.$id.' '.$fname.' '.$lname.'</div>';
}
}
}
?>
<html>
<head>
</head>
<body>
<form action="form.php" method="post">
<input type="text" name="search" placeholder="search for students.."
<input type="submit" value=">>" />
</form>
<?php print("$output");?>
</body>
</html>
Edited by NasimUddinAhmmad, 13 January 2015 - 05:43 AM. I wonder whether someone may be able to help me please. I'm trying to put together php code and an html form that allows an administrator to search for a user via the email address, retrieving the 'first' and 'surname' from the pertinent record in a mySQL database. What I would like to happen is for the retrieved 'first' and surname' values to be automatically populated into the 'first' and 'surname' text boxes on the same search form. I can perform the search and retrieval of the correct record without any problem, but I can't work out how to populate the 'first' and 'surname' values into my search form. I am quote a novice with PHP so apologies if this is a really daft question, but I just windered whether somone could take a look at my code below and let me know where I've gone wrong? Many thanks PHP CODE Code: [Select] <?php require("phpfile.php"); // Opens a connection to a MySQL server $connection=mysql_connect ("hostname", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error());} // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } $email = $_POST['email']; $result = mysql_query("SELECT * FROM userdetails WHERE emailaddress like '%$email%'"); while($row = mysql_fetch_array($result)) { echo $row['forename']; echo $row['surname']; echo "<br />"; } ?> HTML FORM Code: [Select] !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Maptitle> <script src="js/gen_validatorv4.js" type="text/javascript"></script> </head> <h1><span class="blue">Sign Up</span> For Map My Finds</h1> <form name="userpasswordreset" id="userpasswordreset" method="post" action="search.php"> <h2>Your Details </h2> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="26%" height="25"><strong>Email Address</strong></td> <td width="4%"> </td> <td width="70%"><input name="email" type="email" id="email" size="50" /></td> </tr> <tr> <td height="25"><strong>Confirm Email</strong></td> <td> </td> <td><input name="conf_email" type="email" id="conf_email" size="50" /></td> </tr> <tr> <td height="25"><label> <input type="submit" name="Submit" value="Search" /> </label></td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong> First Name </strong></td> <td> </td> <td><input name="fname" type="text" id="fname" size="30" value="<?php echo $forename; ?>" /></td> </tr> <tr> <td height="25"><strong> Address Last Name </strong></td> <td> </td> <td><input name="lname" type="text" id="lname" size="30" value="<?php echo $surname; ?>" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong>Password</strong></td> <td> </td> <td><input name="pass" type="password" id="pass" size="30" /></td> </tr> <tr> <td height="25"><strong>Confirm Password </strong></td> <td> </td> <td><input name="conf_pass" type="password" id="conf_pass" size="30" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong>Password Hint </strong></td> <td> </td> <td><input name="hint" type="text" id="hint" size="30" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> // Code for validating the form // Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml // for details var frmvalidator = new Validator("userpasswordreset"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please enter a valid email address"); frmvalidator.addValidation("conf_email","eqelmnt=email", "The confirmed email address is not the same as the email address"); </body> </html> Hello all, and apologies for taking your time up, but I am completely stuck!! Have been trying to create a PHP search code (6 weeks now) to return results from a mysql database (I am completely new to this, but okay with HTML). Most of the many attempts I have tried over the weeks have been learned/copied from the web, which resulted initially in connection errors (I hadn't set privileges up), and now I am in a place that that the Favicon spins and returns to original state - but does return:
else{ I am aware that the code may not be perfect, so I have tried downloading sample 'database and php files', and using them but they also dont work (but they do for others trying the sample). I have tried Stack Overflow forums, but they all seem very rude and patronising sadly, and still I havent managed to resolve it...so here I am! Here is a link to the page mentioned (search bar top right in question): https://flighteducation.co.uk/Careers Connect.php
And the php code: <?php session_start(); $output=NULL; if(isset($_POST['submit'])){ //Connect to the database $mysqli = new mysqli("localhost", "jj3wg2td_steven", "MYPASSWORD", "jj3wg2td_careerslist"); $search = $mysqli->real_escape_string($_POST['search']); //Query the database $result = $mysqli->query("SELECT * FROM careers WHERE Job Title LIKE '%$search%'"); if($result->num_rows > 0) { while($rows=$result->fetch_assoc()) { $jobTitle=$rows['Job Title']; $jobDesription=$rows['Job Description']; $salaryLow=$rows['Salary Low']; $salaryHigh=$rows['Salary High']; $output .="Job Title:$jobTitle<br /> Job Description:$jobDesription<br /> Salary Low:$salaryLow<br /> Salary High:$salaryHigh<br /> <br />"; } } else{ $output="No results"; } } ?> I have an output php further down the page, after my search setup OUTPUT:
<!--PHP OUTPUT-->
Search Button Code:
<!--SEARCH BOX-->
I cannot thank you enough for any support you can add as this is literally driving me mad, and wasting endless days (trying)
Kindest regards
Steven
Here's the whole PHP code, just in case I have something in there that clashes with it and a screen shot of the phpMYAdmin header database : <?php session_start(); $output=NULL; if(isset($_POST['submit'])){ //Connect to the database $mysqli = new mysqli("localhost", "jj3wg2td_steven", "MYPASSWORD", "jj3wg2td_careerslist"); $search = $mysqli->real_escape_string($_POST['search']); //Query the database $result = $mysqli->query("SELECT * FROM 'careers' WHERE Job Title LIKE '%$search%'"); if($result->num_rows > 0) { while($rows=$result->fetch_assoc()) { $jobTitle=$rows['Job Title']; $jobDesription=$rows['Job Description']; $salaryLow=$rows['Salary Low']; $salaryHigh=$rows['Salary High']; $output .="Job Title:$jobTitle<br /> Job Description:$jobDesription<br /> Salary Low:$salaryLow<br /> Salary High:$salaryHigh<br /> <br />"; } } else{ $output="No results"; } } ?> <!doctype html> <html> <head> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-170467250-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-170467250-1'); </script> <!--FAVICON--> <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="manifest" href="/site.webmanifest"> <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> <!--FAVICON--> <meta name="msapplication-TileColor" content="#da532c"> <meta name="theme-color" content="#ffffff"> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileImage" content="/ms-icon-144x144.png"> <meta name="theme-color" content="#ffffff"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <meta charset="utf-8"> <title>- CAREERS -</title> <link href="Responsive.css" rel="stylesheet" type="text/css"> <style type="text/css"> a:link { color: rgba(255,255,255,1); } a:visited { color: rgba(255,255,255,1); } a:hover { color: rgba(243,219,7,1); } a:active { color: rgba(255,255,255,1); } /* scrollbar*/ body::-webkit-scrollbar { width: 6px; } body::-webkit-scrollbar-track { background: Black; } body::-webkit-scrollbar-thumb { background-color: rgba(243,219,7,1); border-radius: 20px; } /* scrollbar*/ </style> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> </head> <body onLoad="MM_preloadImages('Top-LogoR.png')"> <!--TOP LOGO --> <div class="home-logo"> <a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image31','','Top-LogoR.png',1)"><img id="Image31" src="Top-Logo.png" alt="HOME"></a> </div> <div class="wrapper"> <!--Navigation --> <nav class="topnavbar-container"> <ul> <li><a href="#">COLLEGE /</a> <ul> <li><a href="#">SEARCH FOR A COLLEGE</a></li> <li><a href="#">GO TO COLLEGE</a></li> </ul> </li> <li><a href="#">UNIVERSITY /</a> <ul> <li><a href="#">SEARCH FOR A UNI</a></li> <li><a href="#">GO TO UNI</a></li> <li><a href="League Table.html">LEAGUE TABLES</a></li> <li><a href="Uni Life.html">LIFE IN UNI</a></li> </ul> </li> <li><a href="#">CAREERS</a> <ul> <li><a href="Careers Results.html">SEARCH CAREERS</a></li> <li><a href="index.html#CAREERS">BROWSE CAREERS</a></li> <li><a href="Set your Target.html">PLAN YOUR PATHWAY</a></li> <li><a href="Trending 2020.html">TRENDING IN 2020</a></li> </ul> </li> </ul> </nav> <!--SEARCH BOX--> <div class="search-box"> <form method="POST" id="search"> <input class="search-txt" type="TEXT" name="search" placeholder="SEARCH CAREERS"> <button class="search-btn" name="submit" type="submit"> <i class="fa fa-search" aria-hidden="true"></i> </button> </form> </div> <!--Top Container --> <section class="careers-results"> <header class="showcase-career"> <label for="Careers">Choose a Career:</label> <img src="img/Careers-Logo.png" alt="LOGO"> <br> <select class="careers-dropdown" name="Careers" id="Careers"> <option value=" 3D printing technician "> 3D printing technician </option> <option value=" Accommodation warden "> Accommodation warden </option> <option value=" Accounting technician "> Accounting technician </option> <option value=" Acoustics consultant "> Acoustics consultant </option> <option value=" Actor "> Actor </option> <option value=" Actuary "> Actuary </option> <option value=" Acupuncturist "> Acupuncturist </option> <option value=" Admin assistant "> Admin assistant </option> <option value=" Advertising account executive "> Advertising account executive </option> <option value=" Advertising account planner "> Advertising account planner </option> <option value=" Advertising art director "> Advertising art director </option> <option value=" Advertising copywriter "> Advertising copywriter </option> <option value=" Advertising media buyer "> Advertising media buyer </option> <option value=" Advertising media planner "> Advertising media planner </option> <option value=" Aerospace engineer "> Aerospace engineer </option> <option value=" Aerospace engineering technician "> Aerospace engineering technician </option> <option value=" Agricultural contractor "> Agricultural contractor </option> <option value=" Agricultural engineer "> Agricultural engineer </option> <option value=" Agricultural engineering technician "> Agricultural engineering technician </option> <option value=" Agricultural inspector "> Agricultural inspector </option> <option value=" Agronomist "> Agronomist </option> <option value=" Aid worker "> Aid worker </option> <option value=" Air accident investigator "> Air accident investigator </option> <option value=" Air traffic controller "> Air traffic controller </option> <option value=" Airline customer service agent "> Airline customer service agent </option> <option value=" Airline pilot "> Airline pilot </option> <option value=" Airport baggage handler "> Airport baggage handler </option> <option value=" Airport information assistant "> Airport information assistant </option> <option value=" Alexander Technique teacher "> Alexander Technique teacher </option> <option value=" Ambulance care assistant "> Ambulance care assistant </option> <option value=" Anaesthetist "> Anaesthetist </option> <option value=" Analytical textile technologist "> Analytical textile technologist </option> <option value=" Anatomical pathology technician "> Anatomical pathology technician </option> <option value=" Animal care worker "> Animal care worker </option> <option value=" Animal technician "> Animal technician </option> <option value=" Animator "> Animator </option> <option value=" Antique dealer "> Antique dealer </option> <option value=" App developer "> App developer </option> <option value=" Arboricultural officer "> Arboricultural officer </option> <option value=" Archaeologist "> Archaeologist </option> <option value=" Architect "> Architect </option> <option value=" Architectural technician "> Architectural technician </option> <option value=" Architectural technologist "> Architectural technologist </option> <option value=" Archivist "> Archivist </option> <option value=" Army officer "> Army officer </option> <option value=" Aromatherapist "> Aromatherapist </option> <option value=" Art editor "> Art editor </option> <option value=" Art gallery curator "> Art gallery curator </option> <option value=" Art therapist "> Art therapist </option> <option value=" Art valuer "> Art valuer </option> <option value=" Arts administrator "> Arts administrator </option> <option value=" Assistance dog trainer "> Assistance dog trainer </option> <option value=" Assistant immigration officer "> Assistant immigration officer </option> <option value=" Astronaut "> Astronaut </option> <option value=" Astronomer "> Astronomer </option> <option value=" Athlete "> Athlete </option> <option value=" Audiologist "> Audiologist </option> <option value=" Audio-visual technician "> Audio-visual technician </option> <option value=" Auditor "> Auditor </option> <option value=" Auto electrician "> Auto electrician </option> <option value=" Automotive engineer "> Automotive engineer </option> <option value=" Bailiff "> Bailiff </option> <option value=" Baker "> Baker </option> <option value=" Bank manager "> Bank manager </option> <option value=" Banking customer service adviser "> Banking customer service adviser </option> <option value=" Bar person "> Bar person </option> <option value=" Barber "> Barber </option> <option value=" Barista "> Barista </option> <option value=" Barrister "> Barrister </option> <option value=" Barristers' clerk "> Barristers' clerk </option> <option value=" Beauty consultant "> Beauty consultant </option> <option value=" Beauty therapist "> Beauty therapist </option> <option value=" Beekeeper "> Beekeeper </option> <option value=" Betting shop cashier "> Betting shop cashier </option> <option value=" Bid writer "> Bid writer </option> <option value=" Bilingual secretary "> Bilingual secretary </option> <option value=" Bin worker "> Bin worker </option> <option value=" Bingo caller "> Bingo caller </option> <option value=" Biochemist "> Biochemist </option> <option value=" Biologist "> Biologist </option> <option value=" Biomedical scientist "> Biomedical scientist </option> <option value=" Biotechnologist "> Biotechnologist </option> <option value=" Blacksmith "> Blacksmith </option> <option value=" Boat builder "> Boat builder </option> <option value=" Body piercer "> Body piercer </option> <option value=" Bodyguard "> Bodyguard </option> <option value=" Bomb disposal technician "> Bomb disposal technician </option> <option value=" Bookbinder "> Bookbinder </option> <option value=" Bookkeeper "> Bookkeeper </option> <option value=" Bookmaker "> Bookmaker </option> <option value=" Bookseller "> Bookseller </option> <option value=" Border Force officer "> Border Force officer </option> <option value=" Botanist "> Botanist </option> <option value=" Bottler "> Bottler </option> <option value=" Boxer "> Boxer </option> <option value=" Brewery worker "> Brewery worker </option> <option value=" Bricklayer "> Bricklayer </option> <option value=" British Sign Language interpreter "> British Sign Language interpreter </option> <option value=" British Sign Language teacher "> British Sign Language teacher </option> <option value=" Broadcast Engineer "> Broadcast Engineer </option> <option value=" Broadcast journalist "> Broadcast journalist </option> <option value=" Builders' merchant "> Builders' merchant </option> <option value=" Building control officer "> Building control officer </option> <option value=" Building services engineer "> Building services engineer </option> <option value=" Building site inspector "> Building site inspector </option> <option value=" Building surveyor "> Building surveyor </option> <option value=" Building technician "> Building technician </option> <option value=" Bus or coach driver "> Bus or coach driver </option> <option value=" Business adviser "> Business adviser </option> <option value=" Business analyst "> Business analyst </option> <option value=" Business development manager "> Business development manager </option> <option value=" Business project manager "> Business project manager </option> <option value=" Butcher "> Butcher </option> <option value=" Butler "> Butler </option> <option value=" Cabin crew "> Cabin crew </option> <option value=" CAD technician "> CAD technician </option> <option value=" Cake decorator "> Cake decorator </option> <option value=" Call centre operator "> Call centre operator </option> <option value=" Car manufacturing worker "> Car manufacturing worker </option> <option value=" Car rental agent "> Car rental agent </option> <option value=" Car valet "> Car valet </option> <option value=" Care escort "> Care escort </option> <option value=" Care home advocate "> Care home advocate </option> <option value=" Care home manager "> Care home manager </option> <option value=" Care worker "> Care worker </option> <option value=" Careers adviser "> Careers adviser </option> <option value=" Caretaker "> Caretaker </option> <option value=" Carpenter "> Carpenter </option> <option value=" Carpet fitter and floor layer "> Carpet fitter and floor layer </option> <option value=" Cartographer "> Cartographer </option> <option value=" Catering manager "> Catering manager </option> <option value=" Cavity insulation installer "> Cavity insulation installer </option> <option value=" Ceiling fixer "> Ceiling fixer </option> <option value=" Celebrant "> Celebrant </option> <option value=" Cellar technician "> Cellar technician </option> <option value=" Cemetery worker "> Cemetery worker </option> <option value=" Ceramics designer-maker "> Ceramics designer-maker </option> <option value=" Charity director "> Charity director </option> <option value=" Charity fundraiser "> Charity fundraiser </option> <option value=" Chauffeur "> Chauffeur </option> <option value=" Checkout operator "> Checkout operator </option> <option value=" Chef "> Chef </option> <option value=" Chemical engineer "> Chemical engineer </option> <option value=" Chemical engineering technician "> Chemical engineering technician </option> <option value=" Chemical plant process operator "> Chemical plant process operator </option> <option value=" Chemist "> Chemist </option> <option value=" Chief executive "> Chief executive </option> <option value=" Chief inspector "> Chief inspector </option> <option value=" Child protection officer "> Child protection officer </option> <option value=" Childminder "> Childminder </option> <option value=" Children's nurse "> Children's nurse </option> <option value=" Chimney sweep "> Chimney sweep </option> <option value=" Chiropractor "> Chiropractor </option> <option value=" Choreographer "> Choreographer </option> <option value=" Cinema or theatre attendant "> Cinema or theatre attendant </option> <option value=" Cinema projectionist "> Cinema projectionist </option> <option value=" Circus performer "> Circus performer </option> <option value=" Civil enforcement officer "> Civil enforcement officer </option> <option value=" Civil engineer "> Civil engineer </option> <option value=" Civil engineering technician "> Civil engineering technician </option> <option value=" Civil Service administrative officer "> Civil Service administrative officer </option> <option value=" Civil Service executive officer "> Civil Service executive officer </option> <option value=" Civil Service manager "> Civil Service manager </option> <option value=" Classical musician "> Classical musician </option> <option value=" Cleaner "> Cleaner </option> <option value=" Climate scientist "> Climate scientist </option> <option value=" Clinical engineer "> Clinical engineer </option> <option value=" Clinical psychologist "> Clinical psychologist </option> <option value=" Clinical scientist "> Clinical scientist </option> <option value=" CNC machinist "> CNC machinist </option> <option value=" Coastguard "> Coastguard </option> <option value=" Cognitive behavioural therapist "> Cognitive behavioural therapist </option> <option value=" Colon hydrotherapist "> Colon hydrotherapist </option> <option value=" Colour therapist "> Colour therapist </option> <option value=" Commercial energy assessor "> Commercial energy assessor </option> <option value=" Commissioning editor "> Commissioning editor </option> <option value=" Communication support worker "> Communication support worker </option> <option value=" Community arts worker "> Community arts worker </option> <option value=" Community development worker "> Community development worker </option> <option value=" Community education co-ordinator "> Community education co-ordinator </option> <option value=" Community matron "> Community matron </option> <option value=" Community transport driver "> Community transport driver </option> <option value=" Company secretary "> Company secretary </option> <option value=" Computer games developer "> Computer games developer </option> <option value=" Computer games tester "> Computer games tester </option> <option value=" Conference and exhibition manager "> Conference and exhibition manager </option> <option value=" Conservator "> Conservator </option> <option value=" Construction contracts manager "> Construction contracts manager </option> <option value=" Construction labourer "> Construction labourer </option> <option value=" Construction manager "> Construction manager </option> <option value=" Construction plant hire adviser "> Construction plant hire adviser </option> <option value=" Construction plant mechanic "> Construction plant mechanic </option> <option value=" Construction plant operator "> Construction plant operator </option> <option value=" Construction site supervisor "> Construction site supervisor </option> <option value=" Consumer scientist "> Consumer scientist </option> <option value=" Copy editor "> Copy editor </option> <option value=" Coroner "> Coroner </option> <option value=" Cosmetic surgeon "> Cosmetic surgeon </option> <option value=" Costume designer "> Costume designer </option> <option value=" Counsellor "> Counsellor </option> <option value=" Counter service assistant "> Counter service assistant </option> <option value=" Countryside officer "> Countryside officer </option> <option value=" Countryside ranger "> Countryside ranger </option> <option value=" Courier "> Courier </option> <option value=" Court administrative assistant "> Court administrative assistant </option> <option value=" Court legal adviser "> Court legal adviser </option> <option value=" Court usher "> Court usher </option> <option value=" Crane driver "> Crane driver </option> <option value=" Credit controller "> Credit controller </option> <option value=" Credit manager "> Credit manager </option> <option value=" Crematorium technician "> Crematorium technician </option> <option value=" Cricketer "> Cricketer </option> <option value=" Criminal intelligence analyst "> Criminal intelligence analyst </option> <option value=" Criminologist "> Criminologist </option> <option value=" Critical care technologist "> Critical care technologist </option> <option value=" Croupier "> Croupier </option> <option value=" Crown prosecutor "> Crown prosecutor </option> <option value=" Cruise ship steward "> Cruise ship steward </option> <option value=" Customer service assistant "> Customer service assistant </option> <option value=" Customer services manager "> Customer services manager </option> <option value=" Cyber intelligence officer "> Cyber intelligence officer </option> <option value=" Cycle mechanic "> Cycle mechanic </option> <option value=" Cycling coach "> Cycling coach </option> <option value=" Dance movement psychotherapist "> Dance movement psychotherapist </option> <option value=" Dance teacher "> Dance teacher </option> <option value=" Dancer "> Dancer </option> <option value=" Data analyst-statistician "> Data analyst-statistician </option> <option value=" Data entry clerk "> Data entry clerk </option> <option value=" Database administrator "> Database administrator </option> <option value=" Delivery van driver "> Delivery van driver </option> <option value=" Demolition operative "> Demolition operative </option> <option value=" Dental hygienist "> Dental hygienist </option> <option value=" Dental nurse "> Dental nurse </option> <option value=" Dental technician "> Dental technician </option> <option value=" Dental therapist "> Dental therapist </option> <option value=" Dentist "> Dentist </option> <option value=" Design and development engineer "> Design and development engineer </option> <option value=" Dietitian "> Dietitian </option> <option value=" Digital delivery manager "> Digital delivery manager </option> <option value=" Digital marketer "> Digital marketer </option> <option value=" Digital product owner "> Digital product owner </option> <option value=" Diplomatic Service officer "> Diplomatic Service officer </option> <option value=" Director of photography "> Director of photography </option> <option value=" Dispensing optician "> Dispensing optician </option> <option value=" District nurse "> District nurse </option> <option value=" Diver "> Diver </option> <option value=" DJ "> DJ </option> <option value=" Dog groomer "> Dog groomer </option> <option value=" Dog handler "> Dog handler </option> <option value=" Domestic appliance service engineer "> Domestic appliance service engineer </option> <option value=" Domestic energy assessor "> Domestic energy assessor </option> <option value=" Door supervisor "> Door supervisor </option> <option value=" Dramatherapist "> Dramatherapist </option> <option value=" Dressmaker "> Dressmaker </option> <option value=" Driving instructor "> Driving instructor </option> <option value=" Drone pilot "> Drone pilot </option> <option value=" Drug and alcohol worker "> Drug and alcohol worker </option> <option value=" Dry cleaner "> Dry cleaner </option> <option value=" Dry liner "> Dry liner </option> <option value=" Early years teacher "> Early years teacher </option> <option value=" Ecologist "> Ecologist </option> <option value=" E-commerce manager "> E-commerce manager </option> <option value=" Economic development officer "> Economic development officer </option> <option value=" Economist "> Economist </option> <option value=" Editorial assistant "> Editorial assistant </option> <option value=" Education technician "> Education technician </option> <option value=" Education welfare officer "> Education welfare officer </option> <option value=" E-learning developer "> E-learning developer </option> <option value=" Electrical engineer "> Electrical engineer </option> <option value=" Electrical engineering technician "> Electrical engineering technician </option> <option value=" Electrician "> Electrician </option> <option value=" Electricity distribution worker "> Electricity distribution worker </option> <option value=" Electricity generation worker "> Electricity generation worker </option> <option value=" Electronics engineer "> Electronics engineer </option> <option value=" Electronics engineering technician "> Electronics engineering technician </option> <option value=" Embalmer "> Embalmer </option> <option value=" Emergency care assistant "> Emergency care assistant </option> <option value=" Emergency medical dispatcher "> Emergency medical dispatcher </option> <option value=" Energy engineer "> Energy engineer </option> <option value=" Engineering construction craftworker "> Engineering construction craftworker </option> <option value=" Engineering construction technician "> Engineering construction technician </option> <option value=" Engineering craft machinist "> Engineering craft machinist </option> <option value=" Engineering maintenance technician "> Engineering maintenance technician </option> <option value=" Engineering operative "> Engineering operative </option> <option value=" English as a foreign language (EFL) teacher "> English as a foreign language (EFL) teacher </option> <option value=" Entertainer "> Entertainer </option> <option value=" Entertainment agent "> Entertainment agent </option> <option value=" Environmental consultant "> Environmental consultant </option> <option value=" Environmental health officer "> Environmental health officer </option> <option value=" Equalities officer "> Equalities officer </option> <option value=" Ergonomist "> Ergonomist </option> <option value=" Estate agent "> Estate agent </option> <option value=" Estates officer "> Estates officer </option> <option value=" Estimator "> Estimator </option> <option value=" European Union official "> European Union official </option> <option value=" Events manager "> Events manager </option> <option value=" Exhibition designer "> Exhibition designer </option> <option value=" Facilities manager "> Facilities manager </option> <option value=" Fairground worker "> Fairground worker </option> <option value=" Family mediator "> Family mediator </option> <option value=" Family support worker "> Family support worker </option> <option value=" Farm secretary "> Farm secretary </option> <option value=" Farm worker "> Farm worker </option> <option value=" Farmer "> Farmer </option> <option value=" Farrier "> Farrier </option> <option value=" Fashion design assistant "> Fashion design assistant </option> <option value=" Fashion designer "> Fashion designer </option> <option value=" Fashion model "> Fashion model </option> <option value=" Fence installer "> Fence installer </option> <option value=" Film critic "> Film critic </option> <option value=" Finance officer "> Finance officer </option> <option value=" Financial adviser "> Financial adviser </option> <option value=" Financial services customer adviser "> Financial services customer adviser </option> <option value=" Fine artist "> Fine artist </option> <option value=" Fingerprint officer "> Fingerprint officer </option> <option value=" Firefighter "> Firefighter </option> <option value=" Fish farmer "> Fish farmer </option> <option value=" Fish frier "> Fish frier </option> <option value=" Fishing boat deckhand "> Fishing boat deckhand </option> <option value=" Fishing vessel skipper "> Fishing vessel skipper </option> <option value=" Fishmonger "> Fishmonger </option> <option value=" Fitness instructor "> Fitness instructor </option> <option value=" Florist "> Florist </option> <option value=" Food factory worker "> Food factory worker </option> <option value=" Food manufacturing inspector "> Food manufacturing inspector </option> <option value=" Food packaging operative "> Food packaging operative </option> <option value=" Food scientist "> Food scientist </option> <option value=" Football coach "> Football coach </option> <option value=" Football referee "> Football referee </option> <option value=" Footballer "> Footballer </option> <option value=" Footwear designer "> Footwear designer </option> <option value=" Footwear manufacturing operative "> Footwear manufacturing operative </option> <option value=" Forensic computer analyst "> Forensic computer analyst </option> <option value=" Forensic psychologist "> Forensic psychologist </option> <option value=" Forensic scientist "> Forensic scientist </option> <option value=" Forest officer "> Forest officer </option> <option value=" Forestry worker "> Forestry worker </option> <option value=" Forklift driver "> Forklift driver </option> <option value=" Forklift truck engineer "> Forklift truck engineer </option> <option value=" Foster carer "> Foster carer </option> <option value=" Foundry mould maker "> Foundry mould maker </option> <option value=" Foundry process operator "> Foundry process operator </option> <option value=" Franchise owner "> Franchise owner </option> <option value=" French polisher "> French polisher </option> <option value=" Funeral director "> Funeral director </option> <option value=" Furniture designer "> Furniture designer </option> <option value=" Furniture maker "> Furniture maker </option> <option value=" Furniture restorer "> Furniture restorer </option> <option value=" Further education lecturer "> Further education lecturer </option> <option value=" Gamekeeper "> Gamekeeper </option> <option value=" Garage manager "> Garage manager </option> <option value=" Garden nursery assistant "> Garden nursery assistant </option> <option value=" Gardener "> Gardener </option> <option value=" Garment technologist "> Garment technologist </option> <option value=" Gas mains layer "> Gas mains layer </option> <option value=" Gas service technician "> Gas service technician </option> <option value=" General practice surveyor "> General practice surveyor </option> <option value=" Geneticist "> Geneticist </option> <option value=" Geoscientist "> Geoscientist </option> <option value=" Geospatial technician "> Geospatial technician </option> <option value=" Geotechnician "> Geotechnician </option> <option value=" Glassmaker "> Glassmaker </option> <option value=" Glazier "> Glazier </option> <option value=" GP "> GP </option> <option value=" GP practice manager "> GP practice manager </option> <option value=" Graphic designer "> Graphic designer </option> <option value=" Groundsperson "> Groundsperson </option> <option value=" Hairdresser "> Hairdresser </option> <option value=" Hairdressing salon manager "> Hairdressing salon manager </option> <option value=" Handyperson "> Handyperson </option> <option value=" Head chef "> Head chef </option> <option value=" Head of IT (IT director) "> Head of IT (IT director) </option> <option value=" Headteacher "> Headteacher </option> <option value=" Health and safety adviser "> Health and safety adviser </option> <option value=" Health play specialist "> Health play specialist </option> <option value=" Health promotion specialist "> Health promotion specialist </option> <option value=" Health records clerk "> Health records clerk </option> <option value=" Health service manager "> Health service manager </option> <option value=" Health trainer "> Health trainer </option> <option value=" Health visitor "> Health visitor </option> <option value=" Healthcare assistant "> Healthcare assistant </option> <option value=" Healthcare science assistant "> Healthcare science assistant </option> <option value=" Heating and ventilation engineer "> Heating and ventilation engineer </option> <option value=" Helicopter engineer "> Helicopter engineer </option> <option value=" Helicopter pilot "> Helicopter pilot </option> <option value=" Heritage officer "> Heritage officer </option> <option value=" Higher education lecturer "> Higher education lecturer </option> <option value=" Highways cleaner "> Highways cleaner </option> <option value=" Homeopath "> Homeopath </option> <option value=" Horse groom "> Horse groom </option> <option value=" Horse riding instructor "> Horse riding instructor </option> <option value=" Horticultural manager "> Horticultural manager </option> <option value=" Horticultural therapist "> Horticultural therapist </option> <option value=" Horticultural worker "> Horticultural worker </option> <option value=" Hospital doctor "> Hospital doctor </option> <option value=" Hospital porter "> Hospital porter </option> <option value=" Hotel manager "> Hotel manager </option> <option value=" Hotel porter "> Hotel porter </option> <option value=" Hotel receptionist "> Hotel receptionist </option> <option value=" Hotel room attendant "> Hotel room attendant </option> <option value=" Housekeeper "> Housekeeper </option> <option value=" Housing officer "> Housing officer </option> <option value=" Housing policy officer "> Housing policy officer </option> <option value=" Human resources assistant "> Human resources assistant </option> <option value=" Human resources manager "> Human resources manager </option> <option value=" Human resources officer "> Human resources officer </option> <option value=" Hydrologist "> Hydrologist </option> <option value=" Hypnotherapist "> Hypnotherapist </option> <option value=" Illustrator "> Illustrator </option> <option value=" Image consultant "> Image consultant </option> <option value=" Immigration adviser (non-government) "> Immigration adviser (non-government) </option> <option value=" Immigration officer "> Immigration officer </option> <option value=" Import-export clerk "> Import-export clerk </option> <option value=" Indexer "> Indexer </option> <option value=" Industrial cleaner "> Industrial cleaner </option> <option value=" Information scientist "> Information scientist </option> <option value=" Insurance account manager "> Insurance account manager </option> <option value=" Insurance broker "> Insurance broker </option> <option value=" Insurance claims handler "> Insurance claims handler </option> <option value=" Insurance loss adjuster "> Insurance loss adjuster </option> <option value=" Insurance risk surveyor "> Insurance risk surveyor </option> <option value=" Insurance technician "> Insurance technician </option> <option value=" Insurance underwriter "> Insurance underwriter </option> <option value=" Interior designer "> Interior designer </option> <option value=" Interpreter "> Interpreter </option> <option value=" Investment analyst "> Investment analyst </option> <option value=" IT project manager "> IT project manager </option> <option value=" IT security co-ordinator "> IT security co-ordinator </option> <option value=" IT service engineer "> IT service engineer </option> <option value=" IT support technician "> IT support technician </option> <option value=" IT trainer "> IT trainer </option> <option value=" Jewellery designer-maker "> Jewellery designer-maker </option> <option value=" Jockey "> Jockey </option> <option value=" Judge "> Judge </option> <option value=" Kennel worker "> Kennel worker </option> <option value=" Kitchen and bathroom fitter "> Kitchen and bathroom fitter </option> <option value=" Kitchen assistant "> Kitchen assistant </option> <option value=" Kitchen porter "> Kitchen porter </option> <option value=" Knitter "> Knitter </option> <option value=" Laboratory technician "> Laboratory technician </option> <option value=" Land and property valuer and auctioneer "> Land and property valuer and auctioneer </option> <option value=" Land surveyor "> Land surveyor </option> <option value=" Landscape architect "> Landscape architect </option> <option value=" Landscaper "> Landscaper </option> <option value=" Large goods vehicle driver "> Large goods vehicle driver </option> <option value=" Laundry worker "> Laundry worker </option> <option value=" Learning disability nurse "> Learning disability nurse </option> <option value=" Learning mentor "> Learning mentor </option> <option value=" Leather craftworker "> Leather craftworker </option> <option value=" Leather technologist "> Leather technologist </option> <option value=" Legal executive "> Legal executive </option> <option value=" Legal secretary "> Legal secretary </option> <option value=" Leisure centre assistant "> Leisure centre assistant </option> <option value=" Leisure centre manager "> Leisure centre manager </option> <option value=" Letting agent "> Letting agent </option> <option value=" Librarian "> Librarian </option> <option value=" Library assistant "> Library assistant </option> <option value=" Licensed conveyancer "> Licensed conveyancer </option> <option value=" Life coach "> Life coach </option> <option value=" Lifeguard "> Lifeguard </option> <option value=" Lift engineer "> Lift engineer </option> <option value=" Lighting technician "> Lighting technician </option> <option value=" Live sound engineer "> Live sound engineer </option> <option value=" Local government administrative assistant "> Local government administrative assistant </option> <option value=" Local government officer "> Local government officer </option> <option value=" Local government revenues officer "> Local government revenues officer </option> <option value=" Lock keeper "> Lock keeper </option> <option value=" Locksmith "> Locksmith </option> <option value=" Magazine journalist "> Magazine journalist </option> <option value=" Magistrate "> Magistrate </option> <option value=" Maintenance fitter "> Maintenance fitter </option> <option value=" Make-up artist "> Make-up artist </option> <option value=" Management accountant "> Management accountant </option> <option value=" Management consultant "> Management consultant </option> <option value=" Manufacturing supervisor "> Manufacturing supervisor </option> <option value=" Manufacturing systems engineer "> Manufacturing systems engineer </option> <option value=" Marine engineer "> Marine engineer </option> <option value=" Marine engineering technician "> Marine engineering technician </option> <option value=" Market research data analyst "> Market research data analyst </option> <option value=" Market research executive "> Market research executive </option> <option value=" Market researcher "> Market researcher </option> <option value=" Market trader "> Market trader </option> <option value=" Marketing director "> Marketing director </option> <option value=" Marketing executive "> Marketing executive </option> <option value=" Marketing manager "> Marketing manager </option> <option value=" Martial arts instructor "> Martial arts instructor </option> <option value=" Massage therapist "> Massage therapist </option> <option value=" Materials engineer "> Materials engineer </option> <option value=" Materials technician "> Materials technician </option> <option value=" Maternity support worker "> Maternity support worker </option> <option value=" Meat hygiene inspector "> Meat hygiene inspector </option> <option value=" Meat process worker "> Meat process worker </option> <option value=" Mechanical engineer "> Mechanical engineer </option> <option value=" Mechanical engineering technician "> Mechanical engineering technician </option> <option value=" Media researcher "> Media researcher </option> <option value=" Medical herbalist "> Medical herbalist </option> <option value=" Medical illustrator "> Medical illustrator </option> <option value=" Medical physicist "> Medical physicist </option> <option value=" Medical sales representative "> Medical sales representative </option> <option value=" Medical secretary "> Medical secretary </option> <option value=" Mental health nurse "> Mental health nurse </option> <option value=" Merchant Navy deck officer "> Merchant Navy deck officer </option> <option value=" Merchant Navy engineering officer "> Merchant Navy engineering officer </option> <option value=" Merchant Navy rating "> Merchant Navy rating </option> <option value=" Meteorologist "> Meteorologist </option> <option value=" Metrologist "> Metrologist </option> <option value=" Microbiologist "> Microbiologist </option> <option value=" Microbrewer "> Microbrewer </option> <option value=" Midwife "> Midwife </option> <option value=" Model maker "> Model maker </option> <option value=" Money adviser "> Money adviser </option> <option value=" Montessori teacher "> Montessori teacher </option> <option value=" Mortgage adviser "> Mortgage adviser </option> <option value=" Motor mechanic "> Motor mechanic </option> <option value=" Motor vehicle breakdown engineer "> Motor vehicle breakdown engineer </option> <option value=" Motor vehicle fitter "> Motor vehicle fitter </option> <option value=" Motor vehicle parts person "> Motor vehicle parts person </option> <option value=" Motorcycle mechanic "> Motorcycle mechanic </option> <option value=" Motorsport engineer "> Motorsport engineer </option> <option value=" MP "> MP </option> <option value=" Museum assistant "> Museum assistant </option> <option value=" Museum curator "> Museum curator </option> <option value=" Music promotions manager "> Music promotions manager </option> <option value=" Music teacher "> Music teacher </option> <option value=" Music therapist "> Music therapist </option> <option value=" Musical instrument maker and repairer "> Musical instrument maker and repairer </option> <option value=" Nail technician "> Nail technician </option> <option value=" Nanny "> Nanny </option> <option value=" Nanotechnologist "> Nanotechnologist </option> <option value=" Naturopath "> Naturopath </option> <option value=" Naval architect "> Naval architect </option> <option value=" Neighbourhood warden "> Neighbourhood warden </option> <option value=" Network engineer "> Network engineer </option> <option value=" Network manager "> Network manager </option> <option value=" Newspaper journalist "> Newspaper journalist </option> <option value=" Newspaper or magazine editor "> Newspaper or magazine editor </option> <option value=" Non-destructive testing technician "> Non-destructive testing technician </option> <option value=" Nuclear engineer "> Nuclear engineer </option> <option value=" Nuclear technician "> Nuclear technician </option> <option value=" Nurse "> Nurse </option> <option value=" Nursery manager "> Nursery manager </option> <option value=" Nursery worker "> Nursery worker </option> <option value=" Nursing associate "> Nursing associate </option> <option value=" Nutritional therapist "> Nutritional therapist </option> <option value=" Nutritionist "> Nutritionist </option> <option value=" Occupational health nurse "> Occupational health nurse </option> <option value=" Occupational therapist "> Occupational therapist </option> <option value=" Occupational therapy support worker "> Occupational therapy support worker </option> <option value=" Oceanographer "> Oceanographer </option> <option value=" Office manager "> Office manager </option> <option value=" Offshore drilling worker "> Offshore drilling worker </option> <option value=" Ofsted inspector "> Ofsted inspector </option> <option value=" Oil and gas operations manager "> Oil and gas operations manager </option> <option value=" Online tutor "> Online tutor </option> <option value=" Operating department practitioner "> Operating department practitioner </option> <option value=" Operational researcher "> Operational researcher </option> <option value=" Optometrist "> Optometrist </option> <option value=" Order picker "> Order picker </option> <option value=" Ornithologist "> Ornithologist </option> <option value=" Orthoptist "> Orthoptist </option> <option value=" Osteopath "> Osteopath </option> <option value=" Outdoor activities instructor "> Outdoor activities instructor </option> <option value=" Packaging technologist "> Packaging technologist </option> <option value=" Packer "> Packer </option> <option value=" Paediatrician "> Paediatrician </option> <option value=" Paint sprayer "> Paint sprayer </option> <option value=" Painter and decorator "> Painter and decorator </option> <option value=" Palaeontologist "> Palaeontologist </option> <option value=" Palliative care assistant "> Palliative care assistant </option> <option value=" Paper maker "> Paper maker </option> <option value=" Paralegal "> Paralegal </option> <option value=" Paramedic "> Paramedic </option> <option value=" Patent attorney "> Patent attorney </option> <option value=" Pathologist "> Pathologist </option> <option value=" Patient advice and liaison service officer "> Patient advice and liaison service officer </option> <option value=" Patient transport service controller "> Patient transport service controller </option> <option value=" Pattern cutter "> Pattern cutter </option> <option value=" Payroll administrator "> Payroll administrator </option> <option value=" Payroll manager "> Payroll manager </option> <option value=" PE teacher "> PE teacher </option> <option value=" Pensions administrator "> Pensions administrator </option> <option value=" Pensions adviser "> Pensions adviser </option> <option value=" Personal assistant "> Personal assistant </option> <option value=" Personal shopper "> Personal shopper </option> <option value=" Personal trainer "> Personal trainer </option> <option value=" Pest control technician "> Pest control technician </option> <option value=" Pet behaviour counsellor "> Pet behaviour counsellor </option> <option value=" Pet shop assistant "> Pet shop assistant </option> <option value=" Petrol station sales assistant "> Petrol station sales assistant </option> <option value=" Pharmacist "> Pharmacist </option> <option value=" Pharmacologist "> Pharmacologist </option> <option value=" Pharmacy assistant "> Pharmacy assistant </option> <option value=" Pharmacy technician "> Pharmacy technician </option> <option value=" Phlebotomist "> Phlebotomist </option> <option value=" Photographer "> Photographer </option> <option value=" Photographic stylist "> Photographic stylist </option> <option value=" Photographic technician "> Photographic technician </option> <option value=" Physician associate "> Physician associate </option> <option value=" Physicist "> Physicist </option> <option value=" Physiotherapist "> Physiotherapist </option> <option value=" Physiotherapy assistant "> Physiotherapy assistant </option> <option value=" Picture framer "> Picture framer </option> <option value=" Pilates teacher "> Pilates teacher </option> <option value=" Pipe fitter "> Pipe fitter </option> <option value=" Planning and development surveyor "> Planning and development surveyor </option> <option value=" Plasterer "> Plasterer </option> <option value=" Play therapist "> Play therapist </option> <option value=" Playworker "> Playworker </option> <option value=" Plumber "> Plumber </option> <option value=" Podiatrist "> Podiatrist </option> <option value=" Podiatry assistant "> Podiatry assistant </option> <option value=" Police community support officer "> Police community support officer </option> <option value=" Police officer "> Police officer </option> <option value=" Pop musician "> Pop musician </option> <option value=" Port operative "> Port operative </option> <option value=" Portage home visitor "> Portage home visitor </option> <option value=" Post Office customer service assistant "> Post Office customer service assistant </option> <option value=" Postman or postwoman "> Postman or postwoman </option> <option value=" Practice nurse "> Practice nurse </option> <option value=" Pre-press operator "> Pre-press operator </option> <option value=" Primary care graduate mental health worker "> Primary care graduate mental health worker </option> <option value=" Primary school teacher "> Primary school teacher </option> <option value=" Prison governor "> Prison governor </option> <option value=" Prison instructor "> Prison instructor </option> <option value=" Prison officer "> Prison officer </option> <option value=" Private investigator "> Private investigator </option> <option value=" Private practice accountant "> Private practice accountant </option> <option value=" Probation officer "> Probation officer </option> <option value=" Probation services officer "> Probation services officer </option> <option value=" Product designer "> Product designer </option> <option value=" Production manager (manufacturing) "> Production manager (manufacturing) </option> <option value=" Production worker (manufacturing) "> Production worker (manufacturing) </option> <option value=" Proofreader "> Proofreader </option> <option value=" Prop maker "> Prop maker </option> <option value=" Prosthetist-orthotist "> Prosthetist-orthotist </option> <option value=" Psychiatrist "> Psychiatrist </option> <option value=" Psychologist "> Psychologist </option> <option value=" Psychotherapist "> Psychotherapist </option> <option value=" Public finance accountant "> Public finance accountant </option> <option value=" Public relations director "> Public relations director </option> <option value=" Public relations officer "> Public relations officer </option> <option value=" Publican "> Publican </option> <option value=" Purchasing manager "> Purchasing manager </option> <option value=" QCF assessor "> QCF assessor </option> <option value=" Quality assurance manager "> Quality assurance manager </option> <option value=" Quality control assistant "> Quality control assistant </option> <option value=" Quantity surveyor "> Quantity surveyor </option> <option value=" Quarry engineer "> Quarry engineer </option> <option value=" Quarry worker "> Quarry worker </option> <option value=" Racehorse trainer "> Racehorse trainer </option> <option value=" Radio broadcast assistant "> Radio broadcast assistant </option> <option value=" Radiographer "> Radiographer </option> <option value=" Radiography assistant "> Radiography assistant </option> <option value=" RAF airman or airwoman "> RAF airman or airwoman </option> <option value=" RAF non-commissioned aircrew "> RAF non-commissioned aircrew </option> <option value=" RAF officer "> RAF officer </option> <option value=" Rail engineering technician "> Rail engineering technician </option> <option value=" Rail track maintenance worker "> Rail track maintenance worker </option> <option value=" Railway signaller "> Railway signaller </option> <option value=" Receptionist "> Receptionist </option> <option value=" Recruitment consultant "> Recruitment consultant </option> <option value=" Recycled metals worker "> Recycled metals worker </option> <option value=" Recycling officer "> Recycling officer </option> <option value=" Recycling operative "> Recycling operative </option> <option value=" Reflexologist "> Reflexologist </option> <option value=" Refrigeration and air-conditioning installer "> Refrigeration and air-conditioning installer </option> <option value=" Registrar of births, deaths, marriages and civil partnerships "> Registrar of births, deaths, marriages and civil partnerships </option> <option value=" Reiki healer "> Reiki healer </option> <option value=" Religious leader "> Religious leader </option> <option value=" Removals worker "> Removals worker </option> <option value=" Reprographic assistant "> Reprographic assistant </option> <option value=" Research and development manager "> Research and development manager </option> <option value=" Research scientist "> Research scientist </option> <option value=" Residential support worker "> Residential support worker </option> <option value=" Resort representative "> Resort representative </option> <option value=" Restaurant manager "> Restaurant manager </option> <option value=" Retail buyer "> Retail buyer </option> <option value=" Retail jeweller "> Retail jeweller </option> <option value=" Retail manager "> Retail manager </option> <option value=" Retail merchandiser "> Retail merchandiser </option> <option value=" Riding holiday centre manager "> Riding holiday centre manager </option> <option value=" Riding holiday leader "> Riding holiday leader </option> <option value=" Road traffic accident investigator "> Road traffic accident investigator </option> <option value=" Road transport manager "> Road transport manager </option> <option value=" Road worker "> Road worker </option> <option value=" Roadie "> Roadie </option> <option value=" Robotics engineer "> Robotics engineer </option> <option value=" Roofer "> Roofer </option> <option value=" Roustabout "> Roustabout </option> <option value=" Royal Marines commando "> Royal Marine So I have a basic search form that goes through and does a mySQL like '%$sanitizedInput%' to column in the table. The problem I have is that if I have two rows, one with a value "green" and the second "blue", and I do a search for "green", it shows the green result, if I do a search for "blue", it shows the blue result, but if i do a search for "green blue" it returns no results. Any ideas on how to fix this? Hello , i need some help on this line. Line: $compose_a = mysql_query("SELECT * FROM users WHERE username LIKE '%". realEscape($sendto) ."%' LIMIT 1") or die(mysql_error()); From the code : <?php if(isset($_GET['usercp']) && $_GET['send'] == 'true') { if($_POST['sendtitle'] == "") { echo "You need to have a message title."; } else { if($_POST['sendto'] == "") { echo "You must enter the username of the user you wish to send a message to."; } else { if($_POST['sendtext'] == "") { echo "You have not entered anything to send"; } else { $sendto = str_replace('_', ' ' , $_POST['sendto']); $compose_a = mysql_query("SELECT * FROM users WHERE username LIKE '%". realEscape($sendto) ."%' LIMIT 1") or die(mysql_error()); if(mysql_num_rows($compose_a) >= 1) { While($compose_b = mysql_fetch_array($compose_a)) { $sendto = $compose_b['id']; } mysql_query("INSERT INTO `notifications` (ipaddress, senderid, recieverid, sent, title, text) VALUES ('". $_SERVER['REMOTE_ADDR'] ."', '". $_SESSION['id'] ."', '" . $sendto . "', NOW(), '". htmlspecialchars($_POST['sendtitle']) ."', '". htmlspecialchars($_POST['sendtext']) ."')") or die(mysql_error()); echo "Message has been sent."; } else { echo "The username you entered does not Exist"; } } } } } ?> The $sendto is a username. i want to make it so if a user puts a Uppercase letter or a lowercase letter or a space where a '_' should be. it still matchs whats in the database. if you find a better way of doing this please post it Hello, I'm making a website which includes an articles page. I want users to be able to search for particular articles. For this search function I used the Simple SQL Search tutorial from phpfreaks (http://www.phpfreaks.com/tutorial/simple-sql-search). It's working quite well but i'd like to expand it a little. The most important thing i want changed is what happens when users enters a string which holds multiple words. The function from the tutorial perceives these words as one string and searches for that string as a whole. For example when a user enters 'winter 2012' and an article holds the string 'winter of 2012', the function returns no matches. This is, ofcourse, not the way i'd like it to function. I've managed to seperate the words and search for them individually by using explode and foreach, but now i'm getting duplicate results when an article holds mulitple words from the users' entry string. My idea to fix this was to make an array with the article id's of the articles that have matched, and then to exclude them from the SQL query for the next word from the search string by using 'NOT IN $array' in the where clause. Unfortunately i haven't managed to succeed with this so far and that's why i ask for your help.. This my search function: Code: [Select] function zoekopdracht() { require('dbcon.php'); $zoekopdr = trim($_GET['zzoek']); $zoekopdr = strip_tags($zoekopdr); if (strlen($zoekopdr) < 3) { echo "De zoekopdr moet minimaal 3 karakters bevatten."; } else { $zoekopdr = explode(" ", $zoekopdr); foreach($zoekopdr as $zoekterm) { $zoekopdrDB = mysql_real_escape_string($zoekterm); $searchSQL = "SELECT * FROM n_artikelen WHERE "; $types = array(); $types[] = isset($_GET['zartikel'])?" volledig_artikel LIKE '%{$zoekopdrDB}%'":''; $types[] = isset($_GET['ztitel'])?" titel LIKE '%{$zoekopdrDB}%'":''; $types[] = isset($_GET['zjaar'])?" YEAR(publicatie) LIKE '%{$zoekopdrDB}%'":''; $types = array_filter($types, "removeEmpty"); // removes any item that was empty (not checked) if (count($types) < 1) { $types[] = "volledig_artikel LIKE '%{$zoekopdrDB}%'"; // use the artikel + titel as a default search if none are checked $types[] = "titel LIKE '%{$zoekopdrDB}%'"; } $searchSQL .= implode(" OR ", $types) . " ORDER BY publicatie LIMIT 0,10"; $searchResult = mysql_query($searchSQL) or die(mysql_error()); if (mysql_num_rows($searchResult) < 1) { echo "De zoekopdracht '{$zoekopdr}' heeft geen resultaten."; } else { while ($row = mysql_fetch_array($searchResult, MYSQL_NUM)) { artikelelement($row); // function that outputs the result of $row[] } } } } } Additionally, if this problem is fixed, i'd love to see a way to sort the results on closest match (article which matches two words > article which matches one word). Thanks! |