Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
If your server can parse it just as fast, yes.
-
[SOLVED] Fatal error: Call to member function on...non-object...
Philip replied to venturemc's topic in PHP Coding Help
$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 -
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.
-
Oops, my bad typo sorry
-
So.... what's your current code?
-
[SOLVED] Signing in as someone else with sessions?
Philip replied to LostKID's topic in PHP Coding Help
On your login script: $_SESSION['username'] = $username; $username is undefined, you never set it to any value. Also, make sure to sanitize your inputs! -
Revenue idea for phpfreaks (Second attempt)
Philip replied to dreamwest's topic in PHPFreaks.com Website Feedback
i smell trouble. -
can't people tell the difference between php and html ?
Philip replied to saltedm8's topic in PHPFreaks.com Website Feedback
It's not a programming language. I think the w3 consortium defines what html is pretty well: -
can't people tell the difference between php and html ?
Philip replied to saltedm8's topic in PHPFreaks.com Website Feedback
Daniel and I both have said HTML is a language - it just is not a programming language. -
<?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.
-
Did you try it?
-
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
-
Because you called the first row ($row = mysql_fetch_assoc($results) and then overwrote it (while($row = mysql_fetch_assoc($results)))
-
can't people tell the difference between php and html ?
Philip replied to saltedm8's topic in PHPFreaks.com Website Feedback
Note that doesn't read: html (hypertext programming language ) -
Bottom left corner of the topic you'll see a button
-
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.
-
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
-
Isn't good enough for you?
-
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']);
-
You probably should read up on the manual, it'll give you your answer... str_replace
-
Maybe you should read the sticky at the top of that forum http://www.phpfreaks.com/forums/index.php/topic,167887.0.html
-
IS This calling all rows or just specified one's?
Philip replied to Gayner's topic in PHP Coding Help
It would limit the number of rows returned, not what rows are returned. What exactly are you trying to pull from your db? -
IS This calling all rows or just specified one's?
Philip replied to Gayner's topic in PHP Coding Help
LIMIT will limit the number of rows returned. -
IS This calling all rows or just specified one's?
Philip replied to Gayner's topic in PHP Coding Help
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.