Php syntax error, unexpected T_VARIABLE

Fermé
parvn Messages postés 49 Date d'inscription mardi 4 août 2009 Statut Membre Dernière intervention 7 mai 2012 - 4 août 2009 à 12:31
parvn Messages postés 49 Date d'inscription mardi 4 août 2009 Statut Membre Dernière intervention 7 mai 2012 - 5 août 2009 à 20:22
Bonjour,
Je suis entrain de faire mes premiers pas avec la programation php.

Mon probleme c'est afficher les donnees entrees dans la base de donnee
mais il y'a toujours l'erreur: Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26

voici le file usefulfunc.php, les functions utuliser dans mes codes parmi ceux la function print_entry qui renvoie l'erreure quand je l'appelle dans mon code view.php pour imprimer les donnees, le code view.php se trouve just apres celui la sur les fonctions

usefulfunc.php
<?php
// this function print the HTML input field

function print_input_fields()
{
$fields = func_get_args();
while (list(,$field) = each($fields))
{
print " <tr>\n";
print " <td valign=top align=right><b>".ucfirst($field).":</b></td>\n";
print " <td valign=top align=left><input type=text name=$field size=40></td>\n";
print " </tr>\n\n";
}
}
?>
<?php

// this function print entries that have been enter in the guestbook
function print_entry($row){
$numargs=func_num_args();
for($i = 1; $i < $numargs; $i++) {
$field = func_get_args($i);
// This will transform a label string to a valid database
// field name - e.g., "Last Name" becomes "last_name"
error_reporting()
$dbvalue=$row[$field];
print " <tr>\n";
print " <td valign=top align=right><b>$field:</b></td>\n";
print " <td valign=top align=left>$dbvalue</td>\n";
print " </tr>\n\n";
}
}

// specify the error when the query fails
function safe_query($query="") {
if(empty($query)){ return FALSE; }
$result = mysql_query($query)
or die("ack! query failed:"
."<li>errorno=".mysql_errno()
."<li>error=".mysql_error()
."<li>query=".$query );
return $result;
}
?>
<?php
// to insert entries in the guestbook database
function create_entry($name,$location,$email,$url,$comments){
$errmsg = "";
if(empty($name)){
$errmsg .= "<li>you have to put in a name!\n";
}
if (empty($email)){
$errmsg .="<li>insert an email please\n";
}
else {
$query = "select * from guestbook where email = '$email'";
$result = safe_query($query);
if(mysql_num_rows($result) > 0) {
$errmsg .="<li>this email has already sign this guestbook.\n";
}
}
if (empty($errmsg)){
$query = "insert into guestbook"
."(name,location,email,url,comments,remote_addr) values "
."('$name','$location','$email','$url','$comments','$REMOTE_ADDR')";
$result = safe_query($query);

?>
<h2>Thanks!!</h2>
<h2><a href="view.php">View Arly's Guest Book!!!</a></h2>
<?php

}
else{
include("sign.php");
}
}
?>



Et voici le code view.php

<?php
include "connection.php";
include "usefulfunc.php";
$page_title = "View my guest book";
include "start_pag.php";

$result = safe_query("select * from guestbook");
if($result) {
while($row = mysql_fetch_array($result)){
print_entry($row,"name","location","email","url","comments");
print"<tr><td colspan=2> </td></tr>\n";
}
mysql_free_result($result);
}
?>
<h2><a href="sign.php">Sign My Guest Book!!</a></h2>

Merci d'avance pour votre aide
A voir également:

3 réponses

jeangilles Messages postés 816 Date d'inscription samedi 21 juin 2008 Statut Membre Dernière intervention 17 juillet 2012 186
4 août 2009 à 13:10
Il te manque un ; après error_reporting()
0
parvn Messages postés 49 Date d'inscription mardi 4 août 2009 Statut Membre Dernière intervention 7 mai 2012
4 août 2009 à 19:26
merci j'ai ajoute le ; mais voici l'erreur qu'il me sort maitenant:

Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
Warning: Illegal offset type in C:\Program Files\EasyPHP 2.0b1\www\training\application\usefulfunc.php on line 26
Array:
merci d'avance pour ton aide;
0
Bonjour

Je pense que tu as confondu les fonctions func_get_args (avec un s à la fin) et func_get_arg (sans s)
0
parvn Messages postés 49 Date d'inscription mardi 4 août 2009 Statut Membre Dernière intervention 7 mai 2012
5 août 2009 à 20:22
Merci bcp le probleme est resolu c'etait plutot func_get_arg() au lieu de fun_get_args()
0