
jackpf
Members-
Posts
1,410 -
Joined
-
Last visited
Never
Everything posted by jackpf
-
You should take another look at Ken2K7's code. Test this if you don't believe him (and me) that it does work: <?php function traversal ($arr) { foreach ($arr as $key => $value) { if(is_array($value)) { traversal($value); } else { echo $value.'<br />'; } } } $array = array( 'this', 'does', 'work', 'honestly.' ); traversal($array); ?> If it doesn't, there's something horrifically wrong with your array.
-
I can almost get this Pagination to work-- what am I doing wrong?
jackpf replied to ArizonaJohn's topic in PHP Coding Help
Right at the top. Although, I reckon it would be simpler to put the page in the query string of the url. Like ?page=2 or whatever. -
[SOLVED] Password generator not working with MySQL
jackpf replied to bettina702's topic in MySQL Help
That's not what the query does. What it does is updates the record that has "1" as the value of `column`. Maybe you should have a look at mysql update syntax. Try this mysql_query("UPDATE table SET column='$password' LIMIT 1"); -
[SOLVED] Password generator not working with MySQL
jackpf replied to bettina702's topic in MySQL Help
Put or die(mysql_error()); after the query. And are you sure there's a field called column with a value of 1? -
You'd have to use regex. Something like this? $str = preg_replace('/\<(^\!)/', '', $str);
-
DISTINCT is probably what you want.
-
[SOLVED] Password generator not working with MySQL
jackpf replied to bettina702's topic in MySQL Help
Yeah, you need to set `field` to something. Look at your code. How does mysql know what to update `field` to? Try something like this: mysql_query("UPDATE table SET `password`='$password' WHERE field=1"); -
[SOLVED] Password generator not working with MySQL
jackpf replied to bettina702's topic in MySQL Help
Like this - $password = generatePassword(); You also spelt recipient wrong in your headers (line 49) No problem -
Wouldn't it be simpler to find out what's breaking your ajax?
-
I don't understand, why can't you just use htmlentities()?
-
[SOLVED] Password generator not working with MySQL
jackpf replied to bettina702's topic in MySQL Help
It doesn't look like you're calling the function to create the password. -
str_replace('body', 'bodies', htmlentities($val));
-
[SOLVED] Can't figure why my form is not inserting...
jackpf replied to pneudralics's topic in PHP Coding Help
If you put or die(mysql_error()); after your query and didn't get any errors then it must be inserting. -
[SOLVED] Can't figure why my form is not inserting...
jackpf replied to pneudralics's topic in PHP Coding Help
And put or die(mysql_error()); after your query/connections. -
Store stuff to a variable beforing being output to browser.
jackpf replied to rreynier's topic in PHP Coding Help
It depends. If you have pretty normal sized html source, it can actually speed up rendering because the browser receives all the html at once, rather than having to piece it together. However, if your source is huge, it'll just end up taking the browser longer. But, you can use stuff like compression with OB. So idk. I personally quite like it. -
Kind of... Ok, make one file with something like this in: $username = $_COOKIE['username']; $timestamp = time(); mysql_query("INSERT INTO `user_timestamps` (`username`, `timestamp`) VALUES ('$username', '$timestamp') ON DUPLICATE KEY UPDATE `timestamp`='$timestamp'"); And include that on every page. Then you can figure out who's online with something liek this: $time = time() - $limit;//$limit is how many seconds you allow users to not have made a page request before they are considered "offline" $sql = mysql_query("SELECT * FROM `user_timestamps` WHERE `timestamp`>='$time'"); //do whatever...
-
Which first? Database, Interface, or Other.
jackpf replied to roopurt18's topic in Application Design
I just write some code, make a database, don't really care what it looks like So yeah, I voted "other". I guess I'd define what I code first as..the code. -
[SOLVED] Filling Textbox value which contains quotes
jackpf replied to rohithreddyk's topic in PHP Coding Help
htmlspecialchars() is probs what you want. -
Ooooh you mean it doesn't post? Yeah, you need to put method="post". Default is GET.
-
Lol yeah, nice one.
-
What?
-
Store stuff to a variable beforing being output to browser.
jackpf replied to rreynier's topic in PHP Coding Help
What?? Why not just do this? <?php function printMainNav() { return '<ul id="mainNav"> <li><a href="#">Home</a></li> <li><a href="#">Customers</a></li> </ul>'; } $contents = printMainNav(); //do whatever echo $contents; ?> -
Ahaha, I have never seen anyone use curly brackets like that before. There's a link at the bottom.
-
Yeah. Don't know why you're wanting to do it with javascript though. Cookies are way harder to handle with js. if(isset($_COOKIE['username'])) { echo 'this cookie exists'; }
-
Wtf, surely that's a bit excessive? I just use something like this: static function post($str) { global $mysql; if(!isset($mysql)) { $mysql = new connection; $mysql->connect(); } if(is_array($str)) { foreach($str as $key => $value) { $str[$key] = $mysql->escape_string(trim($str[$key])); } } else { $str = $mysql->escape_string(self::prepare($str)); } return $str; } static function prepare($str) { return trim($str); }