Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Make it more re-usable: function keyReplace($key, $pattern, $replace) { return str_replace($pattern, $replace, $key); } function replaceKeys($array, $pattern, $replace) { foreach (array_keys($array) as $key) { keyReplace($key, $pattern, $replace); } }
  2. Impossible, it knows your every (DOM) move.
  3. Look up Gracefull Degradation, when I visited your homepage all I got was the left and right arrow nothing else. Besides that it's looks good.
  4. In case you don't understand what Mchl wants to say or you don't understand the article, he meant: class CMS { private $mysql = null; public function initMySQL() { $this->mysql = .. } }
  5. And the dark hacker replied: keep runnin' you little girl.
  6. You can do the same thing: server1 $username = isset($_GET['username']) ? $_GET['username'] : 'no username defined'; echo 'Hello, ', $username; server2 print file_get_contents('http://www.server1.com/script.php?username=me');//Hello, me
  7. And along came Firebug and saw that 2pt was really too small and changed it back to 12pt And he also did something with that background of yours (or the text I don't know).
  8. My comment was simple advice not meant to be harsh or to put you down or anything. Globals are a no-go (if you read up on good coding practices you'll find that to be true). And as you mentioned that you want it to be easily maintainable then... well.. we'll talk later as globals make for anything but easy to maintain. Sure you can, however the global overwrites whatever $input contained. Can you explain what these do? global $input; global $attShipsAlive; global $attShipsRemaining; global $defShipsAlive; global $defShipsRemaining; global $attSize; global $attPlanets; global $defTelleriumTick; global $defKryptonTick; global $defMines; global $defProbes; global $defSize; global $input; global $result; global $stats; global $gunPool; global $accuracy; global $shipID; global $attShipAlive; global $attShipRemaining; global $attShipEmped; global $attShipStolen; global $attLostBuffer; global $attEmpedBuffer; global $attStolenBuffer; global $defShipAlive; global $defShipRemaining; global $defShipEmped; global $defShipStolen; global $defLostBuffer; global $defEmpedBuffer; global $defStolenBuffer; global $targetShipAmounts; As I am convinced I can create a very simple OO design out of these.
  9. Here I re-wrote your script (this shows everything from table1 and table2), try it: $db = mysql_connect('localhost', 'username', 'password'); if (FALSE === $db) { header('HTTP/1.0 500 Internal Error'); trigger_error('Failed to connect to the database server, verify your details. (mysql said: ' . mysql_error() . ')'); echo 'The server is experiencing some temporary problems and will be resolved soon, please check back soon.'; exit(0); } if (FALSE === mysql_select_db('database', $db)) { header('HTTP/1.0 500 Internal Error'); trigger_error('Failed to select the database, verify if the database name exists.'); echo 'The server is experiencing some temporary problems and will be resolved soon, please check back soon.'; exit(0); } $number = 1; $separator = '-- %03s ' . str_repeat('-', 60); $result = mysql_query('SELECT * FROM table1 JOIN table2 USING Company'); while ($row = mysql_fetch_assoc($result)) { $company = $row['Company']; $email = $row['Email Address']; $contactPerson = $row['Contact Person']; // -- 001 ----------------------------------------------- // Company: // Email Address: // Contact Person: echo sprintf($separator, $number++), 'Company: ', $company, "<br/>\n", 'Email Address: ', $email, "<br/>\n", 'Contact Person: ', $contactPerson, "<br/>\n<br/>\n", }
  10. $dom = new DomDocument(); if ($dom->load('path/to/xml.file')) { foreach ($dom->childNodes as $node) { //if ('version' === $node->nodeName) { } }
  11. If you post your script we may be able to give you some tips to cut down on that typing.
  12. mjdamato never thought about publishing this as an open-source JS framework?
  13. How do you mean that didn't work, did you get an error? Maybe you could start to define the actual problem instead of just saying "it didn't work" and keep us guessing in the dark.
  14. function battleEngine($input)//1. { include_once 'stats.php'; global $input;//2. see something familiar? It might be wise to learn PHP and proper coding standards first. The problems you encounter is due to the use of globals, your data is messed up and your result is with a great deal of good luck what you expect.
  15. background-image:url(background-image:images/serviceboxes/hardhat.png); should be: background-image:url(images/serviceboxes/hardhat.png); Read a manual every now and then. See http://htmldog.com/reference/cssproperties/background-image/
  16. $calls ="SELECT * FROM `table2` WHERE `Company` LIKE '%$company%'";
  17. SELECT gameID FROM gamedetails WHERE '2010-5-26' BETWEEN startDate AND endDate AND gameIsActive = 1
  18. SELECT * FROM table GROUP BY group_id, contact_id HAVING count(*) > 1
  19. FF uses charCode instead of keyCode
  20. if (isset($_POST['showcode'])) { echo '<textarea>', htmlentities('<table><tr><td>here's your data!</td><td>more of users input</td></tr></table>'), '</textarea>':
  21. INSERT INTO categories (category, position) SELECT '$category' AS category, MAX(position) + 1 AS position FROM categories Although I assume category is a PK and therefor this should work as fine: INSERT INTO categories (category, position) VALUES ('$category', '$curpos') ON DUPLICATE KEY UPDATE position = position + 1
  22. What?? Why would you need JS for this? It's as easy as: <input type="submit" name="dothis" value="Do This"> <input type="submit" name="dothat" value="Do That"> PHP-wise you need: if (isset($_POST['dothis'])) {/* do this */} if (isset($_POST['dothat'])) { /* do that */}
  23. Zend certified engineer, but it's not free. Try to answer these questions, they deal with more advanced concepts of PHP: print sizeof('hello'); print (int) "Hello World"; //what does this code do? (no output) while ($var --> 1) print $var;
  24. Isn't this what data-integrity rules are for? Plus I thought you mentioned that you wanted to keep historical addresses? If you allow your customer to really delete addresses then that can be a problem.
×
×
  • 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.