コード例 #1
0
ファイル: func.php プロジェクト: bakyt/Dolphin.php
function array_display($array)
{
	echo "<table border=1 cellpadding=2 cellspacing=2><tr><td colspan=2 style='text-align:center;'><b>array</b></td></tr>";
	
	foreach($array as $key=>$value)
	{
		if(!is_array($value))
		{
			echo "<tr><td width=100><i>".$key."</i></td><td>".$value."</td></tr>";
		}else
		{
			echo "<tr><td width=100><i><b style='color:red;'>".$key."</b></i></td><td>";
			array_display($value);
			echo "</td></tr>";
		}
	}

	echo "</table>";
}
コード例 #2
0
ファイル: test.php プロジェクト: sibero/moosql
     break;
 }
 echo 'Done.<br><br>';
 //flush();
 echo 'Doing second SELECT.<br>';
 $res = $db->select(TABLE, array('col' => 'id,rand,bad_rand,data', 'order' => 'id', 'limit' => '0,' . $rows, 'cond' => 'bad_rand = ' . $bad_rand));
 $second = sizeof($res);
 echo 'Rows acquired: ' . $second . '<br><br>';
 if ($first - 1 != $second) {
     die('Test failed');
 }
 check_consistency();
 echo 'Trying to delete inexistent row, using UNIQUE.<br>';
 $ures = $db->delete(TABLE, array('cond' => 'rand = ' . $deleted_res[0]['rand'], 'limit' => '1'));
 if ($ures !== array()) {
     die('Returned some result.' . array_display($res));
 }
 echo 'Test passed (0 rows returned).<br><br>';
 echo 'Trying to delete existing row, using UNIQUE.<br>';
 /* should be equal to bad_rand = $bad_rand , limit 1 */
 $deleted_res2 = $db->delete(TABLE, array('cond' => 'rand = ' . $res[0]['rand'], 'limit' => '1'));
 echo 'Rows deleted: ' . sizeof($deleted_res2) . '.<br>';
 echo 'Deleted row rand: ' . $res[0]['rand'] . '<br><br>';
 foreach ($data as $k => $v) {
     if ($v['bad_rand'] != $bad_rand) {
         continue;
     }
     unset($data[$k]);
     if ($deleted_res2[0]['id'] != $k) {
         die('Invalid deleted ID.');
     }