PHP Classes

File: sample.v3.mysql.php

Recommend this page to a friend!
  Classes of Tom Schaefer   QDataObject   sample.v3.mysql.php   Download  
File: sample.v3.mysql.php
Role: Example script
Content type: text/plain
Description: basic mysql version 3
Class: QDataObject
Access MySQL query results as objects
Author: By
Last change:
Date: 15 years ago
Size: 707 bytes
 

Contents

Class file image Download
<?php

/**
You have to provide an existing connection
for getting a valid resource from mysql, otherwise
it will no work.
Attention: you have to switch to v.0.3
*/

include_once('config.inc.php');

$link = mysql_connect(db_default_host, db_default_user, db_default_password) OR die(mysql_error());
if (!
$link) {
    die(
'keine Verbindung möglich: ' . mysql_error());
}
mysql_select_db(db_default_database, $link) OR die(mysql_error());

$sql = "SELECT * FROM geodb_textdata"; // large db => 337925 records
 
$dataObject = QDataObject::getInstance('mysql',$link, $sql);
$dataObject->byPage(($_GET["p"]?intval($_GET["p"]):1));


print
"<pre>";
print_r($dataObject);
print
"</pre>";