Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
Umm, because if I enter the password TEST it will show a 404. If I enter anything but TEST it echos the name.
-
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>';
-
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
-
[SOLVED] How To array_push multidimensional arrays
Philip replied to Zeradin's topic in PHP Coding Help
Just how you originally stated it in the beginning $array[0]['SAT'] or $array[1]['MCAT'] -
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.
-
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'; }
-
how many years, months, weeks, days, hours, ago from datetime?
Philip replied to onedumbcoder's topic in MySQL Help
More specifically, using TIMEDIFF would give back not only days, but hours/minutes/seconds as well. -
[SOLVED] Get next/previous row from database, ordered by name (not id)
Philip replied to atomicrabbit's topic in MySQL Help
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. -
Yes - but the numbers I pulled are from what would be considered competition for another photo host (e.g. photobucket, imageshack)
-
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.
-
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.
-
<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 ) )
-
[SOLVED] A little more help for someone new to php
Philip replied to dieselserpent's topic in PHP Coding Help
<?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> -
Unable to access the search daemon
Philip replied to Coreye's topic in PHPFreaks.com Website Feedback
I just timeout when trying to search -
They are the largest, a quote from a post in Dec '08 (and I know it has grown rapidly since):
-
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.
-
Newbie Sections added to ALL forums
Philip replied to aussie's topic in PHPFreaks.com Website Feedback
Yeah, look at for CV. haha -
<?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; //...
-
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.
-
SQL and MySQL are different.
-
Yeah, it sometimes happens after the board parses your message and sends a header redirect.
-
You're right.
-
Your browser is probably just timing out. I had that happen yesterday after the server was brought back up. Hasn't happened today though.