bonjour a tous, je suis en train de faire un petit fichier php pour écrire dans ma base de donnée des données préétablie.

Cela avance pas mal vue la simplicité de la chose, mais un bug me résiste.

<?php
$post_id ='';
$topic_id ='411';
$forum_id ='5';
$poster_id ='148';
$icon_id ='0';
$poster_ip = '0x39302e31372e3234332e3833';
$post_time = '';
$post_approved ='1';
$post_reported ='0';
$enable_bbcode ='1';
$enable_smilies ='1';
$enable_magic_url ='1';
$enable_sig ='1';
$post_username ='';
$post_subject = 'RADAC';
$post_text ='0x4a65206d65207072c3a973656e74652070617320706c75732071756520c3a76120636172206365727461696e206427656e74726520766f7573206f6e742064c3a96a6120657520c3a020666169726520c3a0206d6f692c0a0a6a6520737569732052414441432028726f626f742064652052c3a9706f6e7365204175746f6d61746973c3a92061752044656d616e6465206427416d697320657420646520436f6e766572736174696f6e292e0a0a5b696d673a67356464616639745d68747470262335383b2f2f777777262334363b6a6575782d737472617465676965262334363b636f6d2f66696c6561646d696e2f61727469636c65732f75706c6f61642f6a732f746125323068656c69636f262334363b6a70675b2f696d673a67356464616639745d0a0a20537569746520c3a0206d612070726f636861696e6520696e74c3a967726174696f6e2064616e73206c6520666f72756d2c206f6e206d2761206372c3a9657220756e20636f6d707465206166696e20717565206a652070756973736520766f75732074656e697220617520636f7572616e7420656e2074656d70732072c3a9656c6c6520646520746f75732063652071756920736520706173736520737572206c612073657373696f6e20617520706f696e742064652076756520666f6e6374696f6e6e656d656e7420676c6f62616c2e0a0a4d6f6e20696e746572636f6e6e6578696f6e2065737420656e20636f757273206427c3a9747564652e200a5b696d673a67356464616639745d68747470262335383b2f2f777777262334363b676c6f62616c737769746368262334363b636f6d2f6d656469612f36353334392f66696272652d6f707469637332262334363b6a70675b2f696d673a67356464616639745d0a4a6520766f7573207469656e6472616920756e20636f7572616e74206465206d6f6e2064c3a976656c6f7070656d656e742e';
$post_checksum ='0x6437633566623466653434303838636432653238353033663064666131396462';
$post_attachment ='0';
$bbcode_bitfield ='';
$bbcode_uid='';
$post_postcount ='1';
$post_edit_time ='0';
$post_edit_reason ='';
$post_edit_user ='0';
$post_edit_count ='0';
$post_edit_locked ='0';
$host = '***';
$user = '***';
$pass = '***';
$db = '***';

// connection à la DB
mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());
$sql= "INSERT INTO phpbb_posts2(post_id,topic_id,forum_id,poster_id,icon_id,poster_ip,post_time,post_approved,post_reported,enable_bbcode,enable_smilies,enable_magic_url,enable_sig,post_username,post_subject,post_text,post_checksum,post_attachment,bbcode_bitfield,bbcode_uid,post_postcount,post_edit_time,post_edit_reason,post_edit_user,post_edit_count,post_edit_locked) VALUES('$post_id','$topic_id','$forum_id','$poster_id','$icon_id','$poster_ip','$post_time','$post_approved','$post_reported','$enable_bbcode','$enable_smilies','$enable_magic_url','$enable_sig,'$post_username','$post_subject','$post_text','$post_checksum','$post_attachment','$bbcode_bitfield','$bbcode_uid','$post_postcount','$post_edit_time','$post_edit_reason','$post_edit_user','$post_edit_count','$post_edit_locked')";
mysql_query($sql) or die ('Erreur SQL ! <br>'.$sql.'<br>'.mysql_error());

?>

et celà me retourne une page d'erreur

Erreur SQL ! 
INSERT INTO phpbb_posts2(post_id,topic_id,forum_id,poster_id,icon_id,poster_ip,post_time,post_approved,post_reported,enable_bbcode,enable_smilies,enable_magic_url,enable_sig,post_username,post_subject,post_text,post_checksum,post_attachment,bbcode_bitfield,bbcode_uid,post_postcount,post_edit_time,post_edit_reason,post_edit_user,post_edit_count,post_edit_locked) VALUES('','411','5','148','0','0x39302e31372e3234332e3833','','1','0','1','1','1','1,'','RADAC','0x4a65206d65207072c3a973656e74652070617320706c75732071756520c3a76120636172206365727461696e206427656e74726520766f7573206f6e742064c3a96a6120657520c3a020666169726520c3a0206d6f692c0a0a6a6520737569732052414441432028726f626f742064652052c3a9706f6e7365204175746f6d61746973c3a92061752044656d616e6465206427416d697320657420646520436f6e766572736174696f6e292e0a0a5b696d673a67356464616639745d68747470262335383b2f2f777777262334363b6a6575782d737472617465676965262334363b636f6d2f66696c6561646d696e2f61727469636c65732f75706c6f61642f6a732f746125323068656c69636f262334363b6a70675b2f696d673a67356464616639745d0a0a20537569746520c3a0206d612070726f636861696e6520696e74c3a967726174696f6e2064616e73206c6520666f72756d2c206f6e206d2761206372c3a9657220756e20636f6d707465206166696e20717565206a652070756973736520766f75732074656e697220617520636f7572616e7420656e2074656d70732072c3a9656c6c6520646520746f75732063652071756920736520706173736520737572206c612073657373696f6e20617520706f696e742064652076756520666f6e6374696f6e6e656d656e7420676c6f62616c2e0a0a4d6f6e20696e746572636f6e6e6578696f6e2065737420656e20636f757273206427c3a9747564652e200a5b696d673a67356464616639745d68747470262335383b2f2f777777262334363b676c6f62616c737769746368262334363b636f6d2f6d656469612f36353334392f66696272652d6f707469637332262334363b6a70675b2f696d673a67356464616639745d0a4a6520766f7573207469656e6472616920756e20636f7572616e74206465206d6f6e2064c3a976656c6f7070656d656e742e','0x6437633566623466653434303838636432653238353033663064666131396462','0','','','1','0','','0','0','0')
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RADAC','0x4a65206d65207072c3a973656e74652070617320706c75732071756520c3a761206361' at line 1

et je ne trouve pas, encore un coup stupide je le sens. Si quelqu'un pouveait jeter un oeil. merci d'avance

Flo

1 réponse


flo3376
Auteur
Réponse acceptée

j'ai trouvé, la vache avec la couleur de votre interface ça m'a sauté à la vue de suite.