Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Umm, because if I enter the password TEST it will show a 404. If I enter anything but TEST it echos the name.
  2. Well, you technically don't need the quotes around it if its just a variable. That won't cause the problem... just a side thing. Are you sure the database values are the same as the form names - Echo them to see! Try running the following, it will give you all your data names and will show you why they aren't matching up: while ($row_categories = mysql_fetch_assoc($categories)) { $tmp = $row_categories['id']; if(isset($_POST[$tmp])) { echo $_POST[$tmp],'<br>'; } else { echo 'Failed on: ',$tmp,'<br>'; } } echo '<pre>'; print_r($_POST); echo '</pre>';
  3. Make sure you aren't echo'ing anything before this, but the following will force a browser to think it is a non-existent page (404 error) header("HTTP/1.0 404 Not Found"); exit; a side note: this will force a browser specific 404 (each browser's 404 error page will look different) - if you want to provide a custom 404 look (a default 404 for your whole site) you need to include/print the page before the exit call
  4. Just how you originally stated it in the beginning $array[0]['SAT'] or $array[1]['MCAT']
  5. in_array() looks for array values, not keys. Instead, you should use array_key_exists, or use isset like I did. Also, @OP: You probable want to do something like: $action = strtolower($_GET['action']); to make sure they match up since it is case sensitive. That way if a user puts script.php?action=TOS it still goes to the tos page.
  6. Why not just do like: // Setup an array with the pages and their names $titleArray = array('forum'=>'Forum', 'tos'=>'Terms of Service'); // if there is a page in the array with the one in the url if(isset($titleArray[$_GET['action']])) { // use the one in the array $title = $titleArray[$_GET['action']]; } else { // otherwise use a default $title = 'Home'; }
  7. More specifically, using TIMEDIFF would give back not only days, but hours/minutes/seconds as well.
  8. By using LIMIT with an offset: SELECT name FROM table ORDER BY name ASC LIMIT 2, 1 or: SELECT name FROM table ORDER BY name ASC LIMIT 1 OFFSET 2 Same thing.
  9. Yes - but the numbers I pulled are from what would be considered competition for another photo host (e.g. photobucket, imageshack)
  10. Instead of using a logical OR (||), you should use AND (&&). Right now you're saying: That will always return true if the length is over 60 - thus always executing that code.
  11. If you have an "unlimited" plan, chances are they are going to have something in their ToS against a "hosting" service. But I'd say max size would be anywhere from 1.5-2MB. That's reasonable.
  12. <pre><?php // Test array2: $array = array( 'fieldOne' => array( 'row1' => 'cheese', 'row2' => 'red', 'row3' => 'rain', ), 'fieldTwo' => array( 'row1' => 'beans', 'row2' => 'blue', 'row3' => 'snow', ), ); // actual script: foreach($array as $key=>$sub) { $i = 0; foreach($sub as $value) { $final[$i][$key] = $value; $i++; } } // end // print results: print_r($array); print_r($final); ?></pre> Outputs: Array ( [fieldOne] => Array ( [row1] => cheese [row2] => red [row3] => rain ) [fieldTwo] => Array ( [row1] => beans [row2] => blue [row3] => snow ) ) Array ( [0] => Array ( [fieldOne] => cheese [fieldTwo] => beans ) [1] => Array ( [fieldOne] => red [fieldTwo] => blue ) [2] => Array ( [fieldOne] => rain [fieldTwo] => snow ) )
  13. <?php { ?> at the end, the curly bracket is facing the wrong direction.... <?php //adder.php if (isset($_POST['num1'])) { $num1 = $_POST['num1']; $num2 = $_POST['num2']; $myTotal -= $num1 + $num2; print "<h2 align=center>You added <font color=blue>". $num1 ."</font> and "; print "<font color=blue>" . $num2 . "</font> and the answer is <font color=red>" . $myTotal ."</font>!"; unset($_POST['num1']); unset($_POST['num2']); print "<br /><a href=" . $_SERVER['PHP_SELF'] . ">Reset page</a>"; }else{ ?> <html> <body> <h1 align="center">Adder.php</h1> <form action="<?php print $_SERVER['PHP_SELF']; ?>"> Enter the first number:<input type="text" name="num1"><br /> Enter the second number:<input type="text" name="num2"><br /> <input type="submit" value="Add Em!!"> </form> <?php } ?> </body> </html>
  14. I just timeout when trying to search
  15. Use strlen()
  16. They are the largest, a quote from a post in Dec '08 (and I know it has grown rapidly since):
  17. Interesting, when I tested it a few months ago on my server multiple arguments was faster, but like you said, not by enough to matter.
  18. Yeah, look at for CV. haha
  19. <?php echo 'html'.$var; echo 'html',$var; // I personally use this way. the tests I've run show its slightly faster because it is taking it is separate arguments instead of concatenate them echo "html {$var}"; // or if you have a lot of html to display: ?> <html stuff> <?php echo $var; //...
  20. I apologize if that sounds harsh but, if you can't grasp what Daniel/Ober tried to tell you about what MySQL/SQL is.... then I don't know how well you're going to do in that class at all.
  21. Looking sharp
  22. SQL and MySQL are different.
  23. Yeah, it sometimes happens after the board parses your message and sends a header redirect.
  24. Your browser is probably just timing out. I had that happen yesterday after the server was brought back up. Hasn't happened today though.
×
×
  • 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.