PHP - Use $_session Within Mysql Search
Hey all,
Trying to search for something within a database, using two different fields, one text box and one drop down (the values are actually table names). Here is what I have, this doesn't work: Code: [Select] <?php $result = mysql_query("SELECT * FROM cakeorder WHERE `{$_SESSION['name']}` = '".$_SESSION['search']. "'"); Thanks! Jason Similar TutorialsLet's say I grab all the user's information from the users table. It's stored into a variable as an array: $pun_user. Now, to get access this user data, it selects all the data each refresh and sets it to $pun_user for extraction later. My idea: Create a $_SESSION['user_id'] = $pun_user['user_id'] And then when using updating stuff via ajax requests, I can just do SELECT blah from users where where user_id = $_SESSION['user_id'] instead of: calling the main query to enter all the data into $pun_user, then do that query AGAIN and do SELECT blah from users where user_id = $pun_user['user_id'] Is the $_SESSION way going to take a performance hit on the server? Or is the MYSQL way a more detrimental approach? Which way is faster, and less intrusive on the server? Edited by Monkuar, 22 January 2015 - 10:35 PM. Need 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!
First let me explain my code. This is later included in project_status.php] . In project_status.php] , I have included another file project_status_app.php which contains a HTML form.
<?php include 'inc_fn_header_and_menu.php'; function includeFile($file,$variable) { $var = $variable; include($file); } if (isset($_GET['id']) && $_GET['id']!="") { $pid = $_GET['id']; $_SESSION['pidForApproval'] = $_GET['id']; $query = 'SELECT * FROM `profile` WHERE pid ='.'\''.$pid.'\''; $result=mysqli_query($db,$queryToRetrievePP) or die("There are no records to display ... \n" . mysqli_error()); foreach ($result as $row) { $status = $row['status']; } } ...........some PHP and HTML code....... <div id="customerPurchaseApprovalForm"> <?php echo '<p>APPROVAL FOR CUSTOMER PURCHASE</p>'; $discountApprovalStatus = "Granted"; if ($discountApprovalStatus == "Granted") { includeFile("project_status_app.php",$highestannualvalue); } else { //......... } In project_status_app.php I am attempting to retrieve pidForApproval from the $_SESSION array. <?php // put your code here UPDATE `pp` SET `customer_purchase_remarks` = 'hahaha' WHERE `pp`.`id` = 207; if ($_SERVER['REQUEST_METHOD'] == 'POST') { include '../../inc/fastlogin.php'; $sql = "UPDATE pp SET customer_purchase_remarks ='{$_POST['remarkstxt']}' WHERE pp.pid='{$_SESSION['pidForApproval']}'"; $result = mysqli_query ( $fastdb, $sql ) ; if (mysqli_affected_rows($fastdb) != 1) { $_SESSION['err_cpa_rmks'] = "<p>Error while updating WHERE id='{$_SESSION['pidForApproval']}'</p>"; //echo "<p>Error while updating WHERE id='{$_POST['pidForApproval']}'</p>".mysqli_error($fastdb); } else { $_SESSION['suc_cpa_rmks'] = "<p>Records was updated successfully.</p>"; //echo "Records was updated successfully."; } header ("location: project_status.php?id="$_SESSION['pidForApproval']); exit(); } ?> When I load project_status.php, project_status_app.php is supposed to display the form. Once the user fills in the form the and the submit button has been pressed, the UPDATE statement is supposed to run and then it is supposed to navigate back to project_status.php?id=FA142. But the update is failing and the when the project_status.php is loaded back, the url looks like this http://localhost/fast/project_status.php?id= . The id is empty. It is supposed to be something like this http://localhost/fast/project_status.php?id=FA142. With the id being populated at the header ("location: project_status.php?id=".$_SESSION['pidForApproval']);
Missing some information. 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 Hello everyone, I am working on a form that is similar to a shopping cart system and I am thinking of creating a button that submits the checked value and saves them to a $_SESSION variable. And also a link that links to a cart.html that takes the values of a $_SESSION variable. I am have trouble figuring what tag/attribute should I use in order to achieve that.
Right now my code attached below submits the checked values to cart.html directly. However I want my submit button to save the checked box to a $_SESSION variable and STAY on the same page. And then I will implement a <a> to link to the cart.php.
I researched a little bit about this subject and I know it's somewhat related to ajax/jquery. I just wanted to know more about it from you guys. I appreciate your attention for reading the post and Thanks!
Below is the form that I currently have:
<form name= "finalForm" method="POST" action="cart.php"> <input type="Submit" name="finalSelected"/> <?php foreach($FinalName as $key => $item) {?> <tr> <td><input type="checkbox" name="fSelected[]" value="<?php echo htmlspecialchars($FinalID[$key])?>" /> <?php echo "$FinalID[$key] & $item";?> </td> </tr> <?php } ;?>Below is the code for cart.php <?php require ('connect_db.php'); if(isset($_POST['finalSelected'])) { if(!empty($_POST['fSelected'])) { $chosen = $_POST['fSelected']; foreach ($chosen as $item) echo "aID selected: $item </br>"; $delimit = implode(", ", $chosen); print_r($delimit); } } if(isset($delimit)) { $cartSQL = "SELECT * from article where aID in ($delimit)"; $cartQuery = mysqli_query($dbc, $cartSQL) or die (mysqli_error($dbc)); while($row = mysqli_fetch_array($cartQuery, MYSQLI_BOTH)) { $aTitle[] = $row[ 'name' ]; } } ?> <table> <?php if(isset($delimit)) { $c=0; foreach($aTitle as $item) {?> <tr> <td> <?php echo $aTitle[$c]; $c++;?> </td> </tr> <?php }}?> </table> 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 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> 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. 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 am developing a portion of a site for a client. He has an 800 page pdf document that he would like the software to search based on client input. When the user searches, he would like it to display a Google-esque search results page that would display a title (Probably the chapter in which the result was found), then an excerpt from the text surrounding the matching keyword(s). When the user clicks the link, he would like it to take them to the page where the match was found. A big drawback is that this document will be changing fairly regularly and will need to be updated. Initially I thought I could store the pdf in a database as text/html with each page being a record in the table, but with frequent changes, I fear this would be a nightmare to manage. My only other thought is to store the file as one big entry in a table and search the entire entry, which I have done some searching and have come up with some options, but when you click it loads the entire db entry. This would create issues with an 800 page document. Hello, I can't really explain it so a example will be better: my_table: col1 col2 col3 col4 1 1 23 A 2 1 25 A 3 2 21 B 4 3 24 A 5 3 28 A the query is-- SELECT col3 FROM my_table WHERE col2=SELECT(MAX(col2) FROM my_table WHERE col4='A') For some reason this is illegal, I can also not use a limit because the number of rows is not known a priori. I remember seeing some sort of redirection in some other forum but would appreciate a more explicit response. Thanks This is not legal for some reason -- is there a way I need some help on how to search in two different mysql tables, and then show the results sorted/ordered by the tables. Quote RESULTS: Tabel 1 # ... # ... Tabel 2 # ... # ... Thanks in advance! 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 Hi Everybody, I think it's fairly simple, but i am a noob in PHP so need help from advanced coders. I have MySQL table which is being filled up everyday, there are 7 fields in the table (submitter, choosebank, choosetype, ampaid, amret, date, descript). What I need is to create a search.php which will be looking up data in all fields and printing it on the screen and the search should be filtered. What I mean is when a user wants to search for data let's say using submitter who's name is Mitchel then it should search for all data and print all rows containing submitter (Mitchel) and the rest six fields. And if user searches let's say using submitter (Mitchel) and a certain date (let's say DEC-25-2011) then it should find all data containing Mitchel and DEC-25-2011 in the same row and print all rows which contain the same search parameter and the rest of the fields. Any help would be greatly appreciated! Here is the code I have so far, but it doesn't work. <code> <?php include ("blocks/db.php"); $sql = mysql_query("SELECT * FROM banks WHERE submitter LIKE '$sub' or choosebank LIKE '$bank' or choosetype LIKE '$type' or $money_column LIKE '$money_column' or $money_value LIKE '$money_amount' or inputdate LIKE '$inputdate' or descript LIKE '$descript'") or die(mysql_error()); echo "<table width='1000' border='1' cellspacing='0' cellpadding='1'>"; echo "<tr>"; echo "<td width='100'>Submitter</td>"; echo "<td width='90'>Bank</td>"; echo "<td width='110'>Type of Payment</td>"; echo "<td width='110'>Amount Paid</td>"; echo "<td width='110'>Amount Returned</td>"; echo "<td width='100'>Date</td>"; echo "<td width='366'>Description</td>"; echo "</tr>"; echo "</table>"; while ($row = mysql_fetch_array($sql)){ echo "<table width='1000' border='1' cellspacing='0' cellpadding='1'>"; echo "<tr>"; echo "<td width='100'>$row[submitter]</td>"; echo "<td width='90'>$row[choosebank]</td>"; echo "<td width='110'>$row[choosetype]</td>"; echo "<td width='110'>$row[ampaid]</td>"; echo "<td width='110'>$row[amret]</td>"; echo "<td width='100'>$row[date]</td>"; echo "<td width='366'>$row[descript]</td>"; echo "</tr>"; echo "</table>"; } ?> </code> 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 |