A voir également:
- Consultation des donnees oracle via PHP
- Fuite données maif - Guide
- Trier des données excel - Guide
- Easy php - Télécharger - Divers Web & Internet
- Supprimer les données de navigation - Guide
- Validation des données excel liste déroulante - Guide
3 réponses
pitxu
Messages postés
689
Date d'inscription
vendredi 7 septembre 2007
Statut
Membre
Dernière intervention
25 mars 2015
94
3 déc. 2008 à 10:25
3 déc. 2008 à 10:25
bonjour,
c'est le problème de l'utilisation de la boucle while (="tant que"), dès que la condition n'est plus vraie, elle s'arrête.
On peut tricher avec un if/else :
while (oci_fetch($schema))
{
if (oci_result($sgbd, 1)=="") { oci_result($sgbd, 1)=" "; }
print '<TD>' . oci_result($sgbd, 1) . '</TD>';
}
Essaie ça et dis moi si ça marche ;)
c'est le problème de l'utilisation de la boucle while (="tant que"), dès que la condition n'est plus vraie, elle s'arrête.
On peut tricher avec un if/else :
while (oci_fetch($schema))
{
if (oci_result($sgbd, 1)=="") { oci_result($sgbd, 1)=" "; }
print '<TD>' . oci_result($sgbd, 1) . '</TD>';
}
Essaie ça et dis moi si ça marche ;)
pitxu
Messages postés
689
Date d'inscription
vendredi 7 septembre 2007
Statut
Membre
Dernière intervention
25 mars 2015
94
3 déc. 2008 à 12:56
3 déc. 2008 à 12:56
ton code fait-il partie d'une fonction ? si oui post la fonction complète stp
merci de ton aide
voici le code en php
<?php
$conn = oci_connect("DBAR_ADMIN_BEN", "bfiguig1", "pdbar1_proradba1");
$stmt = oci_parse($conn, "SELECT LIBELLE, ID_SGBD, VERSION, ID_SERVEUR, MUTUALISE, PORT, CHARSET, TYPE_SAUVEGARDE, ID_DATABASE FROM DATABASE WHERE MUTUALISE = '".$mutualise."' and LIBELLE like '".$libelle."%' and VERSION like '".$version."%'");
oci_execute($stmt);
print '<table cellspacing="0" cellpadding="0" width="90%" border="1" align="center">';
print '<TR>';
print '<TD>BASE / INSTANCE</TD>';
print '<TD>SGBD</TD>';
print '<TD>VERSION</TD>';
print '<TD>SERVEUR</TD>';
print '<TD>MUTUALISE</TD>';
print '<TD>PORT</TD>';
print '<TD>CHARSET</TD>';
print '<TD>SAUVEGARDE</TD>';
print '<TD>SCHEMAS</TH>';
print '<TD>APPLICATIONS</TD>';
print '</TR>';
while (ocifetch($stmt))
{
$SGBD_value = oci_result($stmt, 2);
$SERVEUR_value = ociresult($stmt, 4);
$ID_DATABASE_value = ociresult($stmt, 9);
$ID_CHARSET_value = ociresult($stmt, 7);
$sgbd = oci_parse($conn, "SELECT LIBELLE FROM SGBD WHERE ID_SGBD = '".$SGBD_value."'");
oci_execute($sgbd);
$serveur = oci_parse($conn, "SELECT LIBELLE FROM SERVEUR WHERE ID_SERVEUR = '".$SERVEUR_value."'");
oci_execute($serveur);
$schema = oci_parse($conn, "SELECT s.ID_SCHEMA, s.LIBELLE FROM SCHEMA s, SCHEMA_DATABASE sc WHERE sc.ID_SCHEMA = s.ID_SCHEMA AND sc.ID_DATABASE = '".$ID_DATABASE_value."'");
oci_execute($schema);
print '<TR>';
print '<TD>' . ociresult($stmt, 1) . '</TD>';
while (ocifetch($sgbd))
{
print '<TD>' . ociresult($sgbd, 1) . '</TD>';
}
print '<TD>' . ociresult($stmt, 3) . '</TD>';
while (ocifetch($serveur))
{
print '<TD><a href="javascript:affiche_serveur()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($serveur, 1) .'</span></font></a></TD>';
}
print '<TD>' . ociresult($stmt, 5) . '</TD>';
print '<TD>' . ociresult($stmt, 6) . '</TD>';
if (!ociresult($stmt, 7))
{
print '<TD> </TD>';
}
else
{
print '<TD>' . ociresult($stmt, 7) . '</TD>';
}
if (!ociresult($stmt, 8))
{
print '<TD> </TD>';
}
else
{
print '<TD>' . ociresult($stmt, 8) . '</TD>';
}
while (ocifetch($schema))
{
$ID_SCHEMA_value = ociresult($schema, 1);
if (ociresult($schema, 2)=="")
{
print '<TD> </TD>';
}
print '<TD><a href="javascript:affiche_schema()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($schema, 2) .'</span></font></a></TD>';
}
$application = oci_parse($conn, "SELECT a.LIBELLE FROM SCHEMA s, APPLICATION a WHERE s.ID_APPLICATION = a.ID_APPLICATION AND s.ID_SCHEMA = '".$ID_SCHEMA_value."'");
oci_execute($application, OCI_DEFAULT);
while (ocifetch($application))
{
if (ociresult($application, 1) != '')
{
print '<TD><a href="javascript:affiche_application()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($application, 1) .'</span></font></a></TD>';
}
else
{
print '<TD> </TD>';
}
}
print '</TR>';
}
print '</table>';
oci_free_statement($stmt);
oci_close($conn);
?>
voici le code en php
<?php
$conn = oci_connect("DBAR_ADMIN_BEN", "bfiguig1", "pdbar1_proradba1");
$stmt = oci_parse($conn, "SELECT LIBELLE, ID_SGBD, VERSION, ID_SERVEUR, MUTUALISE, PORT, CHARSET, TYPE_SAUVEGARDE, ID_DATABASE FROM DATABASE WHERE MUTUALISE = '".$mutualise."' and LIBELLE like '".$libelle."%' and VERSION like '".$version."%'");
oci_execute($stmt);
print '<table cellspacing="0" cellpadding="0" width="90%" border="1" align="center">';
print '<TR>';
print '<TD>BASE / INSTANCE</TD>';
print '<TD>SGBD</TD>';
print '<TD>VERSION</TD>';
print '<TD>SERVEUR</TD>';
print '<TD>MUTUALISE</TD>';
print '<TD>PORT</TD>';
print '<TD>CHARSET</TD>';
print '<TD>SAUVEGARDE</TD>';
print '<TD>SCHEMAS</TH>';
print '<TD>APPLICATIONS</TD>';
print '</TR>';
while (ocifetch($stmt))
{
$SGBD_value = oci_result($stmt, 2);
$SERVEUR_value = ociresult($stmt, 4);
$ID_DATABASE_value = ociresult($stmt, 9);
$ID_CHARSET_value = ociresult($stmt, 7);
$sgbd = oci_parse($conn, "SELECT LIBELLE FROM SGBD WHERE ID_SGBD = '".$SGBD_value."'");
oci_execute($sgbd);
$serveur = oci_parse($conn, "SELECT LIBELLE FROM SERVEUR WHERE ID_SERVEUR = '".$SERVEUR_value."'");
oci_execute($serveur);
$schema = oci_parse($conn, "SELECT s.ID_SCHEMA, s.LIBELLE FROM SCHEMA s, SCHEMA_DATABASE sc WHERE sc.ID_SCHEMA = s.ID_SCHEMA AND sc.ID_DATABASE = '".$ID_DATABASE_value."'");
oci_execute($schema);
print '<TR>';
print '<TD>' . ociresult($stmt, 1) . '</TD>';
while (ocifetch($sgbd))
{
print '<TD>' . ociresult($sgbd, 1) . '</TD>';
}
print '<TD>' . ociresult($stmt, 3) . '</TD>';
while (ocifetch($serveur))
{
print '<TD><a href="javascript:affiche_serveur()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($serveur, 1) .'</span></font></a></TD>';
}
print '<TD>' . ociresult($stmt, 5) . '</TD>';
print '<TD>' . ociresult($stmt, 6) . '</TD>';
if (!ociresult($stmt, 7))
{
print '<TD> </TD>';
}
else
{
print '<TD>' . ociresult($stmt, 7) . '</TD>';
}
if (!ociresult($stmt, 8))
{
print '<TD> </TD>';
}
else
{
print '<TD>' . ociresult($stmt, 8) . '</TD>';
}
while (ocifetch($schema))
{
$ID_SCHEMA_value = ociresult($schema, 1);
if (ociresult($schema, 2)=="")
{
print '<TD> </TD>';
}
print '<TD><a href="javascript:affiche_schema()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($schema, 2) .'</span></font></a></TD>';
}
$application = oci_parse($conn, "SELECT a.LIBELLE FROM SCHEMA s, APPLICATION a WHERE s.ID_APPLICATION = a.ID_APPLICATION AND s.ID_SCHEMA = '".$ID_SCHEMA_value."'");
oci_execute($application, OCI_DEFAULT);
while (ocifetch($application))
{
if (ociresult($application, 1) != '')
{
print '<TD><a href="javascript:affiche_application()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($application, 1) .'</span></font></a></TD>';
}
else
{
print '<TD> </TD>';
}
}
print '</TR>';
}
print '</table>';
oci_free_statement($stmt);
oci_close($conn);
?>
pitxu
Messages postés
689
Date d'inscription
vendredi 7 septembre 2007
Statut
Membre
Dernière intervention
25 mars 2015
94
3 déc. 2008 à 14:15
3 déc. 2008 à 14:15
if (ociresult($schema, 2)=="")
{
print '<TD> </TD>';
}
print '<TD><a href="javascript:affiche_schema()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($schema, 2) .'</span></font></a></TD>';
ne serait-ce pas plutot :
if (ociresult($schema, 2)=="")
{
print '<TD> </TD>';
}
else
{
print '<TD><a href="javascript:affiche_schema()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($schema, 2) .'</span></font></a></TD>';
}
{
print '<TD> </TD>';
}
print '<TD><a href="javascript:affiche_schema()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($schema, 2) .'</span></font></a></TD>';
ne serait-ce pas plutot :
if (ociresult($schema, 2)=="")
{
print '<TD> </TD>';
}
else
{
print '<TD><a href="javascript:affiche_schema()"><font color="#AF0635" style="FONT-WEIGHT: bold; FONT-SIZE: 11px"><span id="nom_serveur">'. ociresult($schema, 2) .'</span></font></a></TD>';
}
3 déc. 2008 à 12:03
il m'affiche un message d'erreur:
Fatal error: Can't use function return value in write context in C:\wamp\www\ecran\base.php on line 275
la ligne 275 corresponde à : oci_result($schema, 2)=" ";
merci