Jump to content

twm

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Everything posted by twm

  1. do {$Computer[2]++;} while ($Computer[2] == $Computer[1]);
  2. well I made a mistake of assuming. If you are storing the page visited in the same table, the VisPG would be that field name (I used it as a placeholder, since I have no idea of your table structure). That way it displays each IP, the page, and how many times the IP hit that page. Wow! That even confused me! Try this: <?PHP $query = "SELECT DISTINCT VisIP, COUNT(VisIP) as VisitCount FROM logs GROUP BY VisIP"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "IP: ". $row['VisIP'] ." Visted ". $row['VisitCount']." times<BR />"; } ?>
  3. wondering if this code would work? <?php include 'header.php'; $horseid = $_POST['horseid']; $userid = $_POST['userid']; $classtype = $_POST['classtype']; $classname = $_POST['classname']; // select entry for user based on horse id and classtype $check_query = "SELECT * FROM winterfest WHERE horseid = $horseid AND classtype = $classtype AND userid = $userid"; $result = mysql_query($check_query) or die(mysql_error()); $num_rows = mysql_num_rows($result); // if there is an entry, display warning if($num_rows >= 1) { echo "<img src='christmas08/winterfestbanner.png'><BR><h1>You have entered this horse already this round.</h1>"; } else { // record entry $sql="INSERT INTO winterfest (horseid, userid, classname, classtype) VALUES ('$horseid','$userid','$classname','$classtype')"; mysql_query($sql) or die(mysql_query()); echo "<img src='christmas08/winterfestbanner.png'><BR><h2>Success! You have entered Winterfest!</h2>"; } ?>
  4. submit the page to itself , then process your data, or check out: http://us.php.net/manual/en/function.header.php
  5. there is a lot of tutorials online how to do it. Google php file upload and you will have plenty to choose from. from the php man pages: http://us3.php.net/features.file-upload
  6. well somewhere in your script you are using the column discipline, which does not exists in the table where you are looking for it
  7. procedure is a reserved word in mysql. change it to procedures, and it should work
  8. if you can only enter one horseid per classtype (per user) try to modify the select query to something like $check_query = "SELECT * FROM winterfest WHERE horseid = $horseid AND classtype = $classtype AND userid = $userid"; if you already have a row with the same horseid and classtype, no insert. A little crude, but hope it works.
  9. <?php $res = mysql_query("SELECT COUNT(Ad_tracker) FROM Training_Inquiries WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= Contact_Date AND Ad_tracker='Google' GROUP BY Ad_tracker"); $res = mysql_fetch_array($res); echo $res[0]." Selected Google.<br>"; ?>
  10. how about if you would keep track of rounds for each entry, and check if the "horseid" was entered for that round?
  11. also missing a comma before PRIMARY. Try this: <?php error_reporting(E_ALL); include ("connectdb.php"); $sql = "CREATE TABLE proc_list ( incr_id int(11) NOT NULL auto_increment, procedures varchar(20) NOT NULL, PRIMARY KEY (incr_id) )"; // Execute query mysql_query($sql); ?>
  12. this could work: <?PHP $date = explode("/",$departureDate); // re-assign to var in mysql format $departureDate = sprintf("%04d-%02d-%02d", $date[2], $date[1], $date[0]); ?>
  13. or try this class: http://www.ros.co.nz/pdf/
  14. I used a filed VisPG for the page , so you might want to replace it with actual field name. (in case the IP and page are recorded in the same table) <?PHP $query = "SELECT DISTINCT VisIP, VisPG, COUNT(VisPG) as VisitCount FROM logs GROUP BY VisPG"; $result = mysql_query($query) or die(mysql_error()); // Print out result while($row = mysql_fetch_array($result)){ echo "IP: ". $row['VisIP'] ." PG:". $row['VisPG']." Visted x ". $row['VisitCount']; echo "<br />"; } ?>
  15. looks like you are asking users to enter the date in dd/mm/yy format, then you are trying to insert it into the DB in the same format. in you database the date field is in yyyy-mm-dd format. maybe you should format the date to mysql format before trying to insert it
×
×
  • 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.