
gwolgamott
Members-
Posts
486 -
Joined
-
Last visited
Never
Everything posted by gwolgamott
-
Fatal error: Maximum execution time of 60 seconds exceeded in ...
gwolgamott replied to Jragon's topic in PHP Coding Help
You could try to set it in the code. http://php.net/manual/en/function.set-time-limit.php -
That depends on when you want to run that. Or use include or require to make it run sometime within the loop when a flag is hit rather then calling it with ajax. it's all highly dependent on when and where. Programmatic method this is possible... of course if you want b to run first you could just you know call it first.
-
Sorry so long for a reply been sick and sleeping for a number of days... not quite literal but close enough that I never even touch a computer for 4 days. You've already the array with the $loggedInfo //So just loop through that array foreach($loggedInfo as $key => $value) { if($value != "") { echo"$value"; }else{ echo"<a href='edit_profile.php'>edit this!</a>"; } }
-
Where ever it is you are storing the data and retrieving it from, say you retrieve it all in an array then take that array and foreach through it, if one of the elements is empty fill it with with a string like: '<a href="myedit.html">Edit This</a>' then print all the variables as normal later.
-
http://www.phpfreaks.com/forums/index.php/board,43.0.html Probably get more responses in that forum.
-
What do you mean will it add '' between them? That just straight up splits the string up into an array with a length of one for each array element. What alex has shown will take this >>> $str = 'abc' to and do this >>> $arr = array('a', 'b', 'c')
-
http://woork.blogspot.com/2007/10/load-page-using-url-variables-and-php.html Or if your ambitious enough to create your own here's a good reference for how, read the comments below the page as well, they have different methods for different reasons. At any rate leaves only a separate menu file that you have to update. And if really ambitious create a self-building menu based off of something in a database, folder listing, or something of that nature. Those are awesome to never edit a menu file again... well for content anyways.
-
Is this the best way to increment characters?
gwolgamott replied to wee493's topic in PHP Coding Help
It's small and clean. I see nothing wrong with that method. If you want to do a function then it's just dumping your code there into a function and returning an array to the main area you are using this would clean up the main code area if you liked. -
Yes it is incomplete in that sense. I took that he wanted an option to sort in descending for either wins or for loses as in a link, button whatever. But I see, however it is not at all hard to do if for both to display on separate rows. This is simplified here //$Teams is your array with the team number arrays for win / loss foreach($Teams as $key => $value) { $array_win[$key] = $value['Win']; $array_loss[$key]=$value['Loss']; } arsort($array_win); arsort($array_loss); //now print the arrays however you want you have both sorted highest to lowest here Here's an example of how to do this with explanation and real output for the sample data below. //Lets say the array $Teams is something like this /* Array ( [293] => Array ( [Win] => 6 [Loss] => 0 ) [298] => Array ( [Win] => 6 [Loss] => 3 ) [297] => Array ( [Win] => 3 [Loss] => 3 ) [302] => Array ( [Win] => 2 [Loss] => 3 ) [304] => Array ( [Win] => 5 [Loss] => 3 ) [295] => Array ( [Win] => 6 [Loss] => 3 ) [299] => Array ( [Win] => 2 [Loss] => 3 ) [292] => Array ( [Win] => 1 [Loss] => 3 ) [301] => Array ( [Win] => 3 [Loss] => 3 ) [294] => Array ( [Win] => 4 [Loss] => 3 ) [306] => Array ( [Win] => 2 [Loss] => 3 ) [305] => Array ( [Win] => 1 [Loss] => 3 ) [300] => Array ( [Win] => 1 [Loss] => 3 ) [291] => Array ( [Win] => 3 [Loss] => 3 ) [303] => Array ( [Win] => 0 [Loss] => 3 ) [296] => Array ( [Win] => 0 [Loss] => 3 ) ) */ foreach($Teams as $key => $value) { $array_win[$key] = $value['Win']; $array_loss[$key]=$value['Loss']; } // Will now have this respectively for win & loss array /* $array_win is: Array ( [293] => 6 [298] => 6 [297] => 3 [302] => 2 [304] => 5 [295] => 6 [299] => 2 [292] => 1 [301] => 3 [294] => 4 [306] => 2 [305] => 1 [300] => 1 [291] => 3 [303] => 0 [296] => 0 ) $array_loss is: Array ( [293] => 0 [298] => 3 [297] => 3 [302] => 3 [304] => 3 [295] => 3 [299] => 3 [292] => 3 [301] => 3 [294] => 3 [306] => 3 [305] => 3 [300] => 3 [291] => 3 [303] => 3 [296] => 3 ) */ arsort($array_win); //use asort($array_win); for lowest to highest instead arsort($array_loss); //use asort($array_loss); for lowest to highest //will sort each array from highest to lowest.... //Will now be /* $array_win is now: Array ( [293] => 6 [295] => 6 [298] => 6 [304] => 5 [294] => 4 [291] => 3 [297] => 3 [301] => 3 [306] => 2 [299] => 2 [302] => 2 [300] => 1 [292] => 1 [305] => 1 [296] => 0 [303] => 0 ) $array_loss is now: Array ( [305] => 3 [306] => 3 [294] => 3 [300] => 3 [291] => 3 [296] => 3 [303] => 3 [301] => 3 [292] => 3 [297] => 3 [298] => 3 [302] => 3 [304] => 3 [299] => 3 [295] => 3 [293] => 0 ) */ //Now print the arrays however you want. You have two arrays sorted from highest to lowest from the original array. Hope this helps. sorry if mislead you earlier.
-
I think so, not that off top of my head do I know how that would work though.
-
You could put them in arrays according to their territorial area. Then you could foreach loop through the array when building the drop down to display. $southwest = array("CA", "NV", "UT", "CO", "AZ", "NM"); echo '<select name="southwest"> '; foreach ($southwest as $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } echo '</select> ';
-
script executes the 'IF' -AND- the 'ELSE'!! how can that happend?
gwolgamott replied to itay's topic in PHP Coding Help
Try a if(pregmatch()) - elseif(!pregmatch()) statement just to see if that works. There must be some logic that I do not see either that must have an issue. The return messing it up is odd. Maybe something with that variable? -
Please help!!! My PHP contact form will not deliver properly...
gwolgamott replied to kittyshe911's topic in PHP Coding Help
Try to simplify it some with a straight mail() function then work away from it slowly with tests. I don't have time today, otherwise I'd take a stab at it, but I'd first take a few steps back do a hardcoded mail() and work back from that and integrate it a piece at the time in your function. $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From: $from"; mail($to,$subject,$message,$headers); -
I wish it was, I don't know honestly if it is. It'd make what I'm working on easier if it was.
-
Please help!!! My PHP contact form will not deliver properly...
gwolgamott replied to kittyshe911's topic in PHP Coding Help
what's it sending instead? -
Oh I see, you were trying to echo numRows and not totalRows... You meant this: while ($row = $result->fetch_assoc()) { echo strtoupper("<li>{$row["$column"]}</li>"); } if($totalRows == "on") { echo $numlRows; //that explains why you were gettting "on" all the time then, but not why the if doesn't work } } And that if statement doesn't work at all? I've a suspicion that totalRows is not getting set correctly. //echo the totalRow here just to be sure it is being sent to the function with something you believe it should be function anyQuery($connection, $table, $column, $totalRows) { echo $totalRows;
-
Tried something like this yet? $count_my_row = 0; while ($row = $result->fetch_assoc()) { $count_my_row = $count_my_row + 1; echo strtoupper("<li>{$row["$column"]}</li>"); } if($totalRows == "on") { echo $count_my_row; } }
-
It's PHP... use it to create your own. What are you trying to print a report of
-
Oh, I think I misread what you wanted. sorry. If you are using sessions to keep track of who's logged in; then you could use session variables perhaps that keep track whether or not you are logged in and use that as the flag to display what you want. http://us.php.net/manual/en/intro.session.php I'd give more of an explanation but with sessions I'm a bit of a noob I don't deal with them often unfortunately to give good advice with regards to them other then to know when I should be using them... then I find someone who knows what they are doing lol
-
Use same method as you did before. Just put an exclamation point ! before isset() <?php if (!isset($attendEvent)) { ?> <?php } ?>
-
Help with this script I have written PLEASE
gwolgamott replied to grunshaw's topic in PHP Coding Help
Hey one more thing, sure you've tried it but just incase. Have you tried just doing a straight up addition? Since the table is preset there is not need for an if/else statement? If that gets you the same result you could use a work around just use if statement to see if the value == 0 and if it is mark a flag. Do not check for if/else for the updating aspect just update as usual then after the updates, check to see if your flag was triggered and if so then update again with setting it to 1. If that still produces 2 then something is running the script twice here -
Help with this script I have written PLEASE
gwolgamott replied to grunshaw's topic in PHP Coding Help
Yeah. I believe you. I asked those question because I looked over it and couldn't see any reason either. Well short of another pair of eyes spotting something.... assign a dummy variable to the default value in the table and step that variable through the process as well and echo it out in the end then eliminate it from areas to see if you can get some different results to that variable... has to be doubling up someplace I just can't see where. Damn wish I was more helpful... I'll look over it again though too. -
Wow that was a bit more simple then I thought... I stand corrected. Anyways for your regular expression, you could ask in the regex sub-forum. May get a response from experts on that in that forum who are specific in that area. http://www.phpfreaks.com/forums/index.php/board,43.0.html
-
Was curious what method you were using... as that just means that it just doesn't work. Not why it doesn't work, just that you are using $_POST. This could be for a hundred reasons is all. Would have mattered to get more help was all, was just trying to prod some help for you thought you had a specific issue. Didn't realize you wanted a broad answer. Anyways... to answer your questions: (a) This shouldn't happen if php is running correctly, this just means the php code did not compile to run correctly and you have error reporting off most likely. (b) You need checks in place to check if this page is first run and checks for if it is not first run then error checking for blank form fields. Then depending on how you are using the $_POST variables you could dump it at the beginning of the script to a dummy variable if it is causing issues with multiple use, not sure how it will be used but it's a method that could use as well.
-
Help with this script I have written PLEASE
gwolgamott replied to grunshaw's topic in PHP Coding Help
Should you be checking if the votes in the table if($totalvotes == "") instead of 0? I don't know if you pre-fill the fields or not and if there are no votes then is it blank or is it 0 and if it is 0 then try if($totalvotes == 0) instead of if($totalvotes == "0")