Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> create database testview;
- Query OK, 1 row affected (0.04 sec)
- mysql> use testview;
- Database changed
- mysql> create table t1 ( `blabla` varchar(255), `id` int(11) );
- Query OK, 0 rows affected (0.04 sec)
- mysql> create view v as select * from t1;
- Query OK, 0 rows affected (0.06 sec)
- mysql> select * from v;
- Empty set (0.00 sec)
- mysql> insert into t1 (`blabla`, `id`) values ('blabla', 5);
- Query OK, 1 row affected (0.02 sec)
- mysql> select * from v;
- +--------+------+
- | blabla | id |
- +--------+------+
- | blabla | 5 |
- +--------+------+
- 1 row in set (0.00 sec)
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "blabla";
- $db = "testview";
- $link = mysql_connect($host, $user, $pass);
- mysql_select_db($db);
- $res = mysql_query("select * from v");
- print_r(mysql_fetch_array($res));
- mysql_close($link);
- ?>
- ubadmin@workflow:~$ php testview.php
- Array
- (
- [0] => blabla
- [blabla] => blabla
- [1] => 5
- [id] => 5
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement