UPS.,., onda sam izgleda omashio forum i profesiju.,.,.
Ovo nadjosh na phpinsider-u.,.,
Code:
<?php
include_once("DB.php");
// create object
$smarty = new Smarty;
$dsn = "dbtype://username:password@hostname/dbname";
$db = DB::connect($dsn, true);
if (DB::isError($dsn))
die ($db->getMessage());
/*
* Here is the SQL statement we use to specify
* our table headings.
*/
$sql = "SELECT
first_name AS \"First name\",
last_name AS \"Last Name\",
company AS \"Company\",
address_1 AS \"Address 1\",
address_2 AS \"Address 2\",
city AS \"City\",
state AS \"State\",
zip_code AS \"Zip Code\",
tel_work AS \"Phone (Work)\",
tel_cell AS \"Cell\",
tel_fax AS \"FAX\",
email AS \"Email\",
url AS \"Website\"
FROM contacts
ORDER BY last_name";
$result = $db->query($sql);
if (DB::isError($result))
die ($result->getMessage());
// Initialize some new variables we will now use.
$head;
$hash;
$row;
$x = 0;
/*
* Important to create an associative array, as this will
* return the headers as we had specified in our SQL
* statement.
*/
$hash = $result->fetchRow(DB_FETCHMODE_ASSOC);
$head = array_keys($hash);
$row[$x] = array_values($hash);
$x++;
// Now we fetch the other rows from our query.
while ($hash = $result->fetchRow(DB_FETCHMODE_ASSOC))
{
$row[$x] = array_values($hash);
$x++;
}
// Create Smarty arrays.
$smarty->assign('headers', $head);
$smarty->assign('test', $row);
// display it
$smarty->display('index.tpl');
?>
Mora da ovo nema nikakve veze sa bazama niti vadjenjem podataka iz dotichne.,.,., kao shto rekoh izvinjavam se shto sam hteo da pomognem ovoj komuni barem malo.
Sajt sa dnevnim vestima vezanim za fotografiju, foto aparate i obradu slika
[url]http://www.dphotonews.com[/url]