PHP Classes

File: zemysql.demo.php

Recommend this page to a friend!
  Classes of zemin   zeMySql Simple   zemysql.demo.php   Download  
File: zemysql.demo.php
Role: Documentation
Content type: text/plain
Description: example file
Class: zeMySql Simple
Execute simple MySQL database query
Author: By
Last change: updated.
Date: 16 years ago
Size: 1,433 bytes
 

Contents

Class file image Download
<? ##################################################################### #### Writer: zemin E-Posta: developer@ttmail.com ##### #### Class Name: ZMySql Class Date: 12.08.2008 ##### ##################################################################### include("zemysql.class.php"); $config['host'] = "localhost"; $config['user'] = "root"; $config['pass'] = "12345678"; $config['db'] = "test"; function connect_db(){ global $config; $conn=@mysql_connect($config['host'],$config['user'],$config['pass']) or die("Cant connect mysql host ".mysql_error()); $select=@mysql_select_db($config['db'],$conn) or die("Cant select database, ".mysql_error()); } connect_db(); ################################################################ $db = new ZMySql(); $query = $db->get_rows("select title from news"); foreach ($query as $qr){ echo $qr->title; } //echo $db->get_one("select count(*) from news"); ################################################################ //$news= $db->get_row("select * from news where id = 1"); //echo $news->title; ################################################################ //$db->query("update news set title = 'zzzzz' where id = '1'"); //echo $db->affect; ################################################################ //$db->query("insert into news (title,content) VALUES('test','zzzzzzzzzzzz')"); //echo $db->insert_id; ?>