[Besoin d'aide - PHP / MySQL] - cliquable / têtes de tableau triable

  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Mars 6th, 2010, 7:00 pm

Donc, j'ai suivi ce guide:
http://scriptplayground .com / tutorials / php / Impression-a-MySQL-table-à-une-dynamique-HTML-table-avec-PHP /

Et me faire une belle table cherche ma base de données. Maintenant, je veux que ce soit "sortable".

Comment ferais-je les en-têtes de colonne / titres "cliquables" afin que le tableau est ORDER BY qui colonne? De plus, jaimerais cliquez une deuxième fois pour changer l'ordre de monter à descendant, ou vice versa.

Exemple:

Une table qui comporte des colonnes: Nom, âge, poids

Le tableau des listes par "Nom", en descendant, par défaut. Lorsque je clique sur "Nom", les changements afin de descendre à ascendante. Lorsque je clique sur "Age", la table est re-classés par âge, descendant.

Des idées?
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Mars 6th, 2010, 7:00 pm

  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Mars 8th, 2010, 9:27 am

Combien de temps faut-il pour obtenir des réponses sur ce forum? Je suis nouveau à OZZU, donc je ne sais pas grand-chose, mais les forums je participe habituellement seulement prendre une heure ou deux tout au plus à obtenir des réponses.... Its been 2 jours depuis que j'ai commencé ce sujet...Doesnt quelqu'un sait comment faire cela?
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 4:31 pm

Pourriez-vous envoyer un code lorsque vous effectuez la chaîne de requête?
#define NULL (::rand() % 2)
  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Mars 8th, 2010, 4:43 pm

Ill vous donner tout ce que j'ai :)

Wii.php
Code: [ Select ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 .org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3 .org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nintendo Wii Game Lists</title>
</head>
<?php
include("./SQLTables.php");
?>

<body>

<div align="center">
    <h1>Nintendo Wii Games Lists</h1>
</div>

<div align="center">
 <h2>Wish List</h2>
<p><?php
 //Connection
    $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
    $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
    $table = "wish_list";
    $sort = "Name";
    display_db_table($table, $sort, $global_dbh, FALSE, "border='5'");
    ?></p>

<div align="center"> 
 <h2>Owned List</h2>
<p><?php
 //Connection
    $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
    $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
    $table = "owned_list";
    $sort = "Name";
    display_db_table($table, $sort, $global_dbh, FALSE, "border='5'");
    ?></p>
  
</div>


</body>
</html>
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 .org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3 .org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Nintendo Wii Game Lists</title>
  6. </head>
  7. <?php
  8. include("./SQLTables.php");
  9. ?>
  10. <body>
  11. <div align="center">
  12.     <h1>Nintendo Wii Games Lists</h1>
  13. </div>
  14. <div align="center">
  15.  <h2>Wish List</h2>
  16. <p><?php
  17.  //Connection
  18.     $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
  19.     $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
  20.     $table = "wish_list";
  21.     $sort = "Name";
  22.     display_db_table($table, $sort, $global_dbh, FALSE, "border='5'");
  23.     ?></p>
  24. <div align="center"> 
  25.  <h2>Owned List</h2>
  26. <p><?php
  27.  //Connection
  28.     $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
  29.     $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
  30.     $table = "owned_list";
  31.     $sort = "Name";
  32.     display_db_table($table, $sort, $global_dbh, FALSE, "border='5'");
  33.     ?></p>
  34.   
  35. </div>
  36. </body>
  37. </html>


SQLTables.php
Code: [ Select ]

<?php
function display_db_query($query_string, $connection, $image, $table_params) {
    $result_id = mysql_query($query_string, $connection) or die("display_db_query:" . mysql_error());
    $column_count = mysql_num_fields($result_id) or die("display_db_query:" . mysql_error());
    // Here the table attributes from the $table_params variable are added
    print("<TABLE $table_params >\n");
    // Print Headers
    print("<TR>");
    for($column_num = 0; $column_num < $column_count; $column_num++) {
        $field_name = mysql_field_name($result_id, $column_num);
        echo ("<TH>$field_name</TH>");
    }
    print("</TR>\n");
    // Print the body
    while($row = mysql_fetch_row($result_id)) {
        print("<TR ALIGN=LEFT VALIGN=TOP>");
        for($column_num = 0; $column_num < $column_count; $column_num++) {
            if($column_num==0 && $image){
              print("<TD><img src=imageLoader.php?image=amf_bowling</TD>\n");
            }
            else{
              print("<TD>$row[$column_num]</TD>\n");
            }
        }
        print("</TR>\n");
    }
    print("</TABLE>\n");
}

function display_db_table($tablename, $sort, $connection, $image, $table_params) {
    $query_string = "SELECT * FROM $tablename ORDER BY $sort";
    display_db_query($query_string, $connection, $image, $table_params);
}
?>
  1. <?php
  2. function display_db_query($query_string, $connection, $image, $table_params) {
  3.     $result_id = mysql_query($query_string, $connection) or die("display_db_query:" . mysql_error());
  4.     $column_count = mysql_num_fields($result_id) or die("display_db_query:" . mysql_error());
  5.     // Here the table attributes from the $table_params variable are added
  6.     print("<TABLE $table_params >\n");
  7.     // Print Headers
  8.     print("<TR>");
  9.     for($column_num = 0; $column_num < $column_count; $column_num++) {
  10.         $field_name = mysql_field_name($result_id, $column_num);
  11.         echo ("<TH>$field_name</TH>");
  12.     }
  13.     print("</TR>\n");
  14.     // Print the body
  15.     while($row = mysql_fetch_row($result_id)) {
  16.         print("<TR ALIGN=LEFT VALIGN=TOP>");
  17.         for($column_num = 0; $column_num < $column_count; $column_num++) {
  18.             if($column_num==0 && $image){
  19.               print("<TD><img src=imageLoader.php?image=amf_bowling</TD>\n");
  20.             }
  21.             else{
  22.               print("<TD>$row[$column_num]</TD>\n");
  23.             }
  24.         }
  25.         print("</TR>\n");
  26.     }
  27.     print("</TABLE>\n");
  28. }
  29. function display_db_table($tablename, $sort, $connection, $image, $table_params) {
  30.     $query_string = "SELECT * FROM $tablename ORDER BY $sort";
  31.     display_db_query($query_string, $connection, $image, $table_params);
  32. }
  33. ?>
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 5:32 pm

Ce que vous faites est un peu compliquée, car complètement sa dynamique.

Fondamentalement, ce que votre départ pour savoir quoi faire est, pour chaque champ que vous voulez faire en son nom un lien et d'envoyer ce champ que vous voulez effectuer le tri et a joint la direction (asc, desc)
Code: [ Select ]
for($column_num = 0; $column_num < $column_count; $column_num++) {
    $field_name = mysql_field_name($result_id, $column_num);
    echo ("<TH><a href="page.php?order_by=$field_name&sorting=$sort</TH>");
}
  1. for($column_num = 0; $column_num < $column_count; $column_num++) {
  2.     $field_name = mysql_field_name($result_id, $column_num);
  3.     echo ("<TH><a href="page.php?order_by=$field_name&sorting=$sort</TH>");
  4. }


Votre $ sort changera selon whats actuellement définies.

Code: [ Select ]
$order_by = (isset($_GET['order_by'])) ? $_GET['order_by'] : 'Name';
$sorting = (isset($_GET['sorting'])) ? $_GET['sorting'] : 'desc';
  1. $order_by = (isset($_GET['order_by'])) ? $_GET['order_by'] : 'Name';
  2. $sorting = (isset($_GET['sorting'])) ? $_GET['sorting'] : 'desc';


Code: [ Select ]
switch($sorting) {
    case "asc":
        $sort = 'desc';
        break;
    case "desc":
        $sort = 'asc';
        break;
}
  1. switch($sorting) {
  2.     case "asc":
  3.         $sort = 'desc';
  4.         break;
  5.     case "desc":
  6.         $sort = 'asc';
  7.         break;
  8. }
#define NULL (::rand() % 2)
  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Mars 8th, 2010, 8:53 pm

Sérieusement...MERCI!

Wii.php
Code: [ Select ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 .org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3 .org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nintendo Wii Game Lists</title>
</head>
<?php
include("./SQLTables.php");
?>

<body>

<div align="center">
    <h1>Nintendo Wii Games Lists</h1>
</div>

<div align="center">
 <h2>Wish List</h2>
<p><?php
 //Connection
    $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
    $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
    $table = "wish_list";
    $page = "Wii";
    display_db_table($page, $table, $global_dbh, FALSE, "border='5'");
    ?></p>

<div align="center"> 
 <h2>Owned List</h2>
<p><?php
 //Connection
    $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
    $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
    $table = "owned_list";
    $page = "Wii";
    display_db_table($page, $table, $global_dbh, FALSE, "border='5'");
    ?></p>
  
</div>


</body>
</html>
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 .org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3 .org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Nintendo Wii Game Lists</title>
  6. </head>
  7. <?php
  8. include("./SQLTables.php");
  9. ?>
  10. <body>
  11. <div align="center">
  12.     <h1>Nintendo Wii Games Lists</h1>
  13. </div>
  14. <div align="center">
  15.  <h2>Wish List</h2>
  16. <p><?php
  17.  //Connection
  18.     $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
  19.     $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
  20.     $table = "wish_list";
  21.     $page = "Wii";
  22.     display_db_table($page, $table, $global_dbh, FALSE, "border='5'");
  23.     ?></p>
  24. <div align="center"> 
  25.  <h2>Owned List</h2>
  26. <p><?php
  27.  //Connection
  28.     $global_dbh = mysql_connect('localhost','root','mangos') or die("Unable to connect: " . mysql_error() . "<br>");
  29.     $database = mysql_select_db("wii game list") or die( "Unable to select database<br>");
  30.     $table = "owned_list";
  31.     $page = "Wii";
  32.     display_db_table($page, $table, $global_dbh, FALSE, "border='5'");
  33.     ?></p>
  34.   
  35. </div>
  36. </body>
  37. </html>


SQLTables.php
Code: [ Select ]
<?php
function display_db_query($page, $query_string, $connection, $sort, $image, $table_params) {
    $result_id = mysql_query($query_string, $connection) or die("display_db_query:" . mysql_error());
    $column_count = mysql_num_fields($result_id) or die("display_db_query:" . mysql_error());
    // Here the table attributes from the $table_params variable are added
    print("<TABLE $table_params >\n");
    // Print Headers
    print("<TR>");
    for($column_num = 0; $column_num < $column_count; $column_num++) {
        $field_name = mysql_field_name($result_id, $column_num);
        echo ("<TH><a href=\"$page.php?order_by=$field_name&sorting=$sort\">$field_name</a></TH>");
    }
    print("</TR>\n");
    // Print the body
    while($row = mysql_fetch_row($result_id)) {
        print("<TR ALIGN=LEFT VALIGN=TOP>");
        for($column_num = 0; $column_num < $column_count; $column_num++) {
            if($column_num==0 && $image){
              print("<TD><img src=imageLoader.php?image=amf_bowling</TD>\n");
            }
            else{
              print("<TD>$row[$column_num]</TD>\n");
            }
        }
        print("</TR>\n");
    }
    print("</TABLE>\n");
}

function display_db_table($page, $tablename, $connection, $image, $table_params) {
    $order_by = (isset($_GET['order_by'])) ? $_GET['order_by'] : 'Name';
    $sorting = (isset($_GET['sorting'])) ? $_GET['sorting'] : 'desc';
    switch($sorting){
  case "asc":
    $sort = 'desc';
    break;
  case "desc":
    $sort = 'asc';
    break;
    }
    $query_string = "SELECT * FROM $tablename ORDER BY $order_by"." $sort";
    display_db_query($page, $query_string, $connection, $sort, $image, $table_params);
}
?>
  1. <?php
  2. function display_db_query($page, $query_string, $connection, $sort, $image, $table_params) {
  3.     $result_id = mysql_query($query_string, $connection) or die("display_db_query:" . mysql_error());
  4.     $column_count = mysql_num_fields($result_id) or die("display_db_query:" . mysql_error());
  5.     // Here the table attributes from the $table_params variable are added
  6.     print("<TABLE $table_params >\n");
  7.     // Print Headers
  8.     print("<TR>");
  9.     for($column_num = 0; $column_num < $column_count; $column_num++) {
  10.         $field_name = mysql_field_name($result_id, $column_num);
  11.         echo ("<TH><a href=\"$page.php?order_by=$field_name&sorting=$sort\">$field_name</a></TH>");
  12.     }
  13.     print("</TR>\n");
  14.     // Print the body
  15.     while($row = mysql_fetch_row($result_id)) {
  16.         print("<TR ALIGN=LEFT VALIGN=TOP>");
  17.         for($column_num = 0; $column_num < $column_count; $column_num++) {
  18.             if($column_num==0 && $image){
  19.               print("<TD><img src=imageLoader.php?image=amf_bowling</TD>\n");
  20.             }
  21.             else{
  22.               print("<TD>$row[$column_num]</TD>\n");
  23.             }
  24.         }
  25.         print("</TR>\n");
  26.     }
  27.     print("</TABLE>\n");
  28. }
  29. function display_db_table($page, $tablename, $connection, $image, $table_params) {
  30.     $order_by = (isset($_GET['order_by'])) ? $_GET['order_by'] : 'Name';
  31.     $sorting = (isset($_GET['sorting'])) ? $_GET['sorting'] : 'desc';
  32.     switch($sorting){
  33.   case "asc":
  34.     $sort = 'desc';
  35.     break;
  36.   case "desc":
  37.     $sort = 'asc';
  38.     break;
  39.     }
  40.     $query_string = "SELECT * FROM $tablename ORDER BY $order_by"." $sort";
  41.     display_db_query($page, $query_string, $connection, $sort, $image, $table_params);
  42. }
  43. ?>


Im un grand fan de code dynamique :)

Tout cela fonctionne très bien et bon, mais...J'ai 2 tableaux de la page et il est à la fois le rechargement de celles qui utilisent le «clic» d'une table. Donc, si je clique sur la colonne "Name" dans la liste de souhaits, tant la liste de souhaits et la liste de détenus sont en train de s'organiser par leur nom. Je peux presque vivre avec cela, mais si vous cliquez sur le «prix» de la colonne, la table appartenant à la liste disparaît parce que je ne dispose pas d'un "prix" dans la colonne owned_list "" table de la base, de sorte que l'on me donne une erreur.

Pas vraiment vraiment comment il peut se déplacer à celui-ci...Je veux seulement l'unique table pour obtenir rechargées lorsque l'on clique sur la rubrique liens...
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 9:54 pm

Vous pouvez utiliser le nom d'une autre variable dans l'url à différer de chaque table.
#define NULL (::rand() % 2)
  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Mars 8th, 2010, 10:01 pm

SpooF a écrit:
Vous pouvez utiliser le nom d'une autre variable dans l'url à différer de chaque table.


Ya, j'ai pensé que ça, mais .., wouldnt j'ai besoin de suivre tous les tableaux sur la page et assurez-vous que chacun est répertoriée par la dernière position qui a été cliqué? Id besoin pour être dynamique et extensible à% i nombre de tables sur une seule page...
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 10:30 pm

Voici un exemple d'utiliser les sessions pour stocker vos données pour chaque table.

PHP Code: [ Select ]
<?
// begin the session
session_start();
 
$table_name = (isset($_GET['table'])) ? $_GET['table'] : NULL;
$order_by = (isset($_GET['order_by'])) ? $_GET['order_by'] : 'id';
$sorting = (isset($_GET['sorting'])) ? $_GET['sorting'] : 'desc';
 
// Check to see if we have some data saved in our session
if(isset($_SESSION['table_info']))
{
   // Get data in session
   $table_info  = $_SESSION['table_info'];
}
else
{
   // There's no data in the session so lets initialize an array
   $table_info = array();
}
 
// If there is no table supplied we can't do much
if($table_name != NULL)
{
   // Check if the table already has data in our session
   if(isset($table_info[$table_name]))
   {
      // Get table data from session
      $table = $table_info[$table_name];     
   }
   else
   {
      // There's no data for the table so lets initialize an array for the table
      $table = array();
   }
   
   // Update table data (these should always be given in the url so we wont worry about not updating them if they are not set)
   $table['order_by'] = $order_by;
   $table['sorting'] = $sorting;
 
   // Put the table back into our array
   $table_info[$table_name] = $table;
}
 
// Update session with new data
$_SESSION['table_info'] = $table_info;
 
echo '<pre>';
print_r($table_info);
echo '</pre>';
?>
  1. <?
  2. // begin the session
  3. session_start();
  4.  
  5. $table_name = (isset($_GET['table'])) ? $_GET['table'] : NULL;
  6. $order_by = (isset($_GET['order_by'])) ? $_GET['order_by'] : 'id';
  7. $sorting = (isset($_GET['sorting'])) ? $_GET['sorting'] : 'desc';
  8.  
  9. // Check to see if we have some data saved in our session
  10. if(isset($_SESSION['table_info']))
  11. {
  12.    // Get data in session
  13.    $table_info  = $_SESSION['table_info'];
  14. }
  15. else
  16. {
  17.    // There's no data in the session so lets initialize an array
  18.    $table_info = array();
  19. }
  20.  
  21. // If there is no table supplied we can't do much
  22. if($table_name != NULL)
  23. {
  24.    // Check if the table already has data in our session
  25.    if(isset($table_info[$table_name]))
  26.    {
  27.       // Get table data from session
  28.       $table = $table_info[$table_name];     
  29.    }
  30.    else
  31.    {
  32.       // There's no data for the table so lets initialize an array for the table
  33.       $table = array();
  34.    }
  35.    
  36.    // Update table data (these should always be given in the url so we wont worry about not updating them if they are not set)
  37.    $table['order_by'] = $order_by;
  38.    $table['sorting'] = $sorting;
  39.  
  40.    // Put the table back into our array
  41.    $table_info[$table_name] = $table;
  42. }
  43.  
  44. // Update session with new data
  45. $_SESSION['table_info'] = $table_info;
  46.  
  47. echo '<pre>';
  48. print_r($table_info);
  49. echo '</pre>';
  50. ?>


Cela nécessite que vos liens donner un nom de table, champ pour le tri et la façon dont vous voulez qu'il soit trié.
#define NULL (::rand() % 2)
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • Avatar de l’utilisateur
  • Inscription: Mai 22, 2004
  • Messages: 3415
  • Loc: Richland, WA
  • Status: Offline

Message Mars 8th, 2010, 10:34 pm

Heres some out mis à partir de quelques tests:

Code: [ Select ]
// Link: http://192.168.1.200/table_session.php?table=Data&order_by=Field1&sorting=desc

// Output
Array
(
  [Data] => Array
    (
      [order_by] => Field1
      [sorting] => desc
    )

)

// Link: http://192.168.1.200/table_session.php?table=Data&order_by=Field2&sorting=desc

// Output
Array
(
  [Data] => Array
    (
      [order_by] => Field2
      [sorting] => desc
    )

)

// Link: http://192.168.1.200/table_session.php?table=Users&order_by=Field1&sorting=asc

// Output
Array
(
  [Data] => Array
    (
      [order_by] => Field2
      [sorting] => desc
    )

  [Users] => Array
    (
      [order_by] => Field1
      [sorting] => asc
    )

)
  1. // Link: http://192.168.1.200/table_session.php?table=Data&order_by=Field1&sorting=desc
  2. // Output
  3. Array
  4. (
  5.   [Data] => Array
  6.     (
  7.       [order_by] => Field1
  8.       [sorting] => desc
  9.     )
  10. )
  11. // Link: http://192.168.1.200/table_session.php?table=Data&order_by=Field2&sorting=desc
  12. // Output
  13. Array
  14. (
  15.   [Data] => Array
  16.     (
  17.       [order_by] => Field2
  18.       [sorting] => desc
  19.     )
  20. )
  21. // Link: http://192.168.1.200/table_session.php?table=Users&order_by=Field1&sorting=asc
  22. // Output
  23. Array
  24. (
  25.   [Data] => Array
  26.     (
  27.       [order_by] => Field2
  28.       [sorting] => desc
  29.     )
  30.   [Users] => Array
  31.     (
  32.       [order_by] => Field1
  33.       [sorting] => asc
  34.     )
  35. )
#define NULL (::rand() % 2)
  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Mars 9th, 2010, 5:35 pm

Holy crap...LOL! J'ai juste commencé à apprendre le PHP ce dimanche passé et je suis très occupé avec l'ATM travail, donc il va me falloir un peu de temps pour digérer tout cela et le programme d'installation quelque chose.

Merci une tonne pour toute l'aide si loin! Maintenant, ma famille peut être fière de mon geekness et peut-être m'acheter un jeu Wii tout en theyre at it! :D
  • kingdutka
  • Newbie
  • Newbie
  • No Avatar
  • Inscription: Mar 06, 2010
  • Messages: 10
  • Loc: USA
  • Status: Offline

Message Octobre 12th, 2010, 12:23 pm

Donc, Ive a obtenu tout ce travail, mais j'ai maintenant besoin d'ajouter dans un "tri secondaire". Je comprends comment il fonctionne dans SQL, mais pas en PHP. Je cherche moins une ligne de code en particulier:

Code: [ Select ]
echo ("<TH><a href=\"$page.php?order_by=$field_name&sorting=$sort&tablename=$tablename\">$field_name</a></TH>");


Que ferais-je ajouter à l'URL PHP pour donner un second tri comme vous voyez dans l'exemple #4 ici:
techonthenet. com / sql / order_by.php
  • righteous_trespasser
  • Scuffle
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Mar 12, 2007
  • Messages: 6228
  • Loc: South-Africa
  • Status: Offline

Message Octobre 13th, 2010, 1:21 am

Ive a obtenu une autre solution pour vous...comment jQuerys sur tablesorter .
Let's leave all our *plum* where it is and go live in the jungle ...

Afficher de l'information

  • Total des messages de ce sujet: 13 messages
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 140 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC