Tom's Guide > Forum > Programmation > PHP for dummies (Here I am)

PHP for dummies (Here I am)

Forum Programmation : PHP for dummies (Here I am)

TomsGuide.com : 800 000 inscrits répondent à toutes vos questions high-tech et informatique. Pour obtenir de l'aide, inscrivez-vous gratuitement !
Mot :    Pseudo :           
 

Hello there!

 

I'm a young PHP jedi, I work with PHP and MySQL for dummies and I'm stopped on page 30. My problem I've rewrite all the code for testing mysql on my server (PHP test ok)

 

<?php
/* Programme: mysql_up.php
* Desc: Se connecte au serveur MySQL et
* affiche les paramètres.
*/
echo "<html>
<head><title>Test de MySQL5 avec PHP5</title></head>
<body>";
$host="helpbusiness.free.fr";
$user="helpbusiness";
$password="c***";

 

$cxn = mysqli_connect($host,$user,$password);
$sql="SHOW STATUS";
$result = mysqli_query($cxn,$sql);
if($result = false)
{
echo "<h4>Erreur: ".mysqli_error($cxn)."</h4>";
}
else
{
/*Tableau affichant les résultats*/
echo "<table border='1'>
<tr><th>Nom_Variable</th>
<th>Valeur</th></tr>;
for($i = 0; $i < mysqli_num_rows($result);$i++)
{
echo "<tr>";
$row_array = mysqli_fetch_row($result);
for($j = 0;$j < mysqli_num_fields($result);$j++)
{
echo "<td>".$row_array[$j]."</td>\n";
}
echo "</tr>";
}
echo "</table>";
}
?>
</body>
</html>

 

and when I run the test I've this message

 

Parse error: syntax error, unexpected '>' in /mnt/149/sdb/2/2/helpbusiness/test-mysql.php on line 28

 

I need help you could just correct the code because I'm a beginner and I cannot understand any complexe explenation for the moment.

 

Thanks for all your help.

 

Pierre, the mad coder


Message édité par SiM07 le 25-09-2008 à 15:27:05
Liens sponsorisés
Inscrivez-vous ou connectez-vous pour masquer ceci.

Hello,
I can spot (at least) two mistakes in your code:
if($result = false) is an assignation; $result will always be assigned the value "false" here. It should be a comparison instead (with the == operator).

echo "<table border='1'>
<tr><th>Nom_Variable</th>
<th>Valeur</th></tr>;
The " quote is opened but never closed.

Also, why are you writing in English? This forum is mostly french speaking (although it appears that there is an automated translation feature that activates itself in some cases).

Répondre à Rakipu

Why did you not test on local with WAMP ?

------------------------------ 20minutes.fr, l'information en continu.
Répondre à SiM07

Ok, bon ben je reparle en français c'est mieux!

Merci pour les infos j'ai réussi à régler le problème en fait le code était pas trop mauvais mais c'est un problème entre mysqli et mysql.

Encore merci je me replonge dans mon bouquin pour les zéros!

Répondre à mystx666

C'est moi ou bien créer un topic sur un forum français et parler anglais alors qu'on parle français c'est complètement stupide ?

Répondre à loic m
Tom's Guide > Forum > Programmation > PHP for dummies (Here I am)
Aller à :

Il y a 688 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici.

Attention

Vous allez répondre sur un sujet resté inactif pendant plus de 6 mois.
Assurez-vous d'apporter des éléments nouveaux à la discussion avant de poursuivre.

Répondre Annuler
Liens