PHP - Searching Variable For { }
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 Similar TutorialsHello, I am working on a project and I cant seem to get this to work. I have a database (Kingsbury) that stores a contact list. I am trying to make an page were a user can search the database by state. The code from the HTML site is: Code: [Select] <form action = "sqlllist.php" method="post"><br /> Please enter the state you would like to search: <input type="text" name="state" /><br /> <p><input type="submit" value="Enter" /></p> </form> And then from the .php file Code: [Select] <?php $DBConnect = mysql_connect("*****", "*****", "********"); if ($DBConnect===FALSE) echo "<p>Connection Failed!.</p>\n"; else { $State == $_POST['state']; $Result = mysql_select_db("Kingsbury", $DBConnect); $queryresult = @mysql_query("SELECT * FROM contacts WHERE State = $State'", $DBConnect); echo "<table width='100%' border='1'>\n"; echo "<tr><th>User ID</th> <th>First Name</th> <th>Last Name</th> <th>Address</th> <th>State</th> <th>City</th> <th>Zip Code</th> <th>Area Code</th> <th>Phone Number</th>\n"; While (($Row = mysql_fetch_row($queryresult)) !== FALSE) { echo "<tr><td>{$Row[0]}</td>"; echo "<td>{$Row[1]}</td>"; echo "<td>{$Row[2]}</td>"; echo "<td>{$Row[3]}</td>"; echo "<td>{$Row[4]}</td>"; echo "<td>{$Row[5]}</td>"; echo "<td>{$Row[6]}</td>"; echo "<td>{$Row[7]}</td>"; echo "<td>{$Row[8]}</td>"; } echo "</table>\n"; mysql_free_result($queryresult); mysql_close($DBConnect); } ?> This, to me seems like it should be working, but it outputs the entire database. I have a form passing user's search term, ie name. $pname = mysql_real_escape_string($pname; Not sure on proper syntax to include this in my select statement. I also want it to return for partial string matched, like 'mik' for 'mike': $result = mysql_query( "SELECT * FROM guest WHERE name like '$pname'" ); 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'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> 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'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? 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; } ?> I am working on a poject, where the search functions doesnt work as the user wishes. The coding is technically correct, but the idea behind it is wrong. Basically at the moment, the script receives this: thesite.com/search.php?q=xxxx&Submit=Search The search script then runs a database query to search the tag coloumn, looking for like $q. This would work, however the structure of the coloumn is tag1, tag2, tag3, tag4. So my resolutions is this so far: I explode the $q variable, via the + (if you search more than one term "thesite.com/search.php?q=search+stuff&Submit=Search" I then count the elements in the array and write the database function accordingly Code: [Select] $var = @$_GET['q'] ; $trimmed = trim($var); $searchpieces = explode("+", $trimmed); $dbquery=""; $count = count($searchpieces); for ($i = 0; $i < $count; $i++) { if($i == 0){$dbquery.="tags = $searchpieces[$i]";} elseif($i > 0){$dbquery.=" OR tags = $searchpieces[$i]";} } So my database query is $sql = "select * from gallery where $dbquery order by date DESC " . $limit; so my question is this.. how to i eplode the tags database coloumn, so my datase query an look at each tag fro "tag1, tag2, tag3" as "tag1" "tag2" "tag3" I am not even sure if this is possible, but its the system that is already in place. The problem with the current system, is because the pictures have alot of tags and the database query is $like $q, it just shows all images in the database as the result Hi, as a newbee i'm trying to figure this code out: $search = get_the_title(); $lines = file('links.txt'); // Store true when the text is found $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line,"<br/>"; } } // If the text was not found, show a message if(!$found) { echo 'not found'; links.txt file contains links like: <a href="https://blabla.com/blablabla/blablablabla/The word or file to search" target="_blank" rel="noopener noreferrer">The word or file to search</a> I just want to search the this part: ( ">The word or file to search</a> ) of the url then return it as an clickable url and also limit search results to 3. Could somebody help me which code and where to put in php code above? Thanks in advance. 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>"; } I need to do some searching through PDF or Doc files, whichever will be more efficient. All the files will be in one folder, and I've written a script that will let me search the file names just fine. Each file though, has a header, with the actual title of of the document, since sometimes the file names are abbreviated. How would I search through the document (only the header) and return the matching results? If you need a sample document, let me know. 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. 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 Hi everyone,
I've got a simple script that is searching for the results of running races in a database.
Searching for a finisher's position works perfectly with this script:
$position = $_POST['position']; $pos_operator = $_POST['pos_operator']; if ($pos_operator == '=' && $position != '' ) { $where .= " AND position='$position'"; } if ($pos_operator == '<' && $position != '' ) { $where .= " AND position<'$position'"; }$position refers to a text field in the form where the user can type in a digit. $pos_operator refers to a text field in the form where a user can select = or < However, when I try to do a similar thing with time, I'm not getting the expected results. $time_stated = strtotime($_POST['time_stated']); if ($time_stated != '' ) { $where .= " AND time < '$time_stated'"; }$time_stated refers to a text field where the user is asked to look for a time less than the time they input in xx:xx:xx format. I tried this with and without the strtotime Any tips? Cheers, Dave 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 ? 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%'"; 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 |