PHP mysql_error Examples

PHP mysql_error - 30 examples found. These are the top rated real world PHP examples of mysql_error extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
1
function dbkit_run_query_with_array($sql, $args)
{
    foreach ($args as &$arg) {
        if (is_array($arg)) {
            if (count($arg) == 0) {
                $arg = array(-1);
            }
            $parts = array();
            foreach ($arg as $part) {
                $parts[] = "'" . mysql_real_escape_string("{$part}") . "'";
            }
            $arg = "(" . implode(",", $parts) . ")";
        } else {
            $arg = "'" . mysql_real_escape_string("{$arg}") . "'";
        }
    }
    $sql = str_replace("?", "%s", $sql);
    array_unshift($args, $sql);
    $sql = call_user_func_array('sprintf', $args);
    dbkit_log_query($sql);
    $res = mysql_query($sql);
    if (!$res) {
        die("database query failed: " . mysql_error());
    }
    return $res;
}
function createMainDataElement($plan, $num, $dbConn)
{
    if ($plan['dato_principal_' . $num] != NULL) {
        $query_dato = sprintf("SELECT * FROM tipoDatosServicios WHERE id_tipoDato=%s", GetSQLValueString($plan['id_tipoDato_principal_' . $num], "int"));
        $dato = mysql_query($query_dato, $dbConn) or die(mysql_error());
        $row_dato = mysql_fetch_assoc($dato);
        $display = true;
        $label = "";
        if ($row_dato['tipo'] == "boolean") {
            if ($plan['dato_principal_' . $num] == "1") {
                $label = $row_dato['label'];
            } else {
                $display = false;
            }
        } else {
            if ($row_dato['display_label']) {
                $label = $plan['dato_principal_' . $num] . " " . $row_dato['label'];
            } else {
                $label = $plan['dato_principal_' . $num];
            }
        }
        if ($display) {
            echo "<div class='dato'>";
            echo "\t<li class='tipo_" . $plan['id_tipoDato_principal_' . $num] . "' value='" . $plan['dato_principal_' . $num] . "'>";
            echo $label;
            echo "\t</li>";
            echo "</div>";
        }
    }
    //if
}
Example #3
1
function getEventbriteEvents($eb_keywords, $eb_city, $eb_proximity)
{
    global $eb_app_key;
    $xml_url = "https://www.eventbrite.com/xml/event_search?...&within=50&within_unit=M&keywords=" . $eb_keywords . "&city=" . $eb_city . "&date=This+month&app_key=" . $eb_app_key;
    echo $xml_url . "<br />";
    $xml = simplexml_load_file($xml_url);
    $count = 0;
    // loop over events from eventbrite xml
    foreach ($xml->event as $event) {
        // add event if it doesn't already exist
        $event_query = mysql_query("SELECT * FROM events WHERE id_eventbrite={$event->id}") or die(mysql_error());
        if (mysql_num_rows($event_query) == 0) {
            echo $event_id . " ";
            // get event url
            foreach ($event->organizer as $organizer) {
                $event_organizer_url = $organizer->url;
            }
            // get event address
            foreach ($event->venue as $venue) {
                $event_venue_address = $venue->address;
                $event_venue_city = $venue->city;
                $event_venue_postal_code = $venue->postal_code;
            }
            // get event title
            $event_title = str_replace(array("\r\n", "\r", "\n"), ' ', $event->title);
            // add event to database
            mysql_query("INSERT INTO events (id_eventbrite, \n                                      title,\n                                      created, \n                                      organizer_name, \n                                      uri, \n                                      start_date, \n                                      end_date, \n                                      address\n                                      ) VALUES (\n                                      '{$event->id}',\n                                      '" . parseInput($event_title) . "',\n                                      '" . strtotime($event->created) . "',\n                                      '" . trim(parseInput($event->organizer->name)) . "',\n                                      '{$event_organizer_url}',\n                                      '" . strtotime($event->start_date) . "',\n                                      '" . strtotime($event->end_date) . "',\n                                      '{$event_venue_address}, {$event_venue_city}, {$event_venue_postal_code}'\n                                      )") or die(mysql_error());
        }
        $count++;
    }
}
 /**
  * Find pixels coords and draw these on the current image
  *
  * @param integer $image Number of the image (to be used with $this->height)
  * @return boolean Success
  **/
 function drawPixels($image)
 {
     $limit = 0;
     do {
         /** Select with limit */
         $result = mysql_query(sprintf($this->query, $image * $this->height, ($image + 1) * $this->height - 1) . ' LIMIT ' . $limit . ',' . $this->limit);
         if ($result === false) {
             return $this->raiseError('Query failed: ' . mysql_error());
         }
         $count = mysql_num_rows($result);
         while ($click = mysql_fetch_row($result)) {
             $x = (int) $click[0];
             $y = (int) ($click[1] - $image * $this->height);
             if ($x < 0 || $x >= $this->width) {
                 continue;
             }
             /** Apply a calculus for the step, with increases the speed of rendering : step = 3, then pixel is drawn at x = 2 (center of a 3x3 square) */
             $x -= $x % $this->step - $this->startStep;
             $y -= $y % $this->step - $this->startStep;
             /** Add 1 to the current color of this pixel (color which represents the sum of clicks on this pixel) */
             $color = imagecolorat($this->image, $x, $y) + 1;
             imagesetpixel($this->image, $x, $y, $color);
             $this->maxClicks = max($this->maxClicks, $color);
             if ($image === 0) {
                 /** Looking for the maximum height of click */
                 $this->maxY = max($y, $this->maxY);
             }
         }
         /** Free resultset */
         mysql_free_result($result);
         $limit += $this->limit;
     } while ($count === $this->limit);
     return true;
 }
Example #5
0
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
    $link=mysql_connect ("$servername","$dbuser","$dbpassword",TRUE);
    if(!$link){die("Could not connect to MySQL");}
    mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
    return $link;
}
Example #6
0
 public function find()
 {
     $result = array();
     $where = 'where 1 = 1 ';
     foreach ($this->columns as $objCol => $dbCol) {
         if ($this->{$objCol}) {
             $where .= " and {$dbCol} = {$this->{$objCol}}";
             //only bug: here I " and {$objCol} = {$this->$objCol}"; but with former experience, I know that database handling is the place where bug fills. So I var_dump($sql) and find it.
         }
     }
     $sql = "select * from {$this->table} {$where}";
     //		var_dump($sql);
     DataConnection::getConnection();
     $rs = mysql_query($sql) or die(mysql_error());
     $row = mysql_fetch_array($rs);
     while ($row) {
         $o = clone $this;
         foreach ($o->columns as $objCol => $dbCol) {
             $o->{$objCol} = $row[$dbCol];
         }
         $result[] = $o;
         $row = mysql_fetch_array($rs);
     }
     return $result;
 }
Example #7
0
 /**
  * execute query - show be regarded as private to insulate the rest of
  * the application from sql differences
  * @access private
  */
 function query($sql)
 {
     global $CONF;
     if (is_null($this->dblink)) {
         $this->_connect();
     }
     //been passed more parameters? do some smart replacement
     if (func_num_args() > 1) {
         //query contains ? placeholders, but it's possible the
         //replacement string have ? in too, so we replace them in
         //our sql with something more unique
         $q = md5(uniqid(rand(), true));
         $sql = str_replace('?', $q, $sql);
         $args = func_get_args();
         for ($i = 1; $i <= count($args); $i++) {
             $sql = preg_replace("/{$q}/", "'" . preg_quote(mysql_real_escape_string($args[$i])) . "'", $sql, 1);
         }
         //we shouldn't have any $q left, but it will help debugging if we change them back!
         $sql = str_replace($q, '?', $sql);
     }
     $this->dbresult = mysql_query($sql, $this->dblink);
     if (!$this->dbresult) {
         die("Query failure: " . mysql_error() . "<br />{$sql}");
     }
     return $this->dbresult;
 }
Example #8
0
 public function query($sql)
 {
     if ($this->link) {
         $resource = mysql_query($sql, $this->link);
         if ($resource) {
             if (is_resource($resource)) {
                 $i = 0;
                 $data = array();
                 while ($result = mysql_fetch_assoc($resource)) {
                     $data[$i] = $result;
                     $i++;
                 }
                 mysql_free_result($resource);
                 $query = new \stdClass();
                 $query->row = isset($data[0]) ? $data[0] : array();
                 $query->rows = $data;
                 $query->num_rows = $i;
                 unset($data);
                 return $query;
             } else {
                 return true;
             }
         } else {
             $trace = debug_backtrace();
             trigger_error('Error: ' . mysql_error($this->link) . '<br />Error No: ' . mysql_errno($this->link) . '<br /> Error in: <b>' . $trace[1]['file'] . '</b> line <b>' . $trace[1]['line'] . '</b><br />' . $sql);
         }
     }
 }
Example #9
0
 function RetrieveRecordArray($filter = null)
 {
     $dtoArray = array();
     $query = "SELECT SUBC.*, TIPC.sigla as siglaTipoContrato FROM subContrato SUBC JOIN tipoContrato TIPC ON SUBC.tipocontrato_id = TIPC.id WHERE removido = 0";
     if (!empty($filter)) {
         $query = $query . " AND " . $filter;
     }
     $recordSet = mysql_query($query, $this->mysqlConnection);
     if (!$recordSet && $this->showErrors) {
         print_r(mysql_error());
         echo '<br/><br/>';
     }
     $recordCount = mysql_num_rows($recordSet);
     if ($recordCount == 0) {
         return $dtoArray;
     }
     $index = 0;
     while ($record = mysql_fetch_array($recordSet)) {
         $dto = new SubContractDTO();
         $dto->id = $record['id'];
         $dto->codigoContrato = $record['contrato_id'];
         $dto->codigoTipoContrato = $record['tipoContrato_id'];
         $dto->siglaTipoContrato = $record['siglaTipoContrato'];
         $dtoArray[$index] = $dto;
         $index++;
     }
     mysql_free_result($recordSet);
     return $dtoArray;
 }
Example #10
0
function getWebmbyid($id)
{
    global $link;
    $query = "SELECT * FROM twebm WHERE cId = {$id}";
    $result = $link->query($query) or die('Запрос не удался: ' . mysql_error());
    return mysqli_fetch_array($result, MYSQLI_ASSOC);
}
function send($to, $sub, $msg)
{
    $con = mysql_connect("localhost", "root", "password");
    if (!$con) {
        echo mysql_error();
    }
}
Example #12
0
function getInsert($param, $name, $score)
{
    $dbParams = get_object_vars($param);
    $mysql_host = $dbParams['mysql_host'];
    $mysql_user = $dbParams['mysql_user'];
    $mysql_pass = $dbParams['mysql_pass'];
    $dbName = $dbParams['dbName'];
    $dbTable = $dbParams['dbTable'];
    //connect
    $link = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('connection error: ' . mysql_error());
    //select db
    mysql_select_db($dbName) or die('DB error');
    //check user highest score
    $query_check_user = 'SELECT score FROM ' . $dbTable . ' WHERE name = ' . $name . ';';
    $result_check_user = mysql_query($query_check_user) or die('Request down: ' . mysql_error());
    $checkUser = mysql_fetch_array($result_check_user);
    if ($checkUser['score'] < $score) {
        //inserting new scores
        $query_insert = 'INSERT INTO ' . $dbTable . '(name,score) VALUES (' . $name . ',' . $score . ') ON DUPLICATE KEY UPDATE score = VALUES(score);';
        $result = mysql_query($query_insert) or die('Request insert down: ' . mysql_error());
    }
    return $result;
    // clean
    if (isset($result)) {
        mysql_free_result($result);
    }
    // close
    mysql_close($link);
}
Example #13
0
function fromOpenID2CardID($openid)
{
    $mysql_host = SAE_MYSQL_HOST_M;
    $mysql_host_s = SAE_MYSQL_HOST_S;
    $mysql_port = SAE_MYSQL_PORT;
    $mysql_user = SAE_MYSQL_USER;
    $mysql_password = SAE_MYSQL_PASS;
    $mysql_database = SAE_MYSQL_DB;
    $mysql_table = "member";
    $mysql_state = "SELECT * FROM " . $mysql_table . " WHERE `openid` = '" . $openid . "'";
    $con = mysql_connect($mysql_host . ':' . $mysql_port, $mysql_user, $mysql_password, true);
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_query("SET NAMES 'UTF8'");
    mysql_select_db($mysql_database, $con);
    $result = mysql_query($mysql_state);
    $cardID = "";
    while ($row = mysql_fetch_array($result)) {
        $cardID = $row['cardid'];
        break;
    }
    mysql_close($con);
    return $cardID;
}
Example #14
0
 function query($sql, $unbuffered = false)
 {
     if (defined('PUN_SHOW_QUERIES')) {
         $q_start = get_microtime();
     }
     if ($unbuffered) {
         $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
     } else {
         $this->query_result = @mysql_query($sql, $this->link_id);
     }
     if ($this->query_result) {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
         }
         ++$this->num_queries;
         return $this->query_result;
     } else {
         if (defined('PUN_SHOW_QUERIES')) {
             $this->saved_queries[] = array($sql, 0);
         }
         $this->error_no = @mysql_errno($this->link_id);
         $this->error_msg = @mysql_error($this->link_id);
         return false;
     }
 }
Example #15
0
function check_db($dbhost, $dbuser, $dbpw, $dbname, $tablepre)
{
    if (!function_exists('mysql_connect')) {
        show_msg('undefine_func', 'mysql_connect', 0);
    }
    if (!@mysql_connect($dbhost, $dbuser, $dbpw)) {
        $errno = mysql_errno();
        $error = mysql_error();
        if ($errno == 1045) {
            show_msg('database_errno_1045', $error, 0);
        } elseif ($errno == 2003) {
            show_msg('database_errno_2003', $error, 0);
        } else {
            show_msg('database_connect_error', $error, 0);
        }
    } else {
        if ($query = @mysql_query("SHOW TABLES FROM {$dbname}")) {
            while ($row = mysql_fetch_row($query)) {
                if (preg_match("/^{$tablepre}/", $row[0])) {
                    return false;
                }
            }
        }
    }
    return true;
}
Example #16
0
 public function query($sql)
 {
     $resource = mysql_query($sql, $this->link);
     if ($resource) {
         if (is_resource($resource)) {
             $i = 0;
             $data = array();
             while ($result = mysql_fetch_assoc($resource)) {
                 $data[$i] = $result;
                 $i++;
             }
             mysql_free_result($resource);
             $query = new stdClass();
             $query->row = isset($data[0]) ? $data[0] : array();
             $query->rows = $data;
             $query->num_rows = $i;
             unset($data);
             return $query;
         } else {
             return true;
         }
     } else {
         trigger_error('Error: ' . mysql_error($this->link) . '<br />Error No: ' . mysql_errno($this->link) . '<br />' . $sql);
         exit;
     }
 }
Example #17
0
 function DrawPart($parent, $pref)
 {
     $res = runsql("select t.{$this->id},t.Name_\$lang; as Name from {$this->table} t left outer join {$this->table} p on p.{$this->id}=t.{$this->id} where t.Parent='{$parent}' and t.{$this->id}<>t.Parent group by t.{$this->id} order by t.Name_\$lang;");
     if (mysql_error()) {
         print mysql_error();
         exit;
     }
     while ($r = mysql_fetch_array($res)) {
         $num++;
         unset($str);
         if ($pref) {
             $str = "{$pref}";
         }
         if ($this->numbered == 1) {
             $str .= "{$num}.";
         } elseif ($parent != '0') {
             $str .= "&nbsp;&nbsp;";
         }
         if ($this->type == "select") {
             print " <option value=\"{$r['0']}\"";
             if ($r[0] == $this->val) {
                 print " selected";
             }
             print ">{$str} {$r['1']}</option>";
         } else {
             print "{$str} <a href=\"{$PHP_SELF}?id={$r['0']}\">{$r['1']}</a>";
             print "<br>";
         }
         $r[types] += $this->DrawPart($r[0], $str);
     }
     return $r[types];
 }
Example #18
0
 public function add_dados_obra_bd()
 {
     $query = "INSERT INTO obras ";
     $campos = '(';
     foreach ($this as $key => $value) {
         if (!empty($value)) {
             $campos .= "{$key}, ";
         }
     }
     $campos = substr($campos, 0, -2);
     $campos .= ')';
     $valores = ' VALUES (';
     foreach ($this as $key => $value) {
         $replace = array("'", '*', '==', '=', '<', '>', '||', '/', '\\');
         $value = str_replace($replace, '', $value);
         if (!empty($value)) {
             $valores .= "'{$value}', ";
         }
     }
     $valores = substr($valores, 0, -2);
     $valores .= ') ';
     $sql = new Sql();
     $sql->conn_bd();
     mysql_query($query . $campos . $valores) or print mysql_error();
     $result = mysql_query("SELECT id_tabela FROM obras ORDER BY id DESC");
     $row = mysql_fetch_array($result);
     if (!empty($row['id_tabela'])) {
         return $row['id_tabela'];
     }
     return null;
 }
 function connect()
 {
     require_once 'db_config.php';
     $con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
     $db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error());
     return $con;
 }
 function RetrieveRecordArray($filter = null)
 {
     $dtoArray = array();
     $query = "SELECT * FROM cobranca WHERE removido = 0 AND " . $filter;
     if (empty($filter)) {
         $query = "SELECT * FROM cobranca WHERE removido = 0";
     }
     $recordSet = mysql_query($query, $this->mysqlConnection);
     if (!$recordSet && $this->showErrors) {
         print_r(mysql_error());
         echo '<br/><br/>';
     }
     $recordCount = mysql_num_rows($recordSet);
     if ($recordCount == 0) {
         return $dtoArray;
     }
     $index = 0;
     while ($record = mysql_fetch_array($recordSet)) {
         $dto = new ContractChargeDTO();
         $dto->id = $record['id'];
         $dto->codigoContrato = $record['contrato_id'];
         $dto->codigoSubContrato = $record['subContrato_id'];
         $dto->codigoContador = $record['contador_id'];
         $dto->modalidadeMedicao = $record['modalidadeMedicao'];
         $dto->fixo = $record['fixo'];
         $dto->variavel = $record['variavel'];
         $dto->franquia = $record['franquia'];
         $dto->individual = $record['individual'];
         $dtoArray[$index] = $dto;
         $index++;
     }
     mysql_free_result($recordSet);
     return $dtoArray;
 }
Example #21
0
function sqlQuery($sql)
{
    global $db_conn;
    // execute query
    $db_result = mysql_query($sql, $db_conn);
    // if db_result is null then trigger error
    if ($db_result === null) {
        trigger_error(mysql_errno() . ": " . mysql_error() . "\n");
        exit;
    }
    // prepare result array
    $resultSet = array();
    // if resulted array isn't true and that is in case of select statement then open loop
    // (insert / delete / update statement will return true on success)
    if ($db_result !== true) {
        // loop through fetched rows and prepare result set
        while ($row = mysql_fetch_array($db_result, MYSQL_NUM)) {
            // first column of the fetched row $row[0] is used for array key
            // it could be more elements in one table cell
            $resultSet[$row[0]][] = $row;
        }
    }
    // return result set
    return $resultSet;
}
Example #22
0
function getTangentText($type, $keyword)
{
    global $dbHost, $dbUser, $dbPassword, $dbName;
    $link = @mysql_connect($dbHost, $dbUser, $dbPassword);
    if (!$link) {
        die("Cannot connect : " . mysql_error());
    }
    if (!@mysql_select_db($dbName, $link)) {
        die("Cannot find database : " . mysql_error());
    }
    $result = mysql_query("SELECT sr_keywords, sr_text FROM soRandom WHERE sr_type = '" . $type . "' ORDER BY sr_ID ASC;", $link);
    $tempCounter = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $pKey = "/" . $keyword . "/";
        $pos = preg_match($pKey, $row['sr_keywords']);
        //echo $pos . " is pos<br>";
        //echo $keyword;
        //echo " is keyword and this is the search return: " . $row['keywords'];
        if ($pos != 0) {
            $text[$tempCounter] = stripslashes($row["sr_text"]);
            $tempCounter++;
        }
    }
    mysql_close($link);
    //$text=htmlentities($text);
    return $text;
}
Example #23
0
function connect_return()
{
    global $db, $dbname, $eoc_dbname;
    if ($db) {
        mysql_select_db($db, $dbname) or die("Impossible to select {$eoc_dbname} : " . mysql_error());
    }
}
function alertnoticias_consultar($consulta,$accion)
{
	$enlace = mysql_connect('atc-nh-natsdb.nationalnet.com', 'staffcenter','XgwofvLY2ayLf') or die('No pudo conectarse : ' . mysql_error());
	mysql_select_db('staffcenter',$enlace) or die('No pudo seleccionarse la BD.');
	$sql = $consulta;
	$resultado = mysql_query($sql,$enlace) or die('La consulta fall&oacute;: ' . mysql_error());
	while ($row = mysql_fetch_array($resultado)){
	
		switch($accion)
		{
			case "noticiasdeldia":
				$idsnoticias[]=$row['idnoticia'].",".$row['titulo'];
			break;
		
		}
	}
	mysql_free_result($resultado);
	
	switch($accion)
	{
		case "noticiasdeldia":
			return $idsnoticias;
		break;
	}
}
Example #25
0
 /**
  * Construct the OAuthStoreMySQL.
  * In the options you have to supply either:
  * - server, username, password and database (for a mysql_connect)
  * - conn (for the connection to be used)
  * 
  * @param array options
  */
 function __construct($options = array())
 {
     if (isset($options['conn'])) {
         $this->conn = $options['conn'];
     } else {
         if (isset($options['server'])) {
             $server = $options['server'];
             $username = $options['username'];
             if (isset($options['password'])) {
                 $this->conn = mysql_connect($server, $username, $options['password']);
             } else {
                 $this->conn = mysql_connect($server, $username);
             }
         } else {
             // Try the default mysql connect
             $this->conn = mysql_connect();
         }
         if ($this->conn === false) {
             throw new OAuthException2('Could not connect to MySQL database: ' . mysql_error());
         }
         if (isset($options['database'])) {
             if (!mysql_select_db($options['database'], $this->conn)) {
                 $this->sql_errcheck();
             }
         }
         $this->query('set character set utf8');
     }
 }
Example #26
0
function LIBDBERROR($num,$st) {
    @ob_get_clean();
    ob_start();
    echo "\nLIBDB: [ ".dechex($num)." ] $st\n" . mysql_error()."\n";
    debug_print_backtrace();
    die(json_encode(array("err" => ob_get_clean())));
  }
Example #27
0
 function Query($sqlString)
 {
     if (!($resourseId = @mysql_query($sqlString, $this->dbId))) {
         die("<b>MySQL</b>: Unable to execute<br /><b>SQL</b>: " . $sqlString . "<br /><b>Error (" . mysql_errno() . ")</b>: " . @mysql_error());
     }
     return $resourseId;
 }
function executesql($sql, $link)
{
    if (!mysql_query($sql, $link)) {
        die('Error: ' . mysql_error());
        exit(0);
    }
}
function checkIndividually()
{
    #----------------------------------------------------------------------
    global $competitionCondition, $chosenWhich;
    echo "<hr /><p>Checking <b>" . $chosenWhich . " individual results</b>... (wait for the result message box at the end)</p>\n";
    #--- Get all results (id, values, format, round).
    $dbResult = mysql_query("\n    SELECT\n      result.id, formatId, roundId, personId, competitionId, eventId, result.countryId,\n      value1, value2, value3, value4, value5, best, average\n    FROM Results result, Competitions competition\n    WHERE competition.id = competitionId\n      {$competitionCondition}\n    ORDER BY formatId, competitionId, eventId, roundId, result.id\n  ") or die("<p>Unable to perform database query.<br/>\n(" . mysql_error() . ")</p>\n");
    #--- Build id sets
    $countryIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Countries")));
    $competitionIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Competitions")));
    $eventIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Events")));
    $formatIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Formats")));
    $roundIdSet = array_flip(getAllIDs(dbQuery("SELECT id FROM Rounds")));
    #--- Process the results.
    $badIds = array();
    echo "<pre>\n";
    while ($result = mysql_fetch_array($dbResult)) {
        if ($error = checkResult($result, $countryIdSet, $competitionIdSet, $eventIdSet, $formatIdSet, $roundIdSet)) {
            extract($result);
            echo "Error: {$error}\nid:{$id} format:{$formatId} round:{$roundId}";
            echo " ({$value1},{$value2},{$value3},{$value4},{$value5}) best+average({$best},{$average})\n";
            echo "{$personId}   {$countryId}   {$competitionId}   {$eventId}\n\n";
            $badIds[] = $id;
        }
    }
    echo "</pre>";
    #--- Free the results.
    mysql_free_result($dbResult);
    #--- Tell the result.
    noticeBox2(!count($badIds), "All checked results pass our checking procedure successfully.<br />" . wcaDate(), count($badIds) . " errors found. Get them with this:<br /><br />SELECT * FROM Results WHERE id in (" . implode(', ', $badIds) . ")");
}
Example #30
-1
	function edit_news($id){
		if(isset($_POST['simpan'])){
			if($_POST['simpan']){
				if(!detectBlank($_POST)){
					$kategori = eraseStrange($_POST['kategori']);
					$link = eraseStrange($_POST['link']);
					$content = eraseStrange($_POST['content']);
					$status = preg_replace("@[^0-9]@i","",$_POST['status']);
					if($status=="")	$status = "0";
					$sql = "update tbl_tips set kategori='$kategori', content='$content', link='$link',
							status='$status' where id=$id";
					#echo $sql;
					if($this->exQ($sql)){
						$this->pesan = "Tips telah diedit !";
						return true;
					}else{
						echo mysql_error();
						#redirect("../error.php?p=1");
						die();
					}
				}else{
					$this->pesan = "Isilah semua field yang disediakan !";
					return false;
				}
			}
		}
		return false;
	}