https://www.17buddies.rocks/index.html

17's Buddies Maps HL1 Maps HL2 Wads Plan des Maps
17 Buddies
Only for stats

Welcome Guest ( Log In | Register )

 
New
Besoin D'aide Php
Mystery
post 17/02/2008 - 19:44:49 |   Post #1
+Reply

Group: Member
Posts: 20
Joined: 10/04/2004

fr 
Team:
Moches


Bonjour tout le monde (IMG:http://forum.17buddies.rocks/style_emoticons/default/icon_hello.gif)

Etant débutant en php, je viens pour demander de l'aide !

Je suis entrun de faire un site, et je suis sur la partie "modification d'une news"

Je veut faire en sorte que lorsque la personne à choisi la news,
en cliquant sur "modifier", cela affiche les champs qui correspondent à l'id de la news.

Le problème c'est que quand je clique sur "modifier", rien ne ce passe

ci-dessous le code, pouvez vous m'aider à trouver ce qui cloche svp

Merci d'avance

CODE
<?php

if(isset($_POST['modifier']))

{
include("../include/config.php");

$news_id = $_POST["liste_news"];

$connection = mysql_connect("$db_host","$db_login","$db_pass");

mysql_select_db($db_name) or die ("pas de connection");

$sql = "SELECT news_auteur,news_titre,news_contenu FROM site_news WHERE news_id='$news_id'";
mysql_query($sql);
echo"essai";

mysql_close();

}


?>

<P><u><H5>Veuillez sélectionner la news a modifier :</H></u></p><br><br>


<P ALIGN="CENTER">
<select name="liste_news">

<?php
echo'<FORM method="post" action="' .$_SERVER['PHP_SELF']. '">';

$connection = mysql_connect($db_host,$db_login,$db_pass);

// test la connection

if ( ! $connection )

die ("connection impossible");

mysql_select_db($db_name) or die ("pas de connection");

$sql = 'SELECT news_titre,news_id FROM site_news';

$req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());

while($data = mysql_fetch_assoc($req))

{

echo"
<option value=".$data['news_id'].">".$data['news_titre']."</option>
";

}
echo"</form>";

mysql_close();

?>
</select></p><br><br>
<P ALIGN="CENTER"><INPUT name="modifier" type="submit" value="Modifier">
<INPUT name="supprimer" type="submit" value="Supprimer">
</p>


This post has been edited by Mystery: 17/02/2008 - 19:45:38
Post PM
Go to the top of the page
Chapo
post 17/02/2008 - 20:18:49 |   Post #2
+Reply

Group: 17 Buddies
Posts: 18 534
Joined: 27/12/2003

fr 

Team:
Dev. 17b


Est ce que ça t'affiche ton "echo essai"?
Post PM
Website
Go to the top of the page
Mystery
post 17/02/2008 - 20:24:25 |   Post #3
+Reply

Group: Member
Posts: 20
Joined: 10/04/2004

fr 
Team:
Moches


non, ca ne m'affiche pas "essai",

je ne rentre pas dans la boucle if
Post PM
Go to the top of the page
benneb
post 17/02/2008 - 21:09:34 |   Post #4
+Reply

Group: 17 Buddies
Posts: 13 317
Joined: 27/02/2004

fr 
Team:
nG


c'est que ton erreur est là : isset($_POST['modifier']) (IMG:http://forum.17buddies.rocks/style_emoticons/default/wink.gif)

modifier ne doit pas exister en session (IMG:http://forum.17buddies.rocks/style_emoticons/default/icon_neutral.gif)
Post PM
Go to the top of the page
Mystery
post 17/02/2008 - 21:48:42 |   Post #5
+Reply

Group: Member
Posts: 20
Joined: 10/04/2004

fr 
Team:
Moches


Merci pour la réponse, mais est ce que tu pourrait être plus precis sur cette erreur stp?
Post PM
Go to the top of the page
Chapo
post 17/02/2008 - 23:11:07 |   Post #6
+Reply

Group: 17 Buddies
Posts: 18 534
Joined: 27/12/2003

fr 

Team:
Dev. 17b


J'ai comme l'impression que ta balise de fin de formulaire </ form> est avant ton <input .

Essaie de la mettre en dernier pour voir
Post PM
Website
Go to the top of the page
Nosferatu
post 18/02/2008 - 12:43:56 |   Post #7
+Reply

Group: 17 Buddies
Posts: 5 245
Joined: 15/01/2004

fr 
Team:
KiNdReD


une liste de truc pour le dev php et le debugage : http://www.art122-5.net/index.php/D%C3%A9velopper_en_PHP

dans l'error_log d'apache tu n'as pas un truc comme quoi la fonction mysql_connect n'existe pas ? (par exemple)
Post PM
Website
Go to the top of the page
Nosferatu
post 18/02/2008 - 12:48:04 |   Post #8
+Reply

Group: 17 Buddies
Posts: 5 245
Joined: 15/01/2004

fr 
Team:
KiNdReD


sinon, ici à la place de isset, utilise plutot array_key_exists http://fr2.php.net/manual/fr/function.array-key-exists.php
Post PM
Website
Go to the top of the page
Mystery
post 18/02/2008 - 18:31:06 |   Post #9
+Reply

Group: Member
Posts: 20
Joined: 10/04/2004

fr 
Team:
Moches


Merci pour toutes ses réponses (IMG:http://forum.17buddies.rocks/style_emoticons/default/felicitation.gif)

Je viens de rentrer du boulot, donc je test tout ca et je vous tiens au courant


Merci
Post PM
Go to the top of the page
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

New
 


RSS Lo-Fi Version
 
Skin © Chapo