Jump to content

Readme

Members
  • Posts

    33
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Readme's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It come "crossword database". If you can, please help.
  2. How to make this: RED BOX IF I Search "Mobile" and choose 2 letters. Then result is Mobile LG IF 5 letters then Nokia Must use LEN or something? <?php mysql_connect("localhost", "", "") or die("Error connecting to database: ".mysql_error()); mysql_select_db("data") or die(mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Search results</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div class="container"> <form action="search.php" method="GET"> Search: <input type="text" name="query" /> <input type="submit" value="Search" /> </form> <div> <label>Search categories</label> <select> <option value="1">Search all</option> <option value="2">2 letters</option> <option value="4">3 letters</option> <option value="5">4 letters</option> <option value="6">5 letters</option> <option value="7">6 letters</option> </select> </div> <?php $query = $_GET['query']; $min_length = 2; if(strlen($query) >= $min_length){ $query = htmlspecialchars($query); $query = mysql_real_escape_string($query); $raw_results = mysql_query("SELECT * FROM articles WHERE (`title` LIKE '%".$query."%') OR (`text` LIKE '%".$query."%')") or die(mysql_error()); if(mysql_num_rows($raw_results) > 0){ while($results = mysql_fetch_array($raw_results)){ echo "<p><h3>".$results['title']."</h3>".$results['text']."</p>"; } } else{ echo "No results"; } } else{ echo "Minimum length is ".$min_length; } ?> </div> </body> </html>
  3. Hi! Who are the good people who make me a simple code?
  4. Not work or I make something wrong One checkbox coming up...
  5. This functions used select data but I want use <input type="checkbox"/> Please help to modify. //----------get country via select option---------- function get_country() { $sql = "SELECT id,country FROM countries ORDER BY id ASC"; $res = mysql_query($sql); echo "<select id=\"country\" class=\"searchbox\" name=\"country\">"; echo "<option value=\"\">Select One</option>"; while ($row = mysql_fetch_assoc($res)){ echo "<option value=\"".$row['country']."\">".$row['country']."</option>"; } echo "</select>"; } //----------get countries via select option from users---------- function get_select_countries($id) { $id = secureInput($id); $sql = "SELECT country FROM countries ORDER BY country ASC"; $res = mysql_query($sql); $sql1 = "SELECT country FROM users WHERE id='".$id."'"; $res1 = mysql_query($sql1); $row1 = mysql_fetch_assoc($res1); if($row1){ echo "<select name=\"country\">"; echo "<option selected=".$row1['country']." value=\"".$row1['country']."\">".$row1['country']."</option>"; while ($row = mysql_fetch_assoc($res)){ echo "<option value=\"".$row['country']."\">".$row['country']."</option>"; } echo "</select>"; } else { echo "<select name=\"country\">"; while ($row = mysql_fetch_assoc($res)){ echo "<option value=\"".$row['country']."\">".$row['country']."</option>"; } echo "</select>"; } }
  6. Work and thanks. But echo $data[0]."<br />".$data[2]."<br />"; Can make something like: echo ($data,0,2,8,100); ???
  7. I need PHP script I have test.txt file and content is: Cat Dog Bird PHP must find line 1 and line 3 and show up in browser. Cat Bird Eng not good but I hope you understand me. Very thanks.
  8. No, mraza. Example! textfile.txt - words I coming The file filename does not exist Tired of these ads? Not work but sample $replace = array("I coming","1 2 3"); $replace = array("The file filename does not exist","1 2 3 4"); $replace = array("Tired of these ads?","1 2 3 4 5"); textfile.txt - now looks like this 1 2 3 1 2 3 4 1 2 3 4 5
  9. My English is not good but I try to explain. Now i want to use array function... can be used for multiple lines. This: $new_contents = str_replace("My name is", "is name my", $contents); Something like this: $contents= array( array(My name is, is name my), array(Hi,Hello), array(Come back, I coming)); <?php $file = 'textfile.txt'; if (file_exists($file)) { $ff = fopen($file, 'r+'); $contents = file_get_contents($file, FILE_TEXT); $new_contents = str_replace("My name is", "is name my", $contents); file_put_contents($file, $new_contents, FILE_TEXT); fclose($ff); $ff = fopen($file, 'r+'); fwrite($ff, $new_contents); fclose($ff); } else { echo "The file $filename does not exist"; } ?>
  10. Takes the data from the file (.txt) and replace it - Saving changes? I searched the forum but did not find Bad code and slow <?php $string = 'My name is'; $patterns = 'My name is'; $replacements = 'is name my'; echo str_replace($patterns, $replacements, $string ); ?>
  11. I do not know how to explain - My English is not good Someone who understands, can explain.
  12. Pick 5 Wheels 1 Win(s), 3 out of 3, 11 Numbers (21 tickets) 11 Numbers Covered 1 Winning Ticket 3 Win Guarantee 3 Amount of Numbers Correct 21 Tickets It is necessary to the code that generates the numbers? Bad English
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.