QuerySingleRowArray() public method

Executes the given SQL query and returns the first row as an array
public QuerySingleRowArray ( string $sql, integer $resultType = MYSQLI_BOTH ) : array
$sql string The query string should not end with a semicolon
$resultType integer (Optional) The type of array Values can be: MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH
return array An array containing the first row or FALSE if no row is returned from the query
Esempio n. 1
0
 public function lastCaller()
 {
     $db = new MySQL(true, 'color64', 'localhost', 'color64', 'nu5Jc4JdtZK4RCHH');
     $caller = $db->QuerySingleRowArray('SELECT `user_name` FROM `log` ORDER BY `id` DESC LIMIT 0,1');
     return $caller['user_name'];
 }
Esempio n. 2
0
        print "Bad line in DBF: {$row}";
        exit;
    }
    $sql .= ")";
    //print"<br> $sql";
    //	$sql="UPDATE hkmatrix  SET  hkcategory=$hkcategory, hksupplier=$hksupplier WHERE code=$code";
    $newresults = $db->Query($sql);
    if (!$newresults) {
        die('Error building database!' . $sql);
    }
}
//get supplier from categories
// print"<br>";
for ($i = 1; $i < $num_rec; $i++) {
    $sql = "SELECT supplier FROM hkmatrix WHERE uid = " . $i;
    $results = $db->QuerySingleRowArray($sql);
    $suppcode = $results[0];
    if ($suppcode) {
        $sql2 = "SELECT hksupplier, wwwsupplier FROM categories WHERE code = '" . $suppcode . "'";
        //print $sql2."<br>";
        $subresults = $db->Query($sql2);
        if (!empty($subresults)) {
            $ns = $db->fetchRow($subresults);
            //print_r($ns);
            if ($ns[1]) {
                $newsupp = $db->clean($ns[1]);
            } else {
                $newsupp = $db->clean($ns[0]);
            }
            $sql3 = "UPDATE hkmatrix SET supplier ='" . $newsupp . "' WHERE uid = " . $i;
            //print "<br> $sql3";