I can't get this to work.
<?php
function __autoload($classname){
include 'inc/classes/' . $classname . '.class.php';
}
__autoload("queries")
$travel = new queries();
echo $travel->getPar("price");
?>
And this is the inc/classes/queries.class.php file.
<?
class queries {
function getPar($par, $table='travel', $type='select') {
$result = $db->query("
$type *
FROM $table
WHERE
$par LIKE
");
while ($row = $result->fetch_assoc()) {
return "
$row[$par]
";
}
}
}
?>
It returns "Class 'queries' not found". What's wrong with it?
EDIT:
Fatal error: Cannot redeclare __autoload() (previously declared in /index.php:5) in /index.php on line 5
What the hell? I can't redeclare a function that is already declared in its own line, why?