Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
Can you see your error once you put it inside code tags w/highlighting? <?php $curnum = 0; $username = $_POST['username']; $password = $_POST['password']; $gender = $_POST['gender']; $byear = $_POST['birth_year']; if(!$username) { $curnum ++; echo "<tr><td>".$curnum.". Please enter a username.</td></tr> } ?> (the missing "; at the end of the echo statement) PS - next time use code tags please
-
I think its similar to this concept (you pay for a chunk of pixel grid space to place your company's logo for instance). Sorry to the mods/admin, not trying to 'advertise' that link's service or anything.. just for illustrative purposes. Haha, just don't do it as bad as them:
-
[SOLVED] Revenue idea for phpfreaks (The first one)
Philip replied to dreamwest's topic in PHPFreaks.com Website Feedback
... -
wow people still go for that sort of thing? Second that - I thought that was a 90's thing?
-
[SOLVED] Revenue idea for phpfreaks (The first one)
Philip replied to dreamwest's topic in PHPFreaks.com Website Feedback
You probably think you're the pornstar profile right? -
http://www.phpfreaks.com/forums/index.php?action=stats Bottom of the page will show hits and general stats.
-
Because thats javascript not php??
-
Take a look at: Less than or equal is <=
-
Same, and jiggling the wire would fix it - turned out there was the connection on the monitor had gone bad.
-
It is because your query failed. Do you need to edit the column or table names?
-
[SOLVED] Printing out an Array that can vary in size
Philip replied to ArizonaJohn's topic in PHP Coding Help
Or, using foreach (which was built for arrays): foreach($array as $key => $value) { echo $value,'<br>'; } -
Check a value for one key in a multi-dimensional array
Philip replied to haku's topic in PHP Coding Help
Not to my knowledge - you can't define what key to search in. -
Check a value for one key in a multi-dimensional array
Philip replied to haku's topic in PHP Coding Help
You could always write a custom foreach statement. I don't think there is a built in one key search. I threw this together for you: <?php /* -- Params: -- Search item, -- Array to search in, -- Key to search in, -- value to return */ function search_key($needle, $haystack, $skey, $rkey) { foreach($haystack as $k=>$v) if(is_array($v) && isset($v[$skey]) && $v[$skey] == $needle) if(isset($v[$rkey])) return $v[$rkey]; else return true; return false; } // Setup the array $array = array ( array('name'=>'tom', 'age' => 1), array('name'=>'dick', 'age' => 2), array('name'=>'harry', 'age' => 3), ); // See what you have echo search_key(2, $array, 'age', 'name'); // prints 'dick' ?> -
I saw this today and found it appropriate for this thread. http://www.collegehumor.com/video:1909386
-
No its not needed, unless you wanted to do something different like show an error message. If you just want it to load a default page the code above will work fine.
-
To avoid a notice (undefined index) check to see if they even have the page in the url. $pages = array('home','scripts','media','archives','contact','about'); $page = (isset($_GET['page']) && in_array($_GET['page'],$pages)) ? $_GET['page'] : 'home'; if($page) { require('./pagecontent/'.$page.'.php'); } Also, I put in 'home' as the default if it isn't in the array or not selected, but you could always change that to another page.
-
To extend Maq's reply: range()
-
If you're running apache, it's called mod rewrite. http://www.workingwith.me.uk/articles/scripting/mod_rewrite
-
I second that.
-
Yeah, thats another point. It's also configurable on the user's end to have target="_blank" open in a new window, or a new tab.
-
You want PHP to open a new tab on a browser? Not possible, it needs to be done with JS/HTML.
-
But that 4% may not be their audience. Let's say I have a online shop aimed towards the geekier side (e.g. thinkgeek.com). More of your audience is likely to have js/flash because they are more aware of the technologies - thus that 4% would drop to maybe 1% or less. Now, let's say I have an online shop aimed towards the elderly. I'm less likely to use fancier/complicated scripts/designs because that's not who my audience is. You want something more straight forward because hell, if they are anything like my grandparents they are still running WinXP with IE 6. Lets face it, the odds of them having js/flash enabled and having a computer to support it is a lot smaller than the tech-based part of society. It's not necessarily about the technology & whats the newest and best at the time, it's about how you implement it into your website as a strategy based off of your audience. @OP - sorry for getting us off your original topic
-
Because variables in single quotes are not parsed like double quotes. // Will not work: echo '$var'; // Work work: echo "$var"; echo $var;
-
It could be for something like the "newest members" or "recent posts" - not just for manual increments to an ID