Jump to content

Mikedean

Members
  • Posts

    79
  • Joined

  • Last visited

    Never

Everything posted by Mikedean

  1. I'm not sure if this will work, but maybe try: $olddir = "../images/game/$game_console/$game_name2"; $newdir = "../images/game/$game_console/$updated_game_name1"; if( is_dir( $olddir ) ) rename("$olddir", "$newdir"); else echo "Folder doesn't exist.";
  2. Why don't you just calculate the 'Total Price' whilst calculating the 'Total'? Could you post some more code as what you've given us isn't really helpful... Plus count() is used to display the length of an array. If you have all of the 'Total' amounts in an array, you might be able to use 'array_sum()' http://uk3.php.net/array-sum
  3. This is how I would have done it (I've only done it for the days, but you should see how to do it for months etc.) $your_date = strtotime( "19/12/1987" ); echo "Day: <select name='day'>"; for( $i = 1; $i < 32; $i++ ) { $i = str_pad( $i, 2, STR_PAD_LEFT, 0 ); echo "<option value='" . $i . "'" . ( $i == date( "d", $your_date ) ? " selected='selected'" : "" ) . ">" . $i . "</option>"; } echo "</select>";
  4. I agree with thorpe, however: class query { function sql_query($sql) { global $db; $db->db_connect(); $query = mysql_query($sql) or die(mysql_error()); return $query; } function sql_row($result) { return mysql_fetch_array($result); } } Works. You need to return the results from the functions.
  5. Isn't the URL supposed to be: https://www.paypal.com/cgi-bin/webscr Basically removing the 'UK' from yours.
  6. You should be able to do it in the MySQL query. mysql_select_db($database_connuser, $connuser) or die; $query = "SELECT * FROM drinking WHERE REPLACE(venue, 'The ', '') LIKE '{$Letter}%'"; $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); I think that'll work.
  7. I think the following code will do what you want. $query = sprintf("SELECT PName,UName,PText,URL FROM liefde ORDER BY PName DESC"); $result = mysql_query($query); while($urlgedicht = mysql_fetch_array($result)) { print "<ul><li><a href={$urlgedicht['URL']}.htm>{$urlgedicht['PName']} | {$urlgedicht['UName']}</a></li></ul>"; } Basically removing the second query.
  8. Looks like you have to enable cURL in the php.ini file to allow cURL support. Un-commenting 'extension=php_curl.dll' should do the job . Me thinks .
  9. Whenever setting the 'From' attribute I've always used the following. $headers .= "From: ".$name." <".$email.">\r\n"; Always seems to do the job for me, so I'd probably change that part or just remove it as Rhodesa suggested. Edit: I just tested your code and it did work to both my private email and Hotmail address. It was put in my junk email on my private email and worked fine with Hotmail, so it probably is just an issue with AOL.
  10. I don't mean to sound rude, but this does look like someone who has opened up a dictionary, flicked to a page, pointed and started to type. It did make me chuckle though .
  11. Are you getting any errors? If so what are they. If not, try echoing the email body on the page, see if it is doing anything .
  12. This is how I would do it. It is only made for 1 player at the moment, but I'm sure you will see what I did . <?php session_start(); // 0 - Clubs // 1 - Diamonds // 2 - Hearts // 3 - Spades function shuffleCards() { $cardTypes[0] = ""; $cardTypes[1] = ""; $cardTypes[2] = ""; $cardTypes[3] = ""; for( $n = 0; $n < 4; $n++ ) { $strCards = "1,2,3,4,5,6,7,8,9,10,11,12,13"; $cardTypes[ $n ] = explode( ",", $strCards ); shuffle( $cardTypes[ $n ] ); } return $cardTypes; } function removeCard( $deck, $card ) { if( $card != count( $deck ) ) { for( $i = $card; $i < count( $deck ); $i++ ) { $nextNum = $i + 1; $deck[ $i ] = $deck[ $i + 1 ]; } } unset( $deck[ count( $deck ) - 1 ] ); return $deck; } function getDeck( $deck ) { switch( $deck ) { case 0: return "Clubs"; break; case 1: return "Diamonds"; break; case 2: return "Hearts"; break; case 3: return "Spades"; break; } } function getCardName( $card ) { if ( $card == 1 ) return "Ace"; elseif ( $card == 11 ) return "Jack"; elseif ( $card == 12 ) return "Queen"; elseif ( $card == 13 ) return "King"; else return $card; } if( !isset( $_SESSION[ 'deck' ] ) ) $arrCards = shuffleCards(); else $arrCards = $_SESSION[ 'deck' ]; echo "<h1>Player</h1>"; $arrPlayer[ 0 ] = $_SESSION[ 'player1' ]; if( !isset( $arrPlayer[ 0 ] ) ) { for( $i = 0; $i < 2; $i++ ) { $deck = rand( 0, 3 ); $card = rand( 0, count( $arrCards[ $deck ] ) - 1 ); $num = count( $arrPlayer[ 0 ] ); $arrPlayer[ 0 ][ $num ][ "deck" ] = $deck; $arrPlayer[ 0 ][ $num ][ "card" ] = $arrCards[ $deck ][ $card ]; $arrCards[ $deck ] = removeCard( $arrCards[ $deck ], $card ); } } for( $i = 0; $i < count( $arrPlayer[ 0 ] ); $i++ ) { echo $i+1 . "<br />"; echo "Deck: " . getDeck( $arrPlayer[ 0 ][ $i ][ "deck" ] ) . "<br />" ; echo "Card: " . getCardName( $arrPlayer[ 0 ][ $i ][ "card" ] ) . "<br />"; } $_SESSION[ 'player1' ] = $arrPlayer[ 0 ]; $_SESSION[ 'deck' ] = $arrCards; ?> Basically, you shuffle the cards only if the session isn't set and it also removes the card meaning it cannot be used again. Take a look, use and abuse it, but I'm sure this will set you in the right direction. I'm probably going to continue to write this myself, so if you get stuck, I'll have a working version soon . P.S. I changed how I was coding it half way through, so it might look a bit different in places... Tiredness sucks!
  13. Oh poo, I made a mistake before too. mail($to, $subject, $strBody, $headers); Should be. mail($to, $subject, $strBody, $strHeaders); Also try setting them to 666. So you have read/write permission for all 3.
  14. The number is the ID of the event at the minute, was just trying to make sure that it was all present and correct . I'm about halfway through adding the editEvent function and as it was late, I decided just to upload and ask people to test this out. Glad I did now as Coreye spotted a few vital things .
  15. Ahhhhh I know why, it's because I was trying to be incredibly simple and just use the raw values the user entered when adding an event. I'll change that in the morning, along with the directly accessing the PHP file. Thanks for giving it the once over though .
  16. Try using the 'alt' tag of the elements you want to have sample data for. <script type="text/javascript"> function loadSamples() { for( var i = 0; i <= document.forms[ "blah" ].elements.length; i++ ) { if( document.forms[ "blah" ].elements[ i ].alt ) document.forms[ "blah" ].elements[ i ].value = document.forms[ "blah" ].elements[ i ].alt; } } </script> <form name="blah"> <input type="text" alt="Sample1" /> <input type="text" alt="Sample2" /> <input type="button" onClick="loadSamples(); return false;" value="Load Samples" /> </form>
  17. Ok, that should be fixed now (hopefully ). I've also added a light blue colour to the events that haven't been given a time.
  18. Just spotted that . Thanks for taking a look over and providing feedback . I've only just got the whole events thing working, so this was on my to do list, along with lots of other things too after thinking about it earlier . Will get working on fixing that now.
  19. Edit: My brain is going to pot, Rev is correct
  20. Seemed pretty obvious really . I've been working on it over today mostly and have added the creation of events. It also sorts those events depending on the time you enter too. It's way off from being perfect, but it's a damn site closer than what it was . Take a look and let me know your thoughts .
  21. I've had this type of problem before, try changing the GET to a POST. You'll have to change parts of it, but it should do the trick .
  22. You could always use inheritance. class foo { function test( $string ) { return $string; } } class bar extends foo { function echoString( $string ) { echo $this-> test( $string ); } } So basically, whenever you extend a class, it makes the functions inside the class that you are extending available . Hope that makes sense .
  23. This is a stab in the dark, but try the following. (SELECT COUNT(blog_comments.post_id) FROM blog_comments, blog_posts WHERE blog_comments.post_id = blog_posts.id) AS num_coms
  24. All you need to do is change the following and it should (fingers crossed) work. $strHeaders = "From: \r\n"; to $strHeaders = "From: $email_field\r\n"; And also. mail($to, $subject, $headers, "From:$email_field"); to mail($to, $subject, $strBody, $headers); You should also make sure that you have read access to the html email template on the server.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.