IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Envoyer des données dans mysql [MySQL]


Sujet :

PHP & Base de données

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    302
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 302
    Par défaut Envoyer des données dans mysql
    Bonjour,

    Je suis bloqué pour envoyer du sql directement à partir d’un formulaire et (textarea) avec simple bouton submit

    Pour des raisons personnelles je ne veux pas les importer à partir de mysql

    Si vous pouvez m'aider

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
     
    <?PHP
    ?>
    <form action="" method="post" name="form1">
    <table>
    <tr><td>
     
    <p><textarea name="text_all" rows="9" cols="100"></textarea></p>
     
    <input type="submit" name="submit">
    </td></tr>
    </table>
    </form>
     
    <?php
    if (isset($_POST['submit'])) {
    $link = mysql_connect("localhost","root","");
    $db_selected = mysql_select_db('ak22_site', $link);
    $var_recette  = $_POST['text_all'];
     
    mysql_query($req); 
    }
    ?>

    SQL

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    SET FOREIGN_KEY_CHECKS=0;
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET AUTOCOMMIT=0;
    START TRANSACTION;
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES latin1 */;
    -- --------------------------------------------------------
    INSERT DELAYED IGNORE INTO `jos_sections` VALUES(1000, 'Recettes', '', 'recettes', '', 'content', 'left', '', 1, 0, '2010-08-05 01:01:01', 6, 0, 57, '');
     
    INSERT DELAYED IGNORE INTO `jos_content` VALUES(10000,'Soupe de poisson', 'Soupe de poisson', '', '<p><span class="style4"><b><font size="4" face="Calligraph421 BT">ING</font><font size="4" face="Calligraph421 BT" color="#FF3300">REDI</font><font size="4" face="Calligraph421 BT" color="#6633CC">ENTS</font></b></span></p>&nbsp;&nbsp;&nbsp;&nbsp;  <p ><b ><font color="black">P</font><font color="#669900">E</font><font color="#663399">R</font><font color="#FF3300">S</font><font color="black">O</font><font color="#FF3300">N</font><font color="#669900">N</font><font color="#FF3300">E</font><font color="fuchsia">S</font></b> 8 <br><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  600g de rascasse, congre, Saint Pierre…etc. <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  300g de crabe <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  50g de poireaux <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  50g d\’oignons <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  10cl d\’huile d\’olive <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  20g de fenouil <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  25g de tomates <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  10g d\’ail <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  1 bouquet garni <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  40g d\’orange <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  1litre de fumet de poisson ou eau <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  3g de safran <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  100g de gruyère <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  200g de pain de mie <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  20cl de sauce de rouille <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Sel, poivre <BR><br><br><p><b><span class="style4"><font size="4" face="Calligraph421 BT" color="#CC3300">PREP</font><font size="4" face="Calligraph421 BT">ARA</font><font size="4" face="Calligraph421 BT" color="fuchsia">TION</font></span></b></p>&nbsp;&nbsp; &nbsp;&nbsp; <p ><b ><font color="black">T</font><font color="#669900">E</font><font color="#663399">M</font><font color="#FF3300">P</font><font color="black">S</font><font color="#FF3300"> D</font><font color="#669900">E P</font><font color="#FF3300">R</font><font color="fuchsia">E</font><font color="#663399">P</font><font color="#FF3300">A</font><font color="fuchsia">R</font><font color="black">A</font><font color="#669900">T</font><font color="#FF3300">I</font><font color="#663399">O</font><font color="black">N</font><font color="#0066CC"> :</font></b> 60 mn</p> <img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Habiller les <B>poisson</B>s et les mariner (huile d\’olive, oignon, safran, sel, poivre). <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Suer le blanc de <B>poireaux</B> à l\’huile d\’olive. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Ajouter les <B>crabe</B>s, saisir et écraser. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Ajouter le <B>poisson</B>. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Mouiller avec le fumet de <B>poisson</B>. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Assaisonner. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Cuire à couvert 30min. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Passer au moulin. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Porter à ébullition. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Passer au chinois étamine. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Rectifier. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Réserver. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Servir avec croûtons et sauce rouille en saucière. <BR><BR>', '', 1, 1000, 0, 1000 ,'2010-08-07 16:51:06', 62, '', '0000-00-00 00:00:00', 0, 0, '0000-00-00 00:00:00', '2010-08-6 16:51:06', '0000-00-00 00:00:00', '', '', 'show_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_vote=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nlanguage=\nkeyref=\nreadmore=', 1, 0, 1, '', '', 0, 0, 'robots=\nauthor=');
    Merci d'avance

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    302
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 302
    Par défaut
    Merci d'avoir répondu


    J'ai regarder mais je n'est trouver aucun exemple avec textarea

    Pouvez vous me donner un exemple svp

    Merci

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    C'est exactement pareil.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    302
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 302
    Par défaut
    Je pense que vous n’avez pas comprie

    Je ne veut pas envoyer le contenue de textarea dans par exemple le champ $pseudo non ce n’est pas ca

    Je veux envoyer ca

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    SET FOREIGN_KEY_CHECKS=0;
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET AUTOCOMMIT=0;
    START TRANSACTION;
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES latin1 */;
    -- --------------------------------------------------------
    INSERT DELAYED IGNORE INTO `jos_sections` VALUES(1000, 'Recettes', '', 'recettes', '', 'content', 'left', '', 1, 0, '2010-08-05 01:01:01', 6, 0, 57, '');
     
    INSERT DELAYED IGNORE INTO `jos_content` VALUES(10000,'Soupe de poisson', 'Soupe de poisson', '', '<p><span class="style4"><b><font size="4" face="Calligraph421 BT">ING</font><font size="4" face="Calligraph421 BT" color="#FF3300">REDI</font><font size="4" face="Calligraph421 BT" color="#6633CC">ENTS</font></b></span></p>&nbsp;&nbsp;&nbsp;&nbsp;  <p ><b ><font color="black">P</font><font color="#669900">E</font><font color="#663399">R</font><font color="#FF3300">S</font><font color="black">O</font><font color="#FF3300">N</font><font color="#669900">N</font><font color="#FF3300">E</font><font color="fuchsia">S</font></b> 8 <br><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  600g de rascasse, congre, Saint Pierre…etc. <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  300g de crabe <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  50g de poireaux <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  50g d\’oignons <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  10cl d\’huile d\’olive <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  20g de fenouil <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  25g de tomates <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  10g d\’ail <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  1 bouquet garni <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  40g d\’orange <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  1litre de fumet de poisson ou eau <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  3g de safran <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  100g de gruyère <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  200g de pain de mie <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  20cl de sauce de rouille <BR><img src="images/puce2.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Sel, poivre <BR><br><br><p><b><span class="style4"><font size="4" face="Calligraph421 BT" color="#CC3300">PREP</font><font size="4" face="Calligraph421 BT">ARA</font><font size="4" face="Calligraph421 BT" color="fuchsia">TION</font></span></b></p>&nbsp;&nbsp; &nbsp;&nbsp; <p ><b ><font color="black">T</font><font color="#669900">E</font><font color="#663399">M</font><font color="#FF3300">P</font><font color="black">S</font><font color="#FF3300"> D</font><font color="#669900">E P</font><font color="#FF3300">R</font><font color="fuchsia">E</font><font color="#663399">P</font><font color="#FF3300">A</font><font color="fuchsia">R</font><font color="black">A</font><font color="#669900">T</font><font color="#FF3300">I</font><font color="#663399">O</font><font color="black">N</font><font color="#0066CC"> :</font></b> 60 mn</p> <img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Habiller les <B>poisson</B>s et les mariner (huile d\’olive, oignon, safran, sel, poivre). <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Suer le blanc de <B>poireaux</B> à l\’huile d\’olive. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Ajouter les <B>crabe</B>s, saisir et écraser. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Ajouter le <B>poisson</B>. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Mouiller avec le fumet de <B>poisson</B>. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Assaisonner. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Cuire à couvert 30min. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Passer au moulin. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Porter à ébullition. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Passer au chinois étamine. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Rectifier. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Réserver. <BR><img src="images/puce1.gif"  border="0"  width="10" height="10">&nbsp;&nbsp;  Servir avec croûtons et sauce rouille en saucière. <BR><BR>', '', 1, 1000, 0, 1000 ,'2010-08-07 16:51:06', 62, '', '0000-00-00 00:00:00', 0, 0, '0000-00-00 00:00:00', '2010-08-6 16:51:06', '0000-00-00 00:00:00', '', '', 'show_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_vote=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nlanguage=\nkeyref=\nreadmore=', 1, 0, 1, '', '', 0, 0, 'robots=\nauthor=');
    Copie/Coller quoi!

    Genre
    $sql = 'INSERT INTO jos_content VALUES("$var_text_all")';
    mais ça marche pas

  6. #6
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Ce n'est pas vraiment clair : tu veux mettre le contenu du textarea dans un champ de la base ou bien executer les instructions SQL que tu mets dans ton textarea ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Envoyer des données dans une base mysql
    Par oitsuki dans le forum Odoo (ex-OpenERP)
    Réponses: 0
    Dernier message: 14/03/2015, 20h09
  2. Envoyer des données dans un formulaire en PHP
    Par alexkickstand dans le forum Langage
    Réponses: 2
    Dernier message: 19/03/2007, 17h17
  3. [Tableaux] inscrire des données dans MySQL
    Par manciaux dans le forum Langage
    Réponses: 5
    Dernier message: 01/09/2006, 09h43
  4. Problème pour rentrer des données dans MySQL
    Par Sandara dans le forum Requêtes
    Réponses: 8
    Dernier message: 06/06/2006, 10h59
  5. [C#] problème avec l'insertion des données dans MySQL
    Par madica dans le forum Accès aux données
    Réponses: 7
    Dernier message: 08/11/2005, 13h27

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo