Php et mysql

Fermé
mbay_big Messages postés 6 Date d'inscription lundi 29 octobre 2007 Statut Membre Dernière intervention 9 juin 2008 - 29 oct. 2007 à 18:43
minikini Messages postés 39 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 19 décembre 2007 - 29 oct. 2007 à 19:23
Bonjour,

J' ai une erreur dans mon code php et, je souhaite que quelqu'un m'aide. Voici le message d'erreur:Parse error: parse error, unexpected T_STRING in C:\Program Files\EasyPHP 2.0b1\www\TD3_WEB\Oeuvre.php on line 15


Voici mes codes:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="fr" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>sans titre 1</title>
<style type="text/css">
.style1 {
margin-left: 0px;
margin-top: 0px;
}
</style>
</head>

<body>

<form name="formulaire" method="POST" action="Base.php">
<br />
<br />
<input name="Text1" type="text" style="width: 72px; height: 16px" class="style1" />       
<input name="Button1" type=submit value="Auteurs" style="width: 103px" /><br />
<br />
<br />
</form>

</body>

</html>


Le deuxième:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans nom</title>

<style type="text/css">
<!--
a {
display: marker;
white-space: nowrap;
text-decoration: none;
font-family: Georgia, "Times New Roman", Times, serif;
color: #000000;
font-weight: 500;





-->
</style>

</head>

<body>

<form method="POST" action="Oeuvre.php">

<a href="Oeuvre.php" type="a">

<?php

$choix=$_POST['Text1'];
$host = "Bibli";
$user = "etd";
$password = "etd";
$bdd="bibli";

$conn = mysql_connect("localhost","root") or die ("raté");

mysql_select_db("$bdd") or die('Erreur'.mysql_error());

// Accès à la table

$query = "Select Nom from auteur where Nom like '$choix%'";
$result = mysql_query($query);


// boucle de lecture

while ($t=mysql_fetch_array($result))
{
echo " ".$t['Nom'] ."</br>";


echo" "."</p>";
}

?>


</a></form>


</body>

</html>

Le troisième:

<?php

$inconnu=$_POST['Nom'];
$host = "Bibli";
$user = "etd";
$password = "etd";
$bdd="bibli";

$conn = mysql_connect("localhost","root") or die ("raté");

mysql_select_db("$bdd") or die('Erreur'.mysql_error());

// Accès à la table

$sql =" select $inconnu,'titre',count('$inconnu') as "nombre d'oeuvres ecrites" from auteur,ecrire,oeuvre where auteur.code_auteur=ecrire.code_auteur and ecrire.code_oeuvre=oeuvre.code_oeuvre group by $inconnu ";
$result = mysql_query($sql);


// boucle de lecture

while ($row=mysql_fetch_array($result))
{
echo " ".$row['Nom']. " ".$row['titre']. " ".$row['nombre d'oeuvres ecrites'] ."</br>";


echo" "."</p>";
}

?>
L'erreur est au niveau de la requéte: $sql
A voir également:

1 réponse

minikini Messages postés 39 Date d'inscription mercredi 24 octobre 2007 Statut Membre Dernière intervention 19 décembre 2007 6
29 oct. 2007 à 19:23
Hello,

Je suppose que c'est ici que ca déconne:

$sql =" select $inconnu,'titre',count('$inconnu') as "nombre d'oeuvres ecrites" from auteur,ecrire,oeuvre where auteur.code_auteur=ecrire.code_auteur and ecrire.code_oeuvre=oeuvre.code_oeuvre group by $inconnu ";

Remplace "nombre d'oeuvres ecrites" par 'nboeuvreecrite' et ca devrait aller mieux.

Ne pas oublier de remplacer ici: $row['nboeuvreecrite']
0