Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. If your server can parse it just as fast, yes.
  2. $new_wp isn't an object (at least according to your title). You need to make it one in order to call members on it
  3. The client will never download any PHP code unless you specifically force it using headers (or your server isn't config'd right.) Everything is parsed on the server side, and then that is what the client downloads.
  4. Oops, my bad typo sorry
  5. So.... what's your current code?
  6. On your login script: $_SESSION['username'] = $username; $username is undefined, you never set it to any value. Also, make sure to sanitize your inputs!
  7. It's not a programming language. I think the w3 consortium defines what html is pretty well:
  8. Daniel and I both have said HTML is a language - it just is not a programming language.
  9. <?php if(is_null($input)) { echo "<p>You failed to enter Fahrenheit or Celsius </p>"; } else { // using a switch, with all lowercase input switch(strtolower($input)) { case 'farhenheit': echo "<p>Coversion of 0 to 25 degrees Fahrenheit to Celsius: </p>"; for ($i=0, $k =0; $k <=25; $i++, $k++) { $a= round(($i - 32)*5.0/9.0, 2); echo $k . " degrees Farhenheit is equal to " . $a . " degrees Celsius <br>"; } break; case 'celsius': // also the default case.... default: echo "<p>Conversion of 0 to 25 degrees Celsius to Fahrenheit: </p>"; for ($i=0, $k=0; $k <=25; $i++, $k++) { $b= round($i*9.0/5.0+32, 2); echo $k . " degrees Celsius is equal to " . $b . " degrees Farhenheit <br>"; } break; } } ?> Take a look at that. True - but you should still check their values to make sure its nothing that could endanger your script.
  10. Did you try it?
  11. Proper syntax for the or is: if($var = 'value' OR $var = 'AnotherVal') // or if($var = 'value' || $var = 'AnotherVal') For your case I'd do: if(strtolower($input) == 'fahrenheit') { Also, if ($input == "farhenheit" or "Farhenheit") echo "<p>Coversion of 0 to 25 degrees Fahrenheit to Celsius: </p>"; for ($i=0, $k =0; $k <=25; $i++, $k++) That will only echo for the case, but will always run the for loop... you need to add curly brackets around the if contents
  12. Because you called the first row ($row = mysql_fetch_assoc($results) and then overwrote it (while($row = mysql_fetch_assoc($results)))
  13. Note that doesn't read: html (hypertext programming language )
  14. Bottom left corner of the topic you'll see a button
  15. Adding () won't fix the problem as they are optional when there aren't any parameters required. However, if in your desk class you have a construct function that requires parameters - you'd get that error.
  16. tinyint(4) Should be tinyint(1) [basically making them boolean PRIMARY KEY (`messageID`) Should be INDEX (`messageID`) `receiverRead`/ `receiverDelete` should have default values (or null) of 0 Instead of making that 3rd query (the update), use 0/NULL as a parentID instead. That'll save a query, and you can quickly see what messages are parents and what aren't. Plus, that's why I made that a 0 as a default on that column
  17. Isn't good enough for you?
  18. Since you're wanting to use mock variables, you need to either place them in single quotes, or escape them - otherwise PHP will try to parse them. $old= array('$fname', '$pos', '$pro'); $new= array($_POST['firstname'], $_POST['possessive'], $_POST['pronoun']); echo str_replace($old, $new, $_POST['intro_sentence']); OR $old= array("\$fname", "\$pos", "\$pro"); $new= array($_POST['firstname'], $_POST['possessive'], $_POST['pronoun']); echo str_replace($old, $new, $_POST['intro_sentence']);
  19. You probably should read up on the manual, it'll give you your answer... str_replace
  20. Maybe you should read the sticky at the top of that forum http://www.phpfreaks.com/forums/index.php/topic,167887.0.html
  21. It would limit the number of rows returned, not what rows are returned. What exactly are you trying to pull from your db?
  22. LIMIT will limit the number of rows returned.
  23. I think you may have the terms row and column confused. A row holds is a set of data, based off of what the columns specify the data should look like. You're telling to to return certain columns (not all of them), but since there is no limiting clause (where, joins, etc) it will return the selected columns but for all the rows.
×
×
  • 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.