Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Making a dynamic website, such as this forum or a blog (wordpress) or an online text-game plus many other types of websites. PHP is good for pretty much any type of website you want to make that is dynamic. The best part of PHP is you do not have to pay for it to run as Apache is free, PHP is free and Linux is free. You do, however, have to pay for the space (harddrive space) and the bandwidth for the website. But as far as software is concerned the cost is very low, which is what makes PHP/Apache very attractive.
  2. It was just a rough example. Basically it is a way to execute different code on the same page. It does not "have" to be setup that way. What I am getting at, is after your code processes from the submit button do an immediate header redirect and it should take care of the going back and re-posting the data.
  3. premiso

    More

    $result = mysql_query($query) or die("SQL Used: {$query} <br />ERROR WAS: " . mysql_error()); See if there is an error in the sql then.
  4. premiso

    More

    If those if/elseif reaches the else $query is empty and will not return any results. Change the else to this: else{$query = null;} if (!is_null($query)) { $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo "{$row['dep_icao']}"; echo "{$row['arr_icao']}"; } } }
  5. mysql_query("UPDATE available SET deathknight='Available' WHERE id = '1'", $con) or die(mysql_error()); You were missing the , before $con in the mysql_query portion.
  6. Because you are exploding at <li> not at </ul>. If you notice there is a <li> before the <ul> which splits that into a new variable. Since there is not a <li> before </ul> it just keeps it with the last index line. EDIT: To avoid this you can use strip_tags on the string before you parse it: $row_rs_pwc['ProdFeatures'.$lang] = strip_tags($row_rs_pwc['ProdFeatures'.$lang], '<li>'); Granted you would want to array_shift the first element off as it probably will contain a blank space.
  7. Why not, and this is just out on a limb, put the form input names in an array: $inputs = array('city', 'state', 'county'); Then do a loop through that array: foreach ($inputs as $key) { $_REQUEST[$key] = trim($_REQUEST[$key]); $$key = isset($_REQUEST[$key])?mysql_real_escape_string($_REQUEST[$key]):null; } However, I would just use the array version and not do a variables variable to define the value. But that is me. As far as variable context, if that is not incorperated I doubt it would/should be. As it is easily done with a loop as seen above without having to do the $:variable for each variable you want to use.
  8. The one, most important thing that is needed to survive. Which I did not see listed anywhere is knowledge. If you have no knowledge of a land and do not know what is edible, then well your chances of surviving are slim. If you have no knowledge of how to build a fire or purify water, your chances of surviving are slim. If you have no knowledge of how to catch food to eat, you probably will not survive. Ultimately, if you ask me, the only "need" you need to know to survive is knowledge. Knowing how to start that fire, how to find water, what to eat, where to seek shelter, how to build a shelter are all key without it you are lost without a hope to survive.
  9. You mean...your city does not require that all caskets be encased in Concrete to prevent Zombies from rising again....that is scary man.
  10. If you do a header redirect immediately after the form is submitted, it should wipe clean the data from POST. Something like this: <?php $action = isset($_GET['action'])?trim($_GET['action']):'index'; $action = strtolower($action); switch ($action) { case 'input': // enter data here header('Location: page.php?action=thanks'); break; case 'thanks': echo "Thank you for submitting data."; break; default: case 'index': echo 'Please fill out the form and click submit'; break; } ?> A simple example, but that should clear the post data for when a user clicks back.
  11. <?php if (isset($_POST['check1'])) { echo $_POST['check1'] . " check1 was checked <br />"; } if (isset($_POST['check2'])) { echo $_POST['check2'] . " check2 was checked <br />"; } echo <<<OUTPUT <form action="test.php" method="POST"> <input type="checkbox" name="check1" value="check1" /><br /> <input type="checkbox" name="check2" value="check2" /> <input type="submit" value="Submit" /> </form> OUTPUT; ?> Nope, isset works just fine as I suspected. Give it a shot.
  12. Given that he has been very vague, a vague answer is given. I am not to presume everything the OP wants just on assumption. You know what assuming does right? It makes an ass out of u and me. If he wants a better answer he needs to be more descriptive as to what he wants and show some code.
  13. if(!isset($_POST['terms-chk'])) Use isset. If a checked box is not checked is does not get passed to the page in the POST array. (At least I think that is how it works )
  14. nl2br is what I believe the OP is getting at. It converts the new line characters to the HTML <br> so when printed on a page it shows the new lines.
  15. premiso

    Session

    Make your session time limit 0 in the php.ini or via ini_set or .htaccess. As for when closing the window, set a cookie. Check if that cookie is valid the next time they come on, if they are consider them as being valid/logged in.
  16. Nope, the fly being down just takes the cake...to quote Billy Madison, "IT IS COOL TO PEE YOUR PANTS!"
  17. Yes it is. define('THIS', 1); class that { function that() { echo "THIS was : " . THIS; } } $that = new that(); Should echo out THIS was 1 once the class is instantiated. If THIS is not defined it would echo out THIS with a notice of an undefined constant. That is the point of a constant, it can be used anywhere within a script as long as it is defined before you try to use it.
  18. Pwned would be a more accurate term. (If that even is a term ??? )
  19. The new database does not "have" to be file host. But the problem is the same, you need a database to enter all that SQL into, and as such you do not have a database created/selected to use. In phpMyAdmin you should have a list of database on the left hand side, if you created one for this project select it then click on the import tab on the right and it should use that database.
  20. I own 6. I only use them for hunting and for sport shooting. 7mm (elk) .22 (misc) .243 (deer/coyotes) 2 x .30-30 (1 from each of my grandpas same model. Only 1 is in working condition). 12 guage pump Benelli (Turkey/rabbits/coyotes) My next rifle will most likely be a single shot .223 or a .22-250 and I may also get a pistol .45 cal for hiking (mt lions/bears in the area)/home protection. EDIT: All my guns are licensed, gotta stay legal. And I do not know many people who own an unlicensed gun. Most of the people who I hang out with also hunt and that is what their guns primary purpose is.
  21. Why would you want php running on an itouch or iphone... That would just bog them down when it runs...just curious as it seems more of a "yes I can do it" rather than "this is a great feature that I will use a lot".
  22. http://www.phpfreaks.com/tutorial/basic-pagination Take a look at the tutorial on pagination.
  23. It would be very un-reliable if they changed the way the data is displayed. As long as they keep the way it is displayed the same it works. But alast that is the problem with web-fetching. Unless he can find an RSS feed they provide, he could use that instead which should always stay the same. Given the site, I would doubt they would supply a web feed. To answer the OP's question, without an RSS feed, there is no other sure-cut way to do it, unless the page has an API for use which I doubt that either. The webfetch would be the best bet without the RSS feed or API.
  24. $sql = "SELECT * FROM user WHERE userid='" . mysql_escape_string($_POST['userid']) . "'"; $_SESSION['SESS_USERNAME'] = mysql_result($result, '0', 'username'); Syntax error, get a program that highlights your code and it will be easy to see (as it is plain as day in this forum).
  25. Generally you want to contact the website, but if the data is out there, you do not "need" permission. It is their fault for not "Securing" it from normal users. curl would be needed to fetch the data. Then you would need to parse the data with either explode or preg_replace A web fetch, which is what you want to do, are generally pretty easy and there is an abundant of information on it and other scripts that do similar that you can look at it to see exactly how it is done.
×
×
  • 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.