Jump to content

Jocka

Members
  • Posts

    344
  • Joined

  • Last visited

Everything posted by Jocka

  1. I'm assuming this page is called "form1.php" if you're planning to show this information on the same page. If that is the case, try below: <!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" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Clasen - Simple HTML Form1</title> </head> <body> <form action="/Chapter2/form1.php" method="post"> <fieldset><legend>Enter a number below:</legend> <p><b>Number:</b> <input type="text" name="inputNum" size="10" maxlength="10" /></p> </fieldset> <div><input type="submit" name="submit" value="Submit" /> </form> <?php if(isset($_POST['inputNum'])){ $number = $_POST['inputNum']; if($number < 10){ echo "The number is smaller than 10"; } else if($number < 10 && $number is > 100){ echo "The number is between 10 and 100"; } else if($number > 100){ echo "The number is larger than 100"; } } ?> </body> </html> Otherwise i suppose if form1.php is on another page, just use the same info I added, on the page.
  2. from what I see all you need to do is either pass the random number through the form (probably a bad idea for security reasons it would basically be pointless) or you could save it in a session. Then before the QUERYS do a check to see if the form was submitted and if the number exists in the session, then compare against that. I can tell I'm not seeing all of your code so I'm assuming this is your issue.
  3. $number = '1'; // THIS BEING YOUR NUMBER, I'M JUST MAKING ONE UP if($number < 10){ echo "The number is smaller than 10"; } else if($number < 10 && $number is > 100){ echo "The number is between 10 and 100"; } else if($number > 100){ echo "The number is larger than 100"; }
  4. Well is the header page that is included, a php file? If so just do something like <title><? echo $title; ?></title> then before including it just set the title: $title = "SITENAME - Pagename"; etc, u get the point.
  5. let's assume the table is called "bar_table" (you didn't say) This should do it: $query = mysql_query("SELECT ". $_GET['day'] . " FROM bar_table WHERE id='".$_GET['id']."'"); Seems to be what your looking for. of course I'd be more secure with the query but thats the basic idea.
  6. if($mail){ header("Location: thank_you.php?action=feedback"); exit(); } A: Once u navigate away i would assume the foreach loop stops B: Exit ends the foreach loop
  7. If there is more than one name submitted, then I want it to check against name1 AND name2 Yea, if more than one name is given, i want to compare against both names.
  8. If there is more than one name submitted, then I want it to check against name1 AND name2 .. what I've decided to do for now is to just throw that extra soundex_code at the end of my "names" table. I just add the code like S500 or N329 or whatever together "S500N329". Now I compare for an absolute match first, then follow that with a search on the soundex codes with this: "soundex_code LIKE '%$name1%' && soundex_code LIKE '%$name2%' . This way i can at least get similar outputs.
  9. just to get the idea if i didn't explain it right. the table is like this: name_soundex ----------------------------- name_id - soundex_id - soundex_code 1 1 N500 1 2 N500 so when I search I would join the name_id's that are similiar so that I can somehow just search as one row and be able to find "name1" and "name2" for a better result
  10. Ok I have a table that holds the soundex codes for names. the table has name_id, soundex_id, soundex_code the name id has the name id of course, soundex id holds any additional parts of the name (middle, last, whatever). what I'm trying to do is find BOTH soundex codes if possible. Of course this doesn't work: SELECT name_id FROM name_soundex WHERE soundex_code = SOUNDEX('name1') && soundex_code = SOUNDEX('name2') Because these have 2 seperate soundex_id's. So what I need to do is maybe join anything with the same name_id ??? Sorry I'm terrible with mysql. Plz help.
  11. i'd use file_get_contents ( http://php.net/manual/en/ref.filesystem ) to get the info CRON JOB to run it every so often. Google both, it's a lot to explain so I won't go thru it all.
  12. I assume something like $query = mysql_query("SELECT * FROM table WHERE level_access != '1'"); ????
  13. ::EDIT:: forget to end the if statement hmm... maybe $info = ''; while ($hunches = mysql_fetch_array($gethunches)) { if($info == ''){ $info .= "<span class=\"red\">" . $hunches['firstname'] . "</span>"; } else { $info .= "<br><span class=\"red\">" . $hunches['firstname'] . "</span>"; // ADDS THE BREAK } } // OUTSIDE OF WHILE STATEMENT $days1[$hunches['day']] = array(NULL,NULL, $info);
  14. hm.. well there are a couple of ways you could do it I believe. // TRY SOME OF THESE STEPS // CHANGE WHILE STATEMENT TO THIS while ($hunches = mysql_fetch_array($gethunches)) { $days1[] = $hunches['day']=>array(NULL,NULL,'<span class="red">' . $hunches['firstname'] . " " . $hunches['lastname'] . "-" . $hunches['dob'] . "--" . $hunches['sex'] . '</span>' ); } // OR ADD NUMBERS YOURSELF? $i = 0; while ($hunches = mysql_fetch_array($gethunches)) { $days1[$i] = $hunches['day']=>array(NULL,NULL,'<span class="red">' . $hunches['firstname'] . " " . $hunches['lastname'] . "-" . $hunches['dob'] . "--" . $hunches['sex'] . '</span>' ); $i++; }
  15. $SomeVar = $_POST['finco']; if(mysql_query("UPDATE adxone SET trace='$address' WHERE username = '".$SomeVar."'")){ echo "first message"; } $SomeVar = $_POST['finco']; if(mysql_query("UPDATE adxone SET trace='$address' WHERE username = '".$SomeVar."'")){ echo "second message"; } ?
  16. hmm.. ok .. maybe a for statement... for($i = 0; $i <= 8; $i++){ $filename = './aircraft/' . $rowX['reg'] . $i .'.jpg'; if(file_exists($filename){ echo "<img src=\"" . $filename . "\" /><br />"; } else { echo "><img src=\"aircraft/wrightflyer.jpg\" /><br />"; } } This way you run thru all 0-8 occurences and can check each individual file without going thru the glob array.
  17. I'm not very familiar with "glob" but after looking at it, it only finds files that EXISTS so you will never run into a file that doesn't exist. try this ?: $files = glob('./aircraft/' . $rowX['reg'] . '[0-8].jpg') or array(); foreach($files as $file){ if (!empty($file)) { // GLOB already determined the file exists, check if array is empty echo "<img src=\"" . $file . "\" /><br />"; } else { echo "><img src=\"aircraft/wrightflyer.jpg\" /><br />";} }
  18. I suggest just looking at random tutorials and using Google a lot. I've learned most of what I know thru those methods lol. It's hard to learn everything with PHP if you don't use everything in PHP. There is a lot I don't know but the basics become easier to remember as u use it.
  19. change this: $lastfm_info = substr($lastfm_info[0], 0, -4) . " - " . $lastfm_info[1]; to this: $lastfm_info = substr($lastfm_info[0], 0, -4) . " - " . $lastfm_info[1] . "\r\n";
  20. ok I fought with this thing for a while. the encoding is messed up it appears and i can't figure out how to work with that. But i did find a work around.. SO Here is the new code: $lastfm[] = file_get_contents("http://www.last.fm/user/joffeman"); $lastfm[] = file_get_contents("http://www.last.fm/user/chaos2092"); foreach($lastfm as $value){ preg_match("/<meta name=\"description\" content=\"Listen to (.*?)\)./", $value, $matches); $lastfm_info = explode(" personal radio station (", $matches[1]); $lastfm_info = substr($lastfm_info[0], 0, -4) . " - " . $lastfm_info[1]; echo $lastfm_info; $filename = "lastfm.txt"; $b = fopen($filename, 'a'); // NEEDS TO BE 'a' FOR APPEND fwrite($b, $lastfm_info); fclose($b); } sleep(10000);
  21. it wasn't taking out that extra stuff in it. sorry i forgot to correct some stuff in the code.. and as far is it repeating the info, its because you are saving the $matches[$a] .. replace all your for loop with this.. i'm sorry i keep giving u bad code lol. but this should work. i looked it over. foreach($lastfm as $value){ echo $value; $lastfm_info = preg_match("/<meta name=\"description\" content=\"Listen to (.*?)\)./", $value, $matches); $lastfm_info = str_replace("’s personal radio station (", " - ", $matches[0]); $filename = "lastfm.txt"; $b = fopen($filename, 'w'); fwrite($b, $lastfm_info]); fclose($b); }
  22. This in your "for" loop should do the trick. I'm not sure if you ONLY wanted to save the username and plays in the text file?? $lastfm_info = preg_match("/<meta name=\"description\" content=\"Listen to (.*?)\)./", $lastfm[$a], $matches); $lastfm_info = $matches[1]; $lastfm_info = str_replace(" personal radio station (", " - ", $play_span);
  23. http://ca3.php.net/manual/en/function.eval.php Ur best bet on this.
×
×
  • 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.