Jump to content

priyankagound

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by priyankagound

  1. You need to add a GROUP BY clause to get the sum() for each player: eg: SELECT Player.PlayerName, SUM(COALESCE(Exp.ExpChange, 0)) AS exp FROM Player LEFT JOIN Exp ON Player.PlayerID=Exp.PlayerID GROUP BY Player.PlayerName ORDER BY exp;
  2. This one is the code which may help you. if (file_exists($myFile)) { $fh = fopen($myFile, 'a'); fwrite($fh, $message."\n"); } else { $fh = fopen($myFile, 'w'); fwrite($fh, $message."\n"); } fclose($fh); The append mode already does just what you describe.
  3. Hi, Below is the code which may help you to come out with the answer you looking for. <?php try { //open the database $db = new PDO('sqlite:/var/databases/307Code/python/readings.db'); //now output the data to a simple html table... print "<table border=1>"; print "<tr><td>Date & Time Recieved</td><td>Node</td><td>Temp</td><td>Hum</td><td>Light</td><td>Dew</td></tr>"; $result = $db->query('SELECT * FROM readingstable'); foreach($result as $row) { print "<tr><td>".$row['Recieved']."</td>"; print "<td>".$row['Node']."</td>"; print "<td>".$row['Temp']."</td>"; print "<td>".$row['Hum']."</td>"; print "<td>".$row['Light']."</td>"; print "<td>".$row['Dew']."</td></tr>"; } print "</table>"; // close the database connection $db = NULL; }
  4. you can use the concept of bulk insert which executes many inserts at the same time minimizing overhead of calling ExecuteNonQuery multiple times. in MySQL this is called LOAD DATA, check here for details: http://dev.mysql.com/doc/refman/5.5/en/load-data.html in MS SQL Server this is called bulk insert and it's known as such, that's why I've mentioned it with this name.
  5. This may be helpfull to solve your problem. you need to start MYSQL from configuration system.
  6. Syntax highlighting already shows you what's wrong. You need to use double quotes inside the string or escape the single quotes with a backslash. When echoing code it's a good idea to use the heredoc quote syntax; you do not have to escape any quotes inside such a string: echo <<<EOF <script type="text/javascript"> window.addEvent('domready', function() { SqueezeBox.fromElement('modalLink1'); }); </script> EOF; Another solution would be simply ending the PHP mode: ?> <script type="text/javascript"> window.addEvent('domready', function() { SqueezeBox.fromElement('modalLink1'); }); </script> <?php
  7. Here is a solution which will surely help you... This is the example which i tried.. If you add a unique index on (userid, days): -- run this only once ALTER TABLE availability ADD UNIQUE INDEX userid_days_UQ -- just a name for the index (userid, days) ; then you can use the ON DUPLICATE KEY UPDATE syntax: $q = " INSERT INTO availability (userid, days, opentime, closetime) VALUES (?, 'Monday', ?, ?), (?, 'Tuesday', ?, ?), (?, 'Wednesday', ?, ?), (?, 'Thursday', ?, ?), (?, 'Friday', ?, ?), (?, 'Saturday', ?, ?), (?, 'Sunday', ?, ?) ON DUPLICATE KEY UPDATE opentime = VALUES(opentime), closetime = VALUES(closetime) ; ";
  8. Installing WAMP Server to run PATH TO PHP: Goto www.wampserver.com and download WAMP Server. Just install it like other softwares by just clicking next next... Now go to START menu of windows and start wampserver. Generally, the path is Start -> WapmServer -> start WampServer Open your web browser and type http://localhost (or http://127.0.0.1 ) If you see a default WampServer home page, you installation is success. Now put your php code in www folder in your wamp installation directory. Usually this is C:\wamp\www Now type http://localhost/filename.php in your browser. (where filename is your php file name) It will execute your php code.. Thats it...
  9. Here's an idea ........ <input class="checkbox-class" type="checkbox" value="1" /><input class="checkbox-class" type="checkbox" value="2" /> <input class="checkbox-class" type="checkbox" value="3" /> <input type="button" id="clickit" value="Check All" /> This will work to check all the values in the check box
  10. If you are just dealing with excess whitespace on the beginning or end of the string you can usetrim(), ltrim() orrtrim() to remove it. `$str = trim(preg_replace('/\s+/',' ', $str);` This will remove *extra* spaces.
×
×
  • 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.