Jump to content

DarkMantis

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by DarkMantis

  1. That's a very good analogy. Okay I think I understand now. Thanks again for the clarification! All the best!
  2. Try limiting the Query to 1 ie: $sql="SELECT k.*, u.* FROM korisnik k JOIN uloga u ON k.UlogaID = u.UlogaID WHERE KorisnickoIme = '".$ime."' AND Lozinka = '".$pasvord."' LIMIT 1"; this is from your login.php I don't think this will be a solution but it should prevent any unforseen errors
  3. Hi all, I have been coding in PHP for a fair while now and I have come across variables by reference, but I don't really know: a) how they work; b) when to use them; c) why they are used; Can anyone here please clarify these issues please. Thanks in advance!
  4. Thanks guys, Im using the DateTime::createFromFormat method. Thanks to the both of you though!
  5. Hi Guys, I have got a date string which looks like the following: I need to convert it to format. Any ideas on how to do this? Thanks!
  6. Omg, thank you. That was amazingly useful! Thanks for all your help, you have just taught me a lot. Thanks again!
  7. Hi Guys, I have recently come across the need to extract data from a database and generate a report (in the form of graphs, but that's not really the problem) to see the increase/decrease of registered users between Dates X and Y. I can get the information from the database, but I'm not sure how to sort all the users which registered per day. For example: I want to get all the data from 20-07-2011 to 25-07-2011 and then I need to find the users which registered on the 20th, 21st, 22nd, 23rd, 24th and 25th and put them into appropriate places (I'd assume arrays). Please bare in mind that all dates are stored in unixtimestamps and I'm not very good at timestamps. Any help would be great, my script is below, however, I know it's really badly written, it's only a test-run at the moment. Thanks again! <?php /** * @author DarkMantis * @copyright 2011 */ class GenerateReports{ /** * The constructor of the class */ public function __construct(){ } /** * Gets the RAW data from the database ready to be parsed. * * @param int $startDate * @param int $endDate * @param int $reportType * * @return array $arrOut */ public function getData( $startDate=null, $endDate=null, $reportType=0 ){ $this->ConnectToDb(); //Not a real function //Perform a few little checks to ensure data is passed to the function correctly if( ($startDate == NULL) && ($endDate == NULL) ){ $startDate = strtotime('2000-01-01'); $endDate = strtotime('now'); }else{ $startDate = strtotime($startDate); $endDate = strtotime($endDate); } //Get different report types and data switch($reportType){ case '1': //Get all results between given dates //for($i = 1; $i < 31; $i++){ unset($endDate); $endDate = ($startDate+($i*86400)); $sqlQuery = mysql_query(sprintf( 'SELECT `id`,`date_registration` FROM `crowdcube_users` WHERE `date_registration` > %d AND `date_registration` < %d', $startDate, $endDate )); // } while($arrResult = mysql_fetch_assoc($sqlQuery)){ print_r('<pre>' . var_dump($arrResult) . '</pre>'); if($startDate){ } } break; case 'default': break; } } } //See if the script works $new = new GenerateReports(); $new->getData('2011-07-24', 'now', 1); ?>
  8. I would personally suggest trying to do most of this using jQuery or simular. You could do: $.(document).ready(function(){ $.each("h2").html("Title 1", function(){ $(this).html("Replaced Text"); }); }); However, I'm not overly good with jQuery so you may want to edit that to make it work properly. Hope this helps. DarkMantis
  9. Hey, Both are string I've got that error sorted now it just continously loads without forwarding me to the second page.
  10. My table structure is as follows: ID (int 7) EmailAddress (varchar 255) Password (varchar 255) Thanks
×
×
  • 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.