source: trunk/Run.php

Last change on this file was 32, checked in by chronos, 5 years ago
  • Modified: Improved code formatting.
File size: 679 bytes
Line 
1<?php
2
3class Runner
4{
5 var $Name;
6 var $Gender;
7 var $Team;
8 var $ChipNumber;
9
10 function AddIfNotExist($ReturnQuery = false)
11 {
12 $DbResult = $this->Database->select('Runner', '*',
13 '(`Name` = "'.$this->Database->real_escape_string($this->Name).'")');
14 if ($DbResult->num_rows == 0)
15 {
16 $Result = $this->Database->GetInsert('Runner', array(
17 'Name' => $this->Name,
18 'Gender' => $this->Gender,
19 'Team' => $this->Team,
20 'ChipNumber' => $this->ChipNumber,
21 ));
22 $this->Id = $this->Database->insert_id;
23 } else {
24 $DbRow = $DbResult->fetch_assoc();
25 $this->Id = $DbRow['Id'];
26 }
27 return $Result;
28 }
29}
Note: See TracBrowser for help on using the repository browser.