Jump to content

wwwroth

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by wwwroth

  1. Change while($row2 = mysql_fetch_array($result2)) if($row2[1]=="Active"){ echo $row2[1]; } } to $i = 0; while($row2 = mysql_fetch_array($result2)) { if($row2[1]=="Active"){ $i++; } } echo $i; What's happening here is you define the variable $i as 0, then every time row2[1] equals Active you notch it up 1. Then after the loop you echo the count. This is how you could count it in PHP but it's more efficient and effective to do it the way Barand mentioned. SQL will add up the total number of rows selected by that query and you could echo it by $rw['total'];
  2. You're not sanitizing your database queries. Look at your first query where you insert a $_GET variable right into the SQL string. That means anything a user puts in that URL parameter goes right into your database. This can be devastating. Read more about it at the link below and here's how to solve that problem. Instead of... $query2 = "SELECT EventFees_id, EventFees_item, EventFees_fee, EventFees_event FROM EventFees WHERE EventFees_event = '{$_GET['id']}'"; Make it... $idUrl = mysql_real_escape_string($_GET['id']); $query2 = "SELECT EventFees_id, EventFees_item, EventFees_fee, EventFees_event FROM EventFees WHERE EventFees_event = '{$idUrl}'"; http://php.net/manual/en/security.database.sql-injection.php
×
×
  • 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.