PHP - Php Word Search Generator
Hi there,
I'm learning PHP and decided that I'll try to create a word search generator for my own use. I know there are hundreds of them out there but it's just for learning purposes. I'd like to enter a number of words and then the script should generate a pdf containing a box filled with random letters (among which there will be my words). My question is what keywords/functions should I look at to get started? I'm a php beginner but would like to make my learning more interesting by doing this project. The form with words should be easy, it's the next bit where it's supposed to generate a pdf containing words that I have no idea about. thank you Similar TutorialsHello, Does anyone know a tutorial I can follow to create my own search engine over the items I have in my SQL database? I find a lot of tutorials but they are all 'one word searches' which means if you type two words you will get all results that contain either word (too many hits). If the search engine tutorial displays result with AJAX even better. Thanks for help. df I am trying to find the last word before a search pattern. I tried preg_match without any luck. I found something close online but it does a match for the first match for the pattern. I know that I will always see , some # pressure. I want that # right before the word pressure but there are a lot of , in the page. Thanks in advance. Code: [Select] function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } $fullstring = "today, Sat, 750 pressure"; $parsed = get_string_between($fullstring, ", ", "pressure"); Hey All, I'm trying to add multiple word search to my site and I'm getting the following error: "mysql_num_rows(): supplied argument is not a valid MySQL result resource " I know, my search is posting because I'm getting my search terms back with the "nothing found" message I have set up. Here's what I have: Code: [Select] $search = $_POST["search"]; $arraySearch = explode(" ", $search); $arrayFields = array(0 => "title", 1 => "content"); $countSearch = count($arraySearch); $a = 0; $b = 0; $query = "SELECT * FROM table1 WHERE desc LIKE '$arraySearch'"; $countFields = count($arrayFields); while ($a < $countFields) { while ($b < $countSearch) { $query = $query."$arrayFields[$a] LIKE '%$arraySearch[$b]%'"; $b++; if ($b < $countSearch) { $query = $query." AND "; } } $b = 0; $a++; if ($a < $countFields) { $query = $query.") OR ("; } } $query = $query.")"; $query_result = mysql_query($query); if(mysql_num_rows($query_result) < 1) { echo '<p>No matches found for "'.$search.'"</p>'; } else { Print "<table border cellpadding=3>"; while($row = mysql_fetch_assoc($query_result)) { Print "<th>Description:</th> <td>".$row['desc']. "</td> "; } Print "</table> "; } You guys are the best, thanks so much. hi all, in mysql, how can i extract 100 words before and 100 words after my search key? example: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est nibh, mattis eu mattis id, pulvinar eu augue. Duis ut sem nisi. Sed id ante sed orci vestibulum lacinia ac id nibh. Donec cursus, elit eget auctor semper, ipsum eros laoreet quam, nec ullamcorper" vestibulum is my search key i am having the database consists of morethan one lac rows. we have a search option in our website to search the database for required information. the present code is like this: form.php `<input type="radio" name="tag" value="city" /> CITY <br/>` `<input type="radio" name="tag" value="name" /> NAME OF CUSTOMER <br/>` `<input type="radio" name="tag" value="amount" /> CHEQUE AMOUNT <br/>` `<input type="radio" name="tag" value="somethingelse" /> some thing else ` `Enter the part of any of the above Here :<input type="text" name="value" />` search.php `$tag = $_POST['tag'];` `$value = $_POST['value'];` `$query = "SELECT * FROM database WHERE $tag LIKE '%$value%' "` note: we always input the part field only. with this some times the output comes in thousands of rows. with which we are facing problems. we want to search the two or more fields for getting more precise results. hence i tried this form: `<h3 align="center">ENTER ALL OR DESIRED ITEMS YOU WANT TO SEARCH</h3>` `<div width="80%" align="center">` `<input type="text" name="city" /> CITY <br/>` `<input type="text" name="name" /> NAME OF THE CUSTOMER <br/>` `<input type="text" name="amount" /> AMOUNT <br/>` `<input type="text" name="somethingelse" /> SOME OTHER SEARCH FIELD </div> ` `$query = "SELECT * FROM database WHERE city LIKE %$city%' || name LIKE %$name%' || amount LIKE %$amount%' || somethingelse LIKE %$somethingelse%';` it worked in the mysql console, and even in our website when we give all the variables. but it displaying the entire database when we dont give even one field in the search box. i tried to assign NULL to the variable which was not given. it is also not worked. it works if any variable is replaced with NULL in the query. i don't know how to do that. i tried a lot of queries after searching in lot of code provider websites. but none of them gave the desired results.hence i request you to provide me a sql query code for search the database using all of the above fields or any two or even with one. the code must work independent of number of fields we entered. I need help with creating a page like this:
http://www.flashvort...p?exampleId=219
So that we can offer our clients the opportunity to edit their flash banners.
http://www.degngrafi.../web/Flash.aspx
The generator should be located on our webpage.
Purchase option is not needed as our clients will have this tool offered for free.
Hello I am using a script I found on the internet to create PNG images of text into a font on the server. My problem is that I can't seem to make the font bold. Can someone please let me know how to do this? I would really appreciate the help. Here is a snippet of the code that I believe needs modifying: <?php $background_rgb = hex_to_rgb($background_color) ; $font_rgb = hex_to_rgb($font_color) ; $dip = get_dip($font_file,$font_size) ; $box = @ImageTTFBBox($font_size,0,$font_file,$text) ; $image = @ImageCreate(abs($box[2]-$box[0]),abs($box[5]-$dip)) ; ?> Many thanks. Hello there! I'm looking for a script that generates website screenshots. I want to use a script on my server bcz, i think, it will work faster than use services like webshotspro.com or any other, and have no restriction on size. I need a script that can cache the screenshot and refresh it every 2 weeks for example. Hope that you can help me on this. Thank you in advance! This works if say I do 192.168.0.1 - 192.168.1.254 it will work. However doing 192.168.0.1 - 192.168.1.10 will only generate up to .10 on both IP schemes. I see why, but I cannot figure out a way around this... Thanks! $start = explode('.', '192.168.10.1'); $end = explode('.', '192.168.11.10'); /** * Final output... */ $a = 0; $b = 0; $c = 0; $d = 0; // First segment for ($a = $start[0]; $a < 1 + $end[0]; $a++) { // Second segment for ($b = $start[1]; $b < 1 + $end[1]; $b++) { // Third segment for ($c = $start[2]; $c < 1 + $end[2]; $c++) { // Fourth segment for ($d = $start[3]; $d < 1 + $end[3]; $d++) { echo "{$a}.{$b}.{$c}.{$d}<br />"; } } } } I am having some issues with getting dates for the days of the week based on one date givin Example: User enters date for sunday. (Ending pay period) and I wish to get the dates for that week. Mon - 1-2-2012 Tue - 1-3-2012 Wed - 1-4-2012 Thu - 1-5-2012 Fri - 1-6-2012 Sat - 1-7-2012 Sun - 1-8-2012 User would enter 1/8/2012 and the script would get the rest of the dates to enter into the timecard. I have tried both ways below and cant get it to work no mater if i change the user input date i still get the same output. Function getdatepast($dtp,$cnt) { $undatecon = mktime($dtp); $undatecon2 = strtotime("-".$cnt." day", $undatecon); $ddt1 = date('m-d-Y',($undatecon2)); return $ddt1; } Function getdatepast($dtp,$cnt) { $undatecon = mktime($dtp); $undatecon2 = $undatecon - (86400 * ($cnt)); $ddt1 = date('m-d-Y',($undatecon2)); return $ddt1; } Had a crack at making my own generator which makes some jumble 32 characters long with letters and numbers. In logic it seemed fine to me. It practice it just does nothing. function generate(){ $abc = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"); $num = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $result = ""; for ($i = 0; $i < 32; $i++){ $bool = rand(0,1); if ($bool = 1) { $result . $abc[rand(0,25)]; } else { $result . $num[rand(0,9)]; } } echo $result; } Hello i am going to try out fpdf generator, but i wanted to know if anyone knows where i can get invoice templates or how would i go to create them. Could i create them with css and html? Hello everyone! I'm Abraham and I'm new here. I'm looking for a little help on making a password generator that can make passwords like this s7D9f3 - y2W4j6 - x1N5q8. I made one before but I lost the script can't seem to find it or remember how I did. The result pages is supposed to have pagination like google help me please
hi i want to make a script like http://www.greatdane.ru/eng/site/news/ and i dont have problem too add dogs but i want a auto news update after specific change like the link example : after add new dog or update dog or add image to a dog the link tell exactly what i want but also it has a feature that group added dogs and send a news any one have idea for make it? it is also so similar to facebook profile that after user do something page will auto update like : user change his cover Hello every one i am pretty new to PHP and here is what i am trying to accomplish: file1.csv has DECIMAL IP ADDRESSES range in the format of "202353920","202353951" "410129408","410129663" "410150912","410151167" "410178372","410178375" "410178560","410178815" I know how to read the numbers and place them in a text file by this code: All i am looking for is a code to generate that range between the first 2 fields for example 202353920 202353921 202353922 till 951 and then we move to the next line and do the same. I want the output to be to a file called range.txt. $row = 1; if (($handle = fopen("LONDON1.csv", "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); for ($c=0; $c < $num; $c++) { echo $data[$c]. "<br />\n"; } } this reads the all the fields .. but i dont know how to generate the sequance Part #2 is to get all these numbers and convert them from decimals to x.x.x.x hostnames ( that part i figured out already ) by the this code: function convert1($a){ $b=array(0,0,0,0); $c = 16777216.0; $a += 0.0; for ($i = 0; $i < 4; $i++) { $k = (int) ($a / $c); $a -= $c * $k; $b[$i]= $k; $c /=256.0; }; $d=join('.', $b); return($d); } But part #1 is where i am stuck ( to generate the numbers based on the given range. any help would be really appreciated. Hello, I am attempting to develop a simple php script which will generate a 4 letter sequence when a button is pressed. However the sequence has a few rules it has to follow. For example: the letters have to be A B C D E F G H J K L M P Q and R The second letter must be a letter AFTER the first The fourth letter must be a letter AFTER the third There can't be 2 of the same number. I am a bit confused on how I will do this as I am quite new to php, I though about generating the first as $1, then generating the second as $2, then if $1 > $2, then I would regenerate $2 until it wasn't. Then repeating that for $4. However I am not sure on the coding which would be involved in doing this. If someone could give me a few pointers or a link to a website which would help me it would be much appreciated. How can I do the following: 1. Upon successful login, generate a random 8-digit customer number and assign it to that customer and writes that data to mYsQl. 2. Screen then refreshes and reads, "Welcome Mr Smith". |