Bonjour,
Mon premier post !
On m'a confié le suivi d'un site construit par un autre que moi.
C'est un vieux site en php4 avec une base de donnée en Mysql4.
L'hébergeur va prochainement éteindre ses serveurs php4., ce qui est bien normal. Donc mise à niveau...
Je glisse
AddType x-mapp-php5 .php .php4
AddHandler x-mapp-php5 .php .php4
dans le fichiers htaccess et là ça roule.
Mais voilà je ne comprends presque rien au php même si c'est un langage un peu compréhensible quand on a fait de la programmation en fortran ou C et même si c'était il y a 20 ans.
Bref, j'ai mis à jour la base de donnée en version Mysql5, ça c'est bien passé, certaines pages du site fonctionnent normalement, mais j'ai
une page qui renvoie une erreur.
J'ai vu que certaines instructions avaient changé mais je n'ai pas réussi à me dépatouiller seul.
L'erreur renvoyée dit qu'elle est en ligne 1. Ce que j'ai compris c'est que ça veut dire que ça ne veut rien dire sauf qu'il y a une erreur SQL dans la page mais on ne sait pas où.
Quelqu'un peut-il m'aider, c'est peut-être pas grand chose.. ( je touche du bois )
Voilà le code
<?php
session_start();
include_once('ArtisteModel.php');
$obj_picto = get_picto_oeuvre($_GET['id'],$_GET['page_picto']);
$nb_picto = get_nb_picto($_GET['id']);
$page_picto = $_GET['page_picto'];
$query_nomart = "SELECT AR_nom, AR_prenom FROM artistes WHERE AR_id = $id ";
$nomartist = mysql_query($query_nomart) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$nom = mysql_fetch_object($nomartist)
?>
<html>
<head>
<title>Bienvenue sur le site de xxx</title>
<link href="css/feuille.css" rel="stylesheet" type="text/css">
<meta name="description" content="Présentation">
<meta name="keywords" content="galerie">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><style type="text/css">
<!--
body {
background-color: #FFFFFF;
}
-->
</style>
</head>
<body>
<div align="center" style="width: 530px;">
<img src="image/artiste/visu_<?php echo $obj_picto->AO_image; ?>" alt="<?php echo $nom->AR_prenom." ".$nom->AR_nom; ?>"><br />
<table style="margin-top:5px;">
<tr>
<td>
<?php
if($page_picto!='1'){
?>
<a href="artiste_picto_oeuvre.php?id=<?php echo $_GET['id']; ?>&page_picto=<?php echo $page_picto-1; ?>">
<img src="image/fleche_gauche.gif" border='0'>
</a>
<?php
}
?>
</td>
<td width='500' align='center'>
<?php
if($_SESSION['l'] == 'en')
echo $obj_picto->AO_description_en;
else
echo $obj_picto->AO_description;
?>
</td>
<td>
<?php
if($page_picto!=$nb_picto){
?>
<a href="artiste_picto_oeuvre.php?id=<?php echo $_GET['id']; ?>&page_picto=<?php echo $page_picto+1; ?>">
<img src="image/fleche_droite.gif" border='0'>
</a>
<?php
}
?>
</td>
</tr>
</table>
</div>
</body>
</html>
Le inculde c'est ça
<?php
//on inclut les parametre de connection a la base de données.
include_once('config.php');
db_connect();
//requete de recuperation de la lsite des artistes.
$query_artiste = "SELECT AR_id, AR_nom, AR_prenom FROM artistes ORDER BY AR_prenom ASC ";
$result_artiste = mysql_query($query_artiste);
if(mysql_num_rows($result_artiste) > 0)
{
while($row_artiste = mysql_fetch_object($result_artiste)){
if($row_artiste->AR_id != $_GET['id']){
$row_artistessespace = str_replace(CHR(32),"",$row_artiste->AR_prenom);
$row_artistessespace2 = str_replace(CHR(32),"",$row_artiste->AR_nom);
$liste_artiste .= "<div color='white' style=\"margin-left: 8px;margin-top: 2px;\"><a href=\"../".$row_artistessespace2."-".$row_artistessespace.".html\" class=\"liste_artiste\">";
$liste_artiste .= $row_artiste->AR_nom." ".$row_artiste->AR_prenom;
$liste_artiste .= "</a></div>";
} else {
$liste_artiste .= "<div color='black' style=\"margin-left: 8px;margin-top: 2px;\">";
$liste_artiste .= $row_artiste->AR_nom." ".$row_artiste->AR_prenom;
$liste_artiste .= "</div>";
}
}
}
db_disconnect();
function get_liste_oeuvre($id_artiste){
db_connect();
$query_liste = "SELECT AO_image from artistes_oeuvre WHERE AO_id_artiste = ".$id_artiste." ORDER BY AO_id DESC";
$result_liste = mysql_query($query_liste);
if(mysql_num_rows($result_liste) > 0)
{
return $result_liste;
}
db_disconnect();
}
function get_picto_oeuvre($id,$page_picto){
db_connect();
$page_picto = $page_picto-1;
$query_picto = "SELECT * from artistes_oeuvre WHERE AO_id_artiste = ".$id." ORDER BY AO_id DESC LIMIT ".$page_picto.",1";
$result_picto = mysql_query($query_picto);
if(mysql_num_rows($result_picto) > 0)
{
return mysql_fetch_object($result_picto);
}
db_disconnect();
}
function get_id_picto($id_artiste){
db_connect();
$query_picto = "SELECT AO_id from artistes_oeuvre WHERE AO_id_artiste = ".$id_artiste." ORDER BY AO_id ASC";
$result_picto = mysql_query($query_picto);
if(mysql_num_rows($result_picto) > 0)
{
$obj_picto = mysql_fetch_object($result_picto);
return $obj_picto->AO_id;
}
db_disconnect();
}
function get_nb_picto($id_artiste){
db_connect();
$query_picto = "SELECT * from artistes_oeuvre where AO_id_artiste =".$id_artiste;
$result_picto = mysql_query($query_picto);
if(mysql_num_rows($result_picto) > 0)
{
return mysql_num_rows($result_picto);
}
db_disconnect();
}
function get_biographie($id_artiste){
db_connect();
$query_bio = "SELECT * from artistes where AR_id =".$id_artiste;
$result_bio = mysql_query($query_bio);
if(@mysql_num_rows($result_bio) > 0)
{
return mysql_fetch_object($result_bio);
}
db_disconnect();
}
?>
Vous remarquerez ( ou non c'est en bas ) le @ qui me cache un warning..
là
if(@mysql_num_rows($result_bio) > 0)
Un grand merci !