Пример #1
0
 /** Specifies the contents of the default page. */
 public function index()
 {
     $add_url = array('url' => 'test/add', 'title' => lang('add_test'));
     create_test_table();
     $data['ajax_source'] = 'test/table/';
     $data['page_title'] = lang('tests');
     $data['action_urls'] = array($add_url);
     $this->load->view('templates/header', $data);
     $this->authenticate->authenticate_redirect('templates/list_view', $data, UserRole::Admin);
     $this->load->view('templates/footer');
 }
Пример #2
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('num_rows'));
var_dump(mysql_query("insert into test_num_rows (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_num_rows');
var_dump(mysql_num_rows($res));
Пример #3
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('affected_rows'));
var_dump(mysql_query("INSERT INTO test_affected_rows (name) values ('test'),('test2')"));
var_dump(mysql_affected_rows());
Пример #4
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('fetch_assoc'));
var_dump(mysql_query("insert into test_fetch_assoc (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_fetch_assoc');
$row = mysql_fetch_assoc($res);
print_r($row);
Пример #5
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('fetch_row'));
var_dump(mysql_query("insert into test_fetch_row (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_fetch_row');
$row = mysql_fetch_row($res);
print_r($row);
Пример #6
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('num_fields'));
var_dump(mysql_query("INSERT INTO test_num_fields (name) VALUES ('test'),('test2')"));
$res = mysql_query('select * from test_num_fields');
var_dump(mysql_num_fields($res));
Пример #7
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('field_len'));
var_dump(mysql_query("insert into test_field_len (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_field_len');
var_dump(mysql_field_len($res, 1));
Пример #8
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('lengths'));
var_dump(mysql_query("insert into test_lengths (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_lengths');
$row = mysql_fetch_row($res);
$lengths = mysql_fetch_lengths($res);
print_r($lengths);
// A much more intense test on lengths
mysql_query('drop table testlen');
var_dump(mysql_query("create table testlen (id int not null auto_increment, " . "d decimal(10,5), t tinyint, i int, b bigint, f float, " . "db double, y2 year(2), y4 year(4), primary key (id)) " . "engine=innodb"));
var_dump(mysql_query("insert into testlen(d, t, i, b, f, db, y2, y4) values" . "(.343, null, 384, -1, 03.44, -03.43892874e101, 00, 0000)"));
$res = mysql_query('select * from testlen');
$row = mysql_fetch_row($res);
$lengths = mysql_fetch_lengths($res);
print_r($lengths);
Пример #9
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('data_seek'));
var_dump(mysql_query("insert into test_data_seek (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_data_seek');
var_dump(mysql_data_seek($res, 1));
$row = mysql_fetch_assoc($res);
print_r($row);
Пример #10
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('field_flags'));
var_dump(mysql_query("insert into test_field_flags (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_field_flags');
var_dump(mysql_field_flags($res, 0));
Пример #11
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('result'));
var_dump(mysql_query("insert into test_result (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_result');
var_dump(mysql_result($res, 1, 1));
Пример #12
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
// No warnings from normal operation
var_dump(create_test_table('warning'));
var_dump(mysql_warning_count($conn));
var_dump(mysql_query("INSERT INTO test_warning (name) VALUES ('test'),('test2')"));
var_dump(mysql_warning_count($conn));
// Dropping a non-existent table with IF EXISTS generates a warning.
var_dump(mysql_query("DROP TABLE IF EXISTS no_such_table"));
var_dump(mysql_warning_count($conn));
// Dropping an existing table generates no warnings.
var_dump(mysql_query("DROP TABLE IF EXISTS test_warning"));
var_dump(mysql_warning_count($conn));
Пример #13
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('field_type'));
var_dump(mysql_query("insert into test_field_type (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_field_type');
var_dump(mysql_field_type($res, 1));
Пример #14
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('field_name'));
var_dump(mysql_query("insert into test_field_name (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_field_name');
var_dump(mysql_field_name($res, 1));
Пример #15
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('un_query'));
var_dump(mysql_query("insert into test_un_query (name) values ('test'),('test2')"));
$res = mysql_unbuffered_query('select * from test_un_query');
$row = mysql_fetch_assoc($res);
print_r($row);
$row = mysql_fetch_assoc($res);
print_r($row);
$row = mysql_fetch_assoc($res);
var_dump($row);
Пример #16
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('free_result'));
$res = mysql_query('select * from test_free_result');
var_dump(mysql_free_result($res));
Пример #17
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('field_seek'));
var_dump(mysql_query("insert into test_field_seek (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_field_seek');
var_dump(mysql_field_seek($res, 1));
var_dump(mysql_fetch_field($res)->name);
Пример #18
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('info'));
var_dump(mysql_query("insert into test_info (name) values ('test'),('test2')"));
var_dump(mysql_info());
Пример #19
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('fetch_object'));
var_dump(mysql_query("insert into test_fetch_object (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_fetch_object');
$row = mysql_fetch_object($res);
var_dump($row->name);
Пример #20
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('fetch_array'));
var_dump(mysql_query("insert into test_fetch_array (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_fetch_array');
$row = mysql_fetch_array($res);
print_r($row);
Пример #21
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('insert_id'));
var_dump(mysql_query("insert into test_insert_id (name) values ('test'),('test2')"));
var_dump(mysql_insert_id());
Пример #22
0
<?php

require_once 'connect.inc';
$conn = mysql_connect($host, $user, $passwd);
var_dump(create_test_table('fetch_field'));
var_dump(mysql_query("insert into test_fetch_field (name) values ('test'),('test2')"));
$res = mysql_query('select * from test_fetch_field');
var_dump(mysql_fetch_field($res, 1)->name);