PHP - Searching Two Columns
Hi, I have a piece of code which I trying to search two columns but I just cant get it to work. Instead it just dumps around 30 entries onto the page. Can anyone point me in the direction of how to search two columns?
Code: [Select] $query = "SELECT * FROM questions"; if(isset($_GET['question']) && !empty($_GET['notes'] )) { /*query the database*/ $question = $_GET['question']; $notes = $_GET['notes']; $query .= " WHERE question && notes like '%$question%' LIMIT 0, 10"; } $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $question = $row['question']; $notes = $row['notes']; echo "$question $notes </br>"; } Similar TutorialsHi,
How can I select multiple columns from two tables and run a search through multiple fields?
My tables a
t_persons (holds information about persons)
t_incidents (holds foreign keys from other tables including t_persons table)
What I want is to pull some columns from the two tables above and run a search with a LIKE criteria, something like below. The code originally worked well with only one table, but for two tables it generate errors:
$query = "SELECT p.PersonID ,p.ImagePath ,p.FamilyName ,p.FirstName ,p.OtherNames ,p.Gender ,p.CountryID ,i.IncidentDate ,i.KeywordID ,i.IncidentCountryID ,i.StatusID FROM t_incidents AS i LEFT JOIN t_persons AS p ON i.PersonID = p.PersonID WHERE FamilyName LIKE '%" . $likes . "%' AND FirstName LIKE '%" . $likes . "%' AND OtherNames LIKE '%" . $likes . "%' AND Gender LIKE '%" . $likes . "%' AND IncidentDate LIKE '%" . $likes . "%' AND KeywordID LIKE '%" . $likes . "%' AND IncidentCountryID LIKE '%" . $likes . "%' AND StatusID LIKE '%" . $likes . "%' ORDER BY PersonID DESC $pages->limit";Errors a Column 'IncidentDate' in where clause is ambiguous Column 'KeywordID' in where clause is ambiguous Column 'IncidentCountryID' in where clause is ambiguous Column 'StatusID' in where clause is ambiguousThese columns are foreign keys on t_incidents table. I have also attached the table relationship diagram if it helps. I will appreciate any better way to do this. Thanx. Joseph Attached Files Model - 3.png 76.6KB 0 downloads Hello all! I'm having some issues with a snippet that I found online and have edited to how I want it. Basically the code works at the moment, except if I were to search for 2 or 3 terms, it would search the columns username/action/result/changes for any result that have any of the words rather than results that include both terms, instead of either. I want the query to be like (assuming 2 search terms): Quote username LIKE '%$filter%' OR action LIKE '%$filter%' OR result LIKE '%$filter%' OR changes LIKE '%$filter%' AND username LIKE '%$filter%' OR action LIKE '%$filter%' OR result LIKE '%$filter%' OR changes LIKE '%$filter%' and not: Quote username LIKE '%$filter%' OR action LIKE '%$filter%' OR result LIKE '%$filter%' OR changes LIKE '%$filter%' OR username LIKE '%$filter%' OR action LIKE '%$filter%' OR result LIKE '%$filter%' OR changes LIKE '%$filter%' It needs an AND instead of an OR, but I'm not sure how to go around doing it. Here's the code as it is at the moment: $filter = ($_POST['filter']); $query = "SELECT * FROM activity WHERE"; $searchresult = explode(" ", $filter); foreach ($searchresult as $key => $filter) { $query .= " username LIKE '%$filter%' OR action LIKE '%$filter%' OR result LIKE '%$filter%' OR changes LIKE '%$filter%'"; if ($key != (sizeof($searchresult) - 1)) $query .= " AND "; } $query .= "ORDER BY id DESC"; Sorry if this is a little confusing to understand, hope someone understands what I need. I'm having some trouble with a GET search code; everything works until the stringresult but then it dies to Error Querying Database Code: [Select] <html> <body> <?php //Get sort setting and search terms from URL with GET $usersearch = $_GET['usersearch']; echo 'Search word: ' . $usersearch; echo '<br>'; require_once("dbvars.php"); //Connect to Database $dbc = mysqli_connect (DB_HOST, DB_USER, DB_PW, DB_NAME) or die ("Error connecting to database."); //Build the Query $query = "SELECT * FROM customers" . 'WHERE customers.given_name=\'' . $usersearch . '\''; echo $query; //Execute the Query $result = mysqli_query($dbc, $query) or die ("Error querying database."); //Create the Table Headings echo '<table border="1"><tr>'; echo '<td><b>First Name</b></td>'; echo '<td><b>Last Name</b></td>'; echo '<td><b>Address</b></td>'; echo '<td><b>City</b></td>'; echo '<td><b>Province</b></td>'; echo '<td><b>Postal Code</b></td>'; echo '<td><b>Phone Number</b></td>'; echo '</tr>'; //Display Results through Array Loop While ($row = mysqli_fetch_array($result)) { echo '<tr><td>' . $row['given_name'] . '</td>'; echo '<td>' . $row['surname'] . '</td>'; echo '<td>' . $row['address'] . '</td>'; echo '<td>' . $row['city'] . '</td>'; echo '<td>' . $row['province'] . '</td>'; echo '<td>' . $row['postal_code'] . '</td>'; echo '<td>' . $row['phone_number'] . '</td></tr>'; } '</table>'; // Close the database connection mysqli_close($dbc); ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <input name="usersearch" type="text" size="30" /> <input name="submit" type="submit" value="go" /> </form> </body> </html> Hi, I want to create a search which uses the 'title' of my 'product' table and matches the terms the user has submitted. At the moment, my products are displaying one by one. For example, I have an apple and apricot in my table. The user searches 'a' and the search results show 'apple' but not apricot. Here's my code: Code: [Select] <?php require_once('inc/global.inc.php'); # search.inc.php /* * This is the search content module. * This page is included by index.php. * This page expects to receive $_GET['terms']. */ // Redirect if this page was accessed directly: if (!defined('BASE_URL')) { // Need the BASE_URL, defined in the config file: require_once ('../includes/config.inc.php'); // Redirect to the index page: $url = BASE_URL . 'index.php?p=search'; // Pass along search terms? if (isset($_GET['terms'])) { $url .= '&terms=' . urlencode($_GET['terms']); } header ("Location: $url"); exit; } // End of defined() IF. // Print a caption: echo '<h2>Search Results</h2>'; // Display the search results if the form // has been submitted. if (isset($_GET['terms']) && ($_GET['terms'] != 'Search...') ) { $terms = $_GET['terms']; $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die *('Error connecting to MySQL server'); // Query the database. $query = "SELECT * FROM product WHERE title LIKE '%$terms%'"; $result = mysqli_query($dbc, $query); // Fetch the results. $row = mysqli_fetch_array($result); // Print the results: $output[] = '<ul>'; $output[] = '<li>'.$row['title'] .': £'.$row['price'].'<br /><img src="'.$row['img'].'" alt="'.$row['title'].'" /></li>'; $output[] = '</ul>'; echo join('',$output); } else { // Tell them to use the search form. echo '<p class="error">Please use the search form at the top of the window to search this site.</p>'; } ?> A friend told me I need to use a for-each loop but I can't figure it out. Any help is appreciated, thanks for reading. I've been reading a few tutorials on how the best way to search key words in a database and at the moment im trying to get this query to work but its coming back with a error:
#1191 - Can't find FULLTEXT index matching the column listquery: SELECT title, description FROM items WHERE MATCH(title, description) AGAINST('xbox')any help or advise on how the best way to search 2 columns on matching words...thank you Hi im really confused and annoyed Im making a real estate website and im stuck ont eh searching for a house part. Im trying to set up some searches on the different parts of the house usign text boxes for area and postcode and drop boxes for type and bedrooms and bathrooms i now you have to set up a form with input type text and then call it a name use get/post on a php side and then $_POST['search']; But i dnt seem to be able to make a search was hoping someone was kind enough to knock me up some quick code so it is functional and makbe i can work from it A;so any help towards searching using dropboxes would be awsume and if i have 2 boxes for price upper and lower how would this work Much appreciated So I've full text indexed the columns I want searchable: I have some rows inserted: Yet when I run a match() against(), I get 0 results: If I do: Code: [Select] SELECT * FROM video WHERE MATCH (name) AGAINST ('test') I get 2 results. Why does that work, yet keywords don't? Ok I have a set of PDF files that i need to be searchable. My question how do i go about doing this. Can this be achieved with php or do a need to do something else? I am including my test.php for other to run. I have a very large array of concatenated hash values. I have another array that contains the first 8 hash values of the other array. I have a function to locate them in the larger array. Depending on their index value I then choose the index of the value before or behind them for adding to something else later. This 'computeWalk' method works for small arrays but for larger arrays I notice duplicates or errors with larger ones. For example. The first array returns: Array ( => 1 [1] => 18 [2] => 18 [3] => 35 [4] => 33 [5] => 33 ) The values for i's to get each of these values are I = 0 I = 19 I = 29 I = 34 I = 37 I = 39 Walking through the method by hand, 0%2 = 0 So the first element of the array will be 1. CORRECT. 19%2 = 1 So the next element will be 18. CORRECT. 29%2 = 1 The next element should be 28. It returns 18. 34%2 = 0 The next element will be 35. Correct. 37%2 = 1 The next element should be 36. It returns 33. 39%2 = 1 The next element should be 38. It returns 33. I am not sure why it's doing the above. I also tried array_search and it computed it the same way. Would appreciate any help. <?php $arrayTree = array(); $arrayTree[0] = "9d027b1c4068d81287c9170f4b291387f8327eb7"; $arrayTree[1] = "4c8fabdc24c2d8205db916a22e9459195833a272"; $arrayTree[2] = "209526afab9e85b54e1832a820a7f578b7760af0"; $arrayTree[3] = "59d6926525e941edca99493b2b2a4f0a6efcb757"; $arrayTree[4] = "c8b49b8e414a09ddb693c580ecdfa6793c845f9d"; $arrayTree[5] = "b207bea6c4833d90f6ee4e694ffb148c046b0eb3"; $arrayTree[6] = "6d72a84b3aefbd3766078ed17a19aebb0c4ae026"; $arrayTree[7] = "b00207b8944520ea3817334615a7cdbf8214232a"; $arrayTree[8] = "d934f53af9bee26f35df7206dc06211778996986"; $arrayTree[9] = "de2ecd02fd017b0311dbfe589b5faa7954ced196"; $arrayTree[10] = "7d9752d09d3097fac748b6767472f9b69a65ed2e"; $arrayTree[11] = "62630fe109b42747b4c53065ec96aabf7b14d7b6"; $arrayTree[12] = "d727b5b8ffaeadbac75123801c270fd65f19251c"; $arrayTree[13] = "e39a9141fd9ce9426e88f30b6f245fdbb8f887a5"; $arrayTree[14] = "85fe053baa7ccf469c440a7dd98381228a0c52c3"; $arrayTree[15] = "6199634d410d0c91fd6ff99af9eabd5a1c7911de"; $arrayTree[16] = "af594de7d539519445013b7c87f02edbf3c44653"; $arrayTree[17] = "b6eb6dab75d092f4be345925ccbf87ff1e17fc31"; $arrayTree[18] = "2163ca6b0a608242712af82a81599f1f95c26dee"; $arrayTree[19] = "9d027b1c4068d81287c9170f4b291387f8327eb74c8fabdc24c2d8205db916a22e9459195833a272"; $arrayTree[20] = "209526afab9e85b54e1832a820a7f578b7760af059d6926525e941edca99493b2b2a4f0a6efcb757"; $arrayTree[21] = "c8b49b8e414a09ddb693c580ecdfa6793c845f9db207bea6c4833d90f6ee4e694ffb148c046b0eb3"; $arrayTree[22] = "6d72a84b3aefbd3766078ed17a19aebb0c4ae026b00207b8944520ea3817334615a7cdbf8214232a"; $arrayTree[23] = "d934f53af9bee26f35df7206dc06211778996986de2ecd02fd017b0311dbfe589b5faa7954ced196"; $arrayTree[24] = "7d9752d09d3097fac748b6767472f9b69a65ed2e62630fe109b42747b4c53065ec96aabf7b14d7b6"; $arrayTree[25] = "d727b5b8ffaeadbac75123801c270fd65f19251ce39a9141fd9ce9426e88f30b6f245fdbb8f887a5"; $arrayTree[26] = "85fe053baa7ccf469c440a7dd98381228a0c52c36199634d410d0c91fd6ff99af9eabd5a1c7911de"; $arrayTree[27] = "af594de7d539519445013b7c87f02edbf3c44653b6eb6dab75d092f4be345925ccbf87ff1e17fc31"; $arrayTree[28] = "2163ca6b0a608242712af82a81599f1f95c26dee"; $arrayTree[29] = "9d027b1c4068d81287c9170f4b291387f8327eb74c8fabdc24c2d8205db916a22e9459195833a272209526afab9e85b54e1832a820a7f578b7760af059d6926525e941edca99493b2b2a4f0a6efcb757"; $arrayTree[30] = "c8b49b8e414a09ddb693c580ecdfa6793c845f9db207bea6c4833d90f6ee4e694ffb148c046b0eb36d72a84b3aefbd3766078ed17a19aebb0c4ae026b00207b8944520ea3817334615a7cdbf8214232a"; $arrayTree[31] = "d934f53af9bee26f35df7206dc06211778996986de2ecd02fd017b0311dbfe589b5faa7954ced1967d9752d09d3097fac748b6767472f9b69a65ed2e62630fe109b42747b4c53065ec96aabf7b14d7b6"; $arrayTree[32] = "d727b5b8ffaeadbac75123801c270fd65f19251ce39a9141fd9ce9426e88f30b6f245fdbb8f887a585fe053baa7ccf469c440a7dd98381228a0c52c36199634d410d0c91fd6ff99af9eabd5a1c7911de"; $arrayTree[33] = "af594de7d539519445013b7c87f02edbf3c44653b6eb6dab75d092f4be345925ccbf87ff1e17fc312163ca6b0a608242712af82a81599f1f95c26dee"; $arrayTree[34] = "9d027b1c4068d81287c9170f4b291387f8327eb74c8fabdc24c2d8205db916a22e9459195833a272209526afab9e85b54e1832a820a7f578b7760af059d6926525e941edca99493b2b2a4f0a6efcb757c8b49b8e414a09ddb693c580ecdfa6793c845f9db207bea6c4833d90f6ee4e694ffb148c046b0eb36d72a84b3aefbd3766078ed17a19aebb0c4ae026b00207b8944520ea3817334615a7cdbf8214232a"; $arrayTree[35] = "d934f53af9bee26f35df7206dc06211778996986de2ecd02fd017b0311dbfe589b5faa7954ced1967d9752d09d3097fac748b6767472f9b69a65ed2e62630fe109b42747b4c53065ec96aabf7b14d7b6d727b5b8ffaeadbac75123801c270fd65f19251ce39a9141fd9ce9426e88f30b6f245fdbb8f887a585fe053baa7ccf469c440a7dd98381228a0c52c36199634d410d0c91fd6ff99af9eabd5a1c7911de"; $arrayTree[36] = "af594de7d539519445013b7c87f02edbf3c44653b6eb6dab75d092f4be345925ccbf87ff1e17fc312163ca6b0a608242712af82a81599f1f95c26dee"; $arrayTree[37] = "9d027b1c4068d81287c9170f4b291387f8327eb74c8fabdc24c2d8205db916a22e9459195833a272209526afab9e85b54e1832a820a7f578b7760af059d6926525e941edca99493b2b2a4f0a6efcb757c8b49b8e414a09ddb693c580ecdfa6793c845f9db207bea6c4833d90f6ee4e694ffb148c046b0eb36d72a84b3aefbd3766078ed17a19aebb0c4ae026b00207b8944520ea3817334615a7cdbf8214232ad934f53af9bee26f35df7206dc06211778996986de2ecd02fd017b0311dbfe589b5faa7954ced1967d9752d09d3097fac748b6767472f9b69a65ed2e62630fe109b42747b4c53065ec96aabf7b14d7b6d727b5b8ffaeadbac75123801c270fd65f19251ce39a9141fd9ce9426e88f30b6f245fdbb8f887a585fe053baa7ccf469c440a7dd98381228a0c52c36199634d410d0c91fd6ff99af9eabd5a1c7911de"; $arrayTree[38] = "af594de7d539519445013b7c87f02edbf3c44653b6eb6dab75d092f4be345925ccbf87ff1e17fc312163ca6b0a608242712af82a81599f1f95c26dee"; $arrayTree[39] = "9d027b1c4068d81287c9170f4b291387f8327eb74c8fabdc24c2d8205db916a22e9459195833a272209526afab9e85b54e1832a820a7f578b7760af059d6926525e941edca99493b2b2a4f0a6efcb757c8b49b8e414a09ddb693c580ecdfa6793c845f9db207bea6c4833d90f6ee4e694ffb148c046b0eb36d72a84b3aefbd3766078ed17a19aebb0c4ae026b00207b8944520ea3817334615a7cdbf8214232ad934f53af9bee26f35df7206dc06211778996986de2ecd02fd017b0311dbfe589b5faa7954ced1967d9752d09d3097fac748b6767472f9b69a65ed2e62630fe109b42747b4c53065ec96aabf7b14d7b6d727b5b8ffaeadbac75123801c270fd65f19251ce39a9141fd9ce9426e88f30b6f245fdbb8f887a585fe053baa7ccf469c440a7dd98381228a0c52c36199634d410d0c91fd6ff99af9eabd5a1c7911deaf594de7d539519445013b7c87f02edbf3c44653b6eb6dab75d092f4be345925ccbf87ff1e17fc312163ca6b0a608242712af82a81599f1f95c26dee"; $arrayTree[40] = "54u58rfhfheyrr4gfdtfvgw36tr36"; $arrayTree[41] = "54u58rfhfheyrr4gfdtfvgw36tr369d027b1c4068d81287c9170f4b291387f8327eb74c8fabdc24c2d8205db916a22e9459195833a272209526afab9e85b54e1832a820a7f578b7760af059d6926525e941edca99493b2b2a4f0a6efcb757c8b49b8e414a09ddb693c580ecdfa6793c845f9db207bea6c4833d90f6ee4e694ffb148c046b0eb36d72a84b3aefbd3766078ed17a19aebb0c4ae026b00207b8944520ea3817334615a7cdbf8214232ad934f53af9bee26f35df7206dc06211778996986de2ecd02fd017b0311dbfe589b5faa7954ced1967d9752d09d3097fac748b6767472f9b69a65ed2e62630fe109b42747b4c53065ec96aabf7b14d7b6d727b5b8ffaeadbac75123801c270fd65f19251ce39a9141fd9ce9426e88f30b6f245fdbb8f887a585fe053baa7ccf469c440a7dd98381228a0c52c36199634d410d0c91fd6ff99af9eabd5a1c7911deaf594de7d539519445013b7c87f02edbf3c44653b6eb6dab75d092f4be345925ccbf87ff1e17fc312163ca6b0a608242712af82a81599f1f95c26dee"; $arrayDocs = array(); $arrayDocs[0] = "9d027b1c4068d81287c9170f4b291387f8327eb7"; $arrayDocs[1] = "4c8fabdc24c2d8205db916a22e9459195833a272"; $arrayDocs[2] = "209526afab9e85b54e1832a820a7f578b7760af0"; $arrayDocs[3] = "59d6926525e941edca99493b2b2a4f0a6efcb757"; $arrayDocs[4] = "c8b49b8e414a09ddb693c580ecdfa6793c845f9d"; $arrayDocs[5] = "b207bea6c4833d90f6ee4e694ffb148c046b0eb3"; $arrayDocs[6] = "6d72a84b3aefbd3766078ed17a19aebb0c4ae026"; $arrayDocs[7] = "b00207b8944520ea3817334615a7cdbf8214232a"; $arrayDocs[8] = "d934f53af9bee26f35df7206dc06211778996986"; $arrayDocs[9] = "de2ecd02fd017b0311dbfe589b5faa7954ced196"; $arrayDocs[10] = "7d9752d09d3097fac748b6767472f9b69a65ed2e"; $arrayDocs[11] = "62630fe109b42747b4c53065ec96aabf7b14d7b6"; $arrayDocs[12] = "d727b5b8ffaeadbac75123801c270fd65f19251c"; $arrayDocs[13] = "e39a9141fd9ce9426e88f30b6f245fdbb8f887a5"; $arrayDocs[14] = "85fe053baa7ccf469c440a7dd98381228a0c52c3"; $arrayDocs[15] = "6199634d410d0c91fd6ff99af9eabd5a1c7911de"; $arrayDocs[16] = "af594de7d539519445013b7c87f02edbf3c44653"; $arrayDocs[17] = "b6eb6dab75d092f4be345925ccbf87ff1e17fc31"; $arrayDocs[18] = "2163ca6b0a608242712af82a81599f1f95c26dee"; foreach($arrayDocs as $doc) { $bitIndex = computeWalk($arrayTree, $doc); echo "<br/>"; print_r($bitIndex); echo "<br/>"; } function computeWalk($array, $needle) { $result = array(); for ($i = 0; $i < count($array) - 1; $i++) { if (false !== strpos($array[$i], $needle)) { echo " I = ".$i; if ($i % 2 == 0) { $result[] = getItemIndex($array[$i + 1], $array); } else { $result[] = getItemIndex($array[$i - 1], $array); } } } return $result; } function getItemIndex($item, $array) { $myPosition=-1; for ($i = 0; $i<count($array)-1; $i++) { if($array[$i]==$item) { $myPosition = $i; break; } } return $myPosition; } ?> Hi there, I'm working on PHP webform and I have a variable called $weightInfo which has the value 5000|6000 Now I have a list of Arrays and I would like to see if our variable value (i.e 5000|6000) is in that list of Array: Here is the ArrayList: $WeightArray = array('' => '', '0|100' => '100g or Less', '101|250' => '101g to 250g', '251|500' => '251g to 500g', '501|1000' => '501g to 1kg', '1000|2000' => '1kg to 2kg', '2000|3000' => '2kg to 3kg', '3000|4000' => '3kg to 4kg', '4000|5000' => '4kg to 5kg', '5000|6000' => '5kg to 6kg', '6000|7000' => '6kg to 7kg', '7000|8000' => '7kg to 8kg', '8000|9000' => '8kg to 9kg', '9000|10000' => '9kg to 10kg', 'customValues' => 'Custom Values' ); Now as we can see, in this ArrayList, there is that value 5000|6000. How do we find this through code, do we need some kind of looping or how do we check it. Kindly reply. Thank you Hello friends, i'm coding simple free script for articles but i need to know which url should be better 1- at this way article_title_words (sperated by _ ) 2- at this way article-title-words (sperated by - ) 3- at this way article+title+words (sperated by + ) which is better for searching engines ? thanks everybody Dear All, Greetings! I am a student and have a final semester project of making a php based form to search a database. Database is already created: Username: test password: test1 Details: DB Name: resume_bank, Table Name: Candidate Table contents: Name, Phone, Address, DOB, Gender, Designation, experience_yrs, experience_months, Employment_Status I need the code which would give the user an option to search using AND, OR, ALL functions. Friends please help. The form should look like: Enter the Designation you are looking for: Enter the experience: Yrs___ Months___ Select Gender: The result must come in another webpage which has numbered display results, like page-1, page-2, page3... PLEASE HELP URGENTLY!!!!!!! ANY BODY HAS READY MADE CODE PLEASE SEND IT!!!!!! Thanks. I was kind of looking for a little direction, I have scoured the internet and exhausted every other resource I could think of before coming here... Does anyone know of any classes or resources that have some solid explanation or can give an explanation on how to go about searching within a PDF file?? I have literally beren trying to figure it out for over a year...I need to wrap this up it is consuming my life. All help is greatly appreciated, thanks in advance hey guys, im new to all this php stuff. I have a project in this semester to create an HR contract system for the university, here are my requirements: 1. Add Contracts 2. Delete Contracts 3. Edit Contracts 4. View Contracts 5. Search Contracts i have done all the 4 options but now im stuck in the 5th option. i have to use checkboxes filters for search and first and the last name fields. here is my form code <form method="post" action="searchCode.php"> First Name: <input name="name" type="text" id="name" /> Middle Name: <input name="mname" id="mname" type="text" /> Last Name: <input name="lname" id="lname" type="text" /> Date: <input type="text" name="date" id="currentdate" /> <input type="checkbox" name="gender[]" value="male" />Male<br /> <input type="checkbox" name="gender[]" value="female" />Female <input name="desig[]" type="checkbox" value="lecturar"/>Lecturar <input type="checkbox" name="desig[]" value="professor" />Professor <input type="checkbox" name="desig[]" value="assistantProfessor" />Assistant Professor <input type="checkbox" name="desig[]" value="associateProfessor" />Associate Professor <input type="checkbox" name="desig[]" value="researchAssociate" />Research Associate<br /> <input type="checkbox" name="desig[]" value="advisor" />Advisor <input type="checkbox" name="desig[]" value="HOD" </span> <input name="dept[]" type="checkbox" value="Comuter Science" />Computer Science <input type="checkbox" name="dept[]" value="Health Informatics Unit" />Health Informatics Unit <input name="dept[]" type="checkbox" value="Electrical Engineering" />Electrical Engineering <input type="checkbox" name="dept[]" value="Management Sciences" />Management Sciences<br /> <input type="checkbox" name="dept[]" value="Mathamatics" />Mathamatics <input type="checkbox" name="dept[]" value="Physics" />Physics <input type="checkbox" name="dept[]" value="Bio Sciences" />Bio Sciences <input type="checkbox" name="dept[]" value="Meteorology" />Meteorology <input type="checkbox" name="dept[]" value="Architecture" />Architecture <input name="scales[]" type="checkbox" value="sg1" />SG-I <input name="scales[]" type="checkbox" value="sg2" />SG-II <input name="scales[]" type="checkbox" value="sg3" />SG-III <input name="scales[]" type="checkbox" value="sg4" />SG-IV <input name="scales[]" type="checkbox" value="ras" />RA <input name="scales[]" type="checkbox" value="og1nphd" />OG-I- <input name="scales[]" type="checkbox" value="og2nphd" />OG-II-NonPhd <input name="scales[]" type="checkbox" value="og3nphd" />OG-III-NonPhd <input name="scales[]" type="checkbox" value="og4nphd" />OG-IV-NonPhd <input name="scales[]" type="checkbox" value="og2phd" />OG-II-Phd <input name="scales[]" type="checkbox" value="og3phd" />OG-III-Phd <input name="scales[]" type="checkbox" value="og4phd" />OG-IV-Phd</p> now i cant seem to get it in my mind tht how the hell im going to do tht...shud i use ifs and elses, in tht case it can get upto 256 combinations. and 1 more thing all these things are in one table....please gyus help me I am trying to perform a search but it doesn't see to pass through i thing its because of this \ does any one know how i can pass this trought to search in mysql table 12\019PB (i cant search this item) Code: [Select] $searchlading = mysql_real_escape_string($_GET['searchlading']) ; // get the query for the search engine (if applicable) $trimmed = trim($searchlading); //trim whitespace from the stored variable //query for pedimento $sql_ped = "SELECT order_id, bill_of_lading, pedimento_num FROM `".TABLE_ORDERS."` WHERE bill_of_lading LIKE '%$trimmed%'"; I don't mean to bother you with silly questions, but I must be using the wrong search terms to find any viable answers to this. Hypothetical situation: I have a table [Customers] with with an auto-increment id, customer_name and email generated from a form. Now, I decide to expand my database to include customer-address and telephone number. I decide to create a second table named Contactinfo for this purpose (assuming this is a better database practice). As Customerinfo is generated, I want it to POST in association with the respective customer (assuming that 'id' is the best field for association). I need some examples and best practices to accomplish this. Examples, links, or preferred terminology would be great so I can attack this phase. Thanks. Hi, I was wondering what would be a good way to search through html for specific tags using php so that I can insert some other html in to that? I have used some parsing of an html that was converted in to a string, but the way I did it might not be fully efficient lol So i was wondering how everyone else would go about this? I don't need a complete in depth description but at least a pointer to what i could do that way i can just search for it on my own. I have a text string and I need to find the value that appears after a certain value: Value that appears after "XXX:" "Test 123 Hello XXX: 1 Test 555"; So the value would be "1" Any ideas? <?php $string = "aStringwith SomeSpecialChars+^$%"; // want to check if there is "+" in it if( ????? ($string,'+') { echo "yes string has plus sign"; } ?> Which function should I use to search in a string ? Hey, Looking to find a solution to something. I have been experimenting making a template engine for a website I am building. How can I search a variable for all occurrences of {VARIABLE} eg. {Username} {Title} {Content} so I can str_replace them. Thank you |