OSDN Git Service

make_linkを作りなおし
[pukiwiki/pukiwiki.git] / mysql.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: mysql.php,v 1.1 2003/01/27 05:44:11 panda Exp $
6 //
7
8 function db_exec($sql)
9 {
10         $conn = mysql_pconnect()
11                 or die_message('cannot connect db.');
12         mysql_select_db('pukiwiki',$conn)
13                 or die_message('cannot select db.');
14         $result = mysql_query($sql,$conn)
15                 or die_message("query '$sql' failure.\n".mysql_error($conn));
16         return $result;
17 }
18
19
20 function db_query($sql)
21 {
22         $result = db_exec($sql);
23         
24         $rows = array();
25         while ($row = mysql_fetch_array($result)) {
26                 $rows[] = $row;
27         }
28         mysql_free_result($result);
29
30         return $rows;
31 }
32
33 /*
34 create table page (id integer auto_increment primary key, name text not null, lastmod integer not null);
35 create table link (page_id integer not null, ref_id integer not null);
36 */
37 ?>