Probleme module PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yves R.
    vBulletin QA
    • Nov 2003
    • 3855
    • 5.6.X

    #16
    Voici le code que tu peux utiliser :

    PHP Code:
    //require_once(../01-bareme/00/php/config.php');

    $products_server     =     'localhost';
    $products_database     =     'shop';
    $products_user         =     'root';
    $products_password     =     '';

    $products_conn = new mysqli($products_server$products_user$products_password$products_database);

    ob_start();

    if (
    $products_conn->connect_errno)
    {
        echo 
    "Failed to connect to MySQL: (" $products_conn->connect_errno ") " $products_conn->connect_error;
    }

    $rs_results $products_conn->query("SELECT * FROM figurine ORDER BY id");

    while (
    $row $rs_results->fetch_array())
    {
        
    $data[] = $row;
    }

    printf("<p>En test</p>");
    printf("<p>N'oubliez pas de lire les règles sous onglet de barre de navigation</p>");

    printf("<table width='1102' height='79' border='1'>");
    printf("<tr>");
    printf("<th width='42' style='width:20px;height:23px;' scope='col'>N°</th>");
    printf("<th width='55' style='width:58px;' scope='col'>-= Figurine =-</th>");
    printf("<th width='41' style='width:10px;' scope='col'>boîte</th>");
    printf("<th width='81' style='width:10px;' scope='col'>chevelure</th>");
    printf("<th width='45' style='width:10px;' scope='col'>corps</th>");
    printf("<th width='57' style='width:10px;' scope='col'>casque</th>");
    printf("<th width='67' style='width:10px;' scope='col'>plastron</th>");
    printf("<th width='77' style='width:10px;' scope='col'>épaulette</th>");
    printf("<th width='41' style='width:10px;' scope='col'>brasL</th>");
    printf("<th width='41' style='width:10px;' scope='col'>brasR</th>");
    printf("<th width='40' style='width:10px;' scope='col'>main</th>");
    printf("<th width='67' style='width:10px;' scope='col'>ceinture</th>");
    printf("<th width='45' style='width:10px;' scope='col'>tibias</th>");
    printf("<th width='59' style='width:10px;' scope='col'>mèche </th>");
    printf("<th width='36' style='width:10px;' scope='col'>tête</th>");
    printf("<th width='50' style='width:10px;' scope='col'>genou</th>");
    printf("<th width='48' style='width:10px;' scope='col'>totem</th>");
    printf("<th width='98' style='width:10px;' scope='col'>accessoire</th>");
    printf("</tr>");

    foreach (
    $data AS $rrows)
    {
        
    printf("<tr>");
        
    printf("<td style='text-align: center' scope='col'>%s</td>"$rrows['id']);
        
    printf("<td style='text-align: center' scope='col'>%s</td>"$rrows['nom']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_boite']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_chevelure']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_corps']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_casque']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_plastron']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_epaulette']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_bras_g']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_bras_d']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_main']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_ceinture']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_tibias']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_meche']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_tete']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_genou']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_totem']);
        
    printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_accessoire']);
        
    printf("</tr>");
    }

    printf("</table>");

    ob_end_flush();

    $products_conn->close(); 

    vBulletin QA - vBulletin Support French - Lead Project Tools developer

    Next release? Soon(tm)

    Comment

    • ORiGaMi
      New Member
      • Sep 2015
      • 17
      • 5.1.x

      #17
      Originally posted by Yves Rigaud
      Voici le code que tu peux utiliser :

      PHP Code:
      //require_once(../01-bareme/00/php/config.php');

      $products_server 'localhost';
      $products_database 'shop';
      $products_user 'root';
      $products_password '';

      $products_conn = new mysqli($products_server$products_user$products_password$products_database);

      ob_start();

      if (
      $products_conn->connect_errno)
      {
      echo 
      "Failed to connect to MySQL: (" $products_conn->connect_errno ") " $products_conn->connect_error;
      }

      $rs_results $products_conn->query("SELECT * FROM figurine ORDER BY id");

      while (
      $row $rs_results->fetch_array())
      {
      $data[] = $row;
      }

      printf("<p>En test</p>");
      printf("<p>N'oubliez pas de lire les règles sous onglet de barre de navigation</p>");

      printf("<table width='1102' height='79' border='1'>");
      printf("<tr>");
      printf("<th width='42' style='width:20px;height:23px;' scope='col'>N°</th>");
      printf("<th width='55' style='width:58px;' scope='col'>-= Figurine =-</th>");
      printf("<th width='41' style='width:10px;' scope='col'>boîte</th>");
      printf("<th width='81' style='width:10px;' scope='col'>chevelure</th>");
      printf("<th width='45' style='width:10px;' scope='col'>corps</th>");
      printf("<th width='57' style='width:10px;' scope='col'>casque</th>");
      printf("<th width='67' style='width:10px;' scope='col'>plastron</th>");
      printf("<th width='77' style='width:10px;' scope='col'>épaulette</th>");
      printf("<th width='41' style='width:10px;' scope='col'>brasL</th>");
      printf("<th width='41' style='width:10px;' scope='col'>brasR</th>");
      printf("<th width='40' style='width:10px;' scope='col'>main</th>");
      printf("<th width='67' style='width:10px;' scope='col'>ceinture</th>");
      printf("<th width='45' style='width:10px;' scope='col'>tibias</th>");
      printf("<th width='59' style='width:10px;' scope='col'>mèche </th>");
      printf("<th width='36' style='width:10px;' scope='col'>tête</th>");
      printf("<th width='50' style='width:10px;' scope='col'>genou</th>");
      printf("<th width='48' style='width:10px;' scope='col'>totem</th>");
      printf("<th width='98' style='width:10px;' scope='col'>accessoire</th>");
      printf("</tr>");

      foreach (
      $data AS $rrows)
      {
      printf("<tr>");
      printf("<td style='text-align: center' scope='col'>%s</td>"$rrows['id']);
      printf("<td style='text-align: center' scope='col'>%s</td>"$rrows['nom']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_boite']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_chevelure']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_corps']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_casque']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_plastron']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_epaulette']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_bras_g']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_bras_d']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_main']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_ceinture']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_tibias']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_meche']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_tete']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_genou']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_totem']);
      printf("<td style='text-align: center' scope='col'>%s €</td>"$rrows['prix_accessoire']);
      printf("</tr>");
      }

      printf("</table>");

      ob_end_flush();

      $products_conn->close(); 

      ah merci, je n'ai pas vu ton message, c'est toujours le même problème,

      je remarque que la page module php ne s'affiche rien chez moi alors que dans ta capture oui
      et la page module html genere encore d'erreur

      edit: c'est bon ouff on y est arrivé
      Last edited by ORiGaMi; Wed 7 Oct '15, 12:41am.

      Comment

      • ORiGaMi
        New Member
        • Sep 2015
        • 17
        • 5.1.x

        #18
        Enfin ça marche impecc sous le module php,
        en tout cas, milles merci à Yves Rigaud et à Wayne Luke

        Thanks you very much

        une dernière modification s'il vous plait:
        Par sécurité pour interdire les petit malins, je voudrais qu'en supprimant ces 4 lignes :
        $products_server = 'localhost';
        $products_database = 'shop';
        $products_user = 'root';
        $products_password = '';

        je les remplace par celui en code php : require_once(../01-bareme/00/php/config.php'); qui est déjà présent mais quel code que l'on peut traduire pour être lu par le module php/html ?
        Last edited by ORiGaMi; Wed 7 Oct '15, 2:51am.

        Comment

        • Yves R.
          vBulletin QA
          • Nov 2003
          • 3855
          • 5.6.X

          #19
          Soit tu modifies les variables (les mots commençants par $) dans le fichier config.php ou tu modifies le code PHP dans la ligne suivante pour correspondre avec ton fichier :

          PHP Code:
          $products_conn = new mysqli($products_server$products_user$products_password$products_database); 

          vBulletin QA - vBulletin Support French - Lead Project Tools developer

          Next release? Soon(tm)

          Comment

          • ORiGaMi
            New Member
            • Sep 2015
            • 17
            • 5.1.x

            #20
            Originally posted by Yves Rigaud
            Soit tu modifies les variables (les mots commençants par $) dans le fichier config.php ou tu modifies le code PHP dans la ligne suivante pour correspondre avec ton fichier :

            PHP Code:
            $products_conn = new mysqli($products_server$products_user$products_password$products_database); 

            1- je n'ai pas bien compris, je voulais supprimer dans la page module php:
            $products_server = 'localhost';
            $products_database = 'shop';
            $products_user = 'root';
            $products_password = '';

            ces 4 lignes à supprimer et je remplace parrequire_once(../01-bareme/00/php/config.php'); qui est déjà présent, c'est le config,php de mon script baréme.
            ce ligne code php require_once(../01-bareme/00/php/config.php'); je voudrais la traduire en module php qui accepte.


            2- voir capture :
            d'ailleurs, il y a un probléme de tableau, elle a dépassé hors forum:
            sur pc ou mac, aucun soucis mais sur des smartphone telephonique iphone ou android, il y a un probléme que j'ai souligné en noir:


            j'ai introduit une ligne de code responsive , j'ai ajouté dans addtionnel.css:
            /* CSS media (max-width: 40em) { table, tbody { display: block; } tr { display: table; width: 100%; } th { font-size: 0; border: none; visibility: hidden; } td, th { display: table-row; } td:before { content: attr(data-headers); display: table-cell; width: 60%; } } */ /*js function makeTablesResponsive(){ var tds = document.getElementsByTagName("td"); for(var i=0; i<tds.length; i++){ var td = tds[i]; if(td.hasAttribute("headers")){ var th = document.getElementById(td.getAttribute("headers")); if(th != null){ td.setAttribute("data-headers", th.textContent); } } } } makeTablesResponsive(); */

            ca n'a pas fonctionné et de coup j'ai ajouté dans la page module php pour le test, ca n'a pas marché.

            j'ai fait une erreur?

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...