|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mcjules Smarty n00b
Joined: 01 Mar 2004 Posts: 1
|
Posted: Mon Mar 01, 2004 12:32 am Post subject: php query problem... |
|
|
Hello,
I don't think my problem is related to Smarty... I have a php error before I get any debug window from smarty.
Anyway, I can't figure out what's wrong with this very basic query, so I thought you might !
Here is the code:
<?
// tutorial.php
#include "/Library/WebServer/Documents/smartytut/functions.inc";
require '/usr/lib/php/Smarty.class.php';
#variables mysql
$utilisateur = "root";
$motdepasse = "";
$base = "authentication";
$hote = "localhost";
$smarty = new Smarty;
#connexion à la base
dbconnect ($utilisateur, $motdepasse, $base, $hote);
#requete sur la base
$query = "select * from people";
$people = sql_query($query);
#remplir l'objet smarty et afficher
$smarty->assign('people', $people);
$smarty->display('tutorial.tpl');
#fermer connexion
mysql_close();
function dbconnect ($utilisateur, $motdepasse, $base, $hote) {
$connexion = mysql_connect($hote, $utilisateur, $motdepasse) or die("Unable to connect to database");
@mysql_select_db($base, $connexion) or die( "Unable to select database");
}
function sql_query ($query) {
$result = mysql_query($query);
$return_array = array();
while ($row = mysql_fetch_array($result)) {
array_push($return_array, $row);
}
mysql_free_result($result);
return $return_array;
}
?>
It says "Parse error: parse error in .....Documents/smartytut/tutorial.php on line 38".
I can't figure out where the error comes from.
Thank you very much in advance for taking a look at my code !
Julien |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Mar 01, 2004 1:26 am Post subject: |
|
|
hmm. I couldn't reproduce this problem. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|