GingerRobot
Staff Alumni-
Posts
4,082 -
Joined
-
Last visited
Everything posted by GingerRobot
-
[SOLVED] adding up values with $_SESSION's in a array
GingerRobot replied to redarrow's topic in PHP Coding Help
Err, are you looking for the array_sum function? -
I can't remember what the default size it, but it can be changed. Mutley: Does your host actually allow you to increase the memory limit?
-
Yeah, it is. I had a few problems with it slowing down my computer when i last used it though. I switched to Avira which seemed ok though i'm now using McAfee since my university provides it for free. As for spyware, i normally use spybot and ad aware.
-
How do I make a tree view from MySQL and PHP
GingerRobot replied to projectdeploy's topic in PHP Coding Help
You may wish to read this article on storing hierarchical data: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html -
It looks to me like you're overcomplicating the issue. You don't need to search and then replace - you can just use preg_replace. preg_match() only returns the first match - you have to use preg_match_all() to find all matches in a string. I suspect this is causing all of your URLs to be replaced by the first one. Something like this should work: <?php $patterns[] = "|\[url\](.*?)\[/url\]|is"; $patterns[] = "|\[url=(.*?)\](.*?)\[/url\]|is"; $replacements[] = '<a href="$1">$1</a>'; $replacements[] = '<a href="$1">$2</a>'; preg_replace($patterns,$replacements,$string); ?>
-
Designing website for Iphone + Iphone Simulator for windows
GingerRobot replied to departedmind's topic in Miscellaneous
Yeah - it uses safari: http://www.apple.com/iphone/features/safari.html -
Well we all know CV's just been trying to prove that he does indeed make the longest posts
-
Yes, that's possible. You'd just need to parse the web page to find out if the gamertag exists or not. Of course, the website might not be too happy with you bombarding them with requests. $alpha = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"; $alphaArray = split(" ", $alha); The range function exists for a reason
-
How do you know if a programmer is a good programmer?
GingerRobot replied to ok's topic in Miscellaneous
Is it me or this thread entirely pointless? -
You need to set the CURLOPT_FOLLOWLOCATION option to false and the CURLOPT_RETURNTRANSFER option to true. Then parse the returned data for the location. The method of redirection determines where you need to look. For example, if you're being redirected with an HTTP header, then you'll also need to set the CURLOPT_HEADER option to true and look for the text after 'location'
-
Perhaps it's just me, but i've absolutely no idea what your question is. What is the problem?
-
I would start by adding these two lines to the top of your script: error_reporting(E_ALL); ini_set('display_errors','On'); This will mean you'll actually be seeing all of the error messages. For starters, you'll get a whole host of undefined constant messages for these lines: $array_name[business]="$_POST[business]"; Since the key of the array should be quoted, like so: $array_name['business']=$_POST['business'];
-
Not quite. The == operator has a higher precedence than the && operator. Therefore, $filesize3 would first be evaluated, then $filesize4 == 0 would be evaluated assuming $filesize3 is true, owing to shortcut evaluation.
-
Err, isn't it randomized because you made it so? $PokémonRand2= rand(1, 49);
-
You need to order your query by your date, then keep track of the month. When it changes, echo out and reset the total. I couldn't see where this was actually needed in your code, but it would look something like this: <?php $sql = "SELECT *,DATE_FORMAT(yourdatefield,'%c') AS month FROM yourtable ORDER BY yourdatefield"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); $prevmonth = mysql_result($result,0,'month'); $total = 0; while($row=mysql_fetch_assoc($result)){ if($prevmonth != $row['month']){ echo $total.'<hr />'; $total = 0; $prevmonth = $row['month']; } echo $row['hours']; //echo out any other information $total += $row['hours']; } ?> I've assumed you have some sort of timestamp stored in your database and have therefore extracted the month from this.
-
That's not going to work. That would be fine if you wanted to let html files be parsed as php but, as i understand it, those html files no longer exist. You'll need to use the mod_rewrite apache module, with the following in a .htaccess file in your web root: RewriteEngine on RewriteRule (.*?)\.html$ $1.php
-
See this post: http://www.phpfreaks.com/forums/index.php/topic,211483.msg963158.html#msg963158
-
Why's that? Since PHP uses the $ symbol for variables, there's no issue with using reserved words as variable names.
-
Start by reading this sticky. You need to make sure you have no output whatsoever(that includes whitespace) prior to using session_start();
-
$username is still undefined. Where are you trying to get it from? The database? Oh, and the second parameter for mysql_result should be integer corresponding to the row in the result set you wish to use.
-
Why don't you add a field to your database table which you can use to flag files as assigned or not? If someone uploads a file again, just change the value in the database.
-
You need to search your database to find out the number of posts by that user prior to inserting the data. Something like: $sql = "SELECT COUNT(*) FROM yourtable WHERE username='$name'"; $result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR); $num = mysql_result($result,0); if($num > 0){ //dont insert give use error message }else{ //insert the comment into the database }
-
Advertisements on PHP Freaks
GingerRobot replied to Daniel0's topic in PHPFreaks.com Website Feedback
Meh, as far as i'm concerned, PHP freaks couldn't charge for the freelance forum. To charge for it would be to seen to implicitly provide some sort of guarantee on the quality of work. I can see the posts now..."you're making money from it; it's not fair I lost money by being scammed (because i'm retarded is by the by)". The ads aren't that intrusive. Let's go with the flow.