0

Hy io have this php script(if you can call php script) anyway i whant that every result to show it one down the another(mysql grid table) but with that kind of search....i've tryied but unf nothing....
this is the "code"

   <?php 
$i = 0;
   if ($_REQUEST["string"]<>'') {    $search_string = " AND (id LIKE '%".mysql_real_escape_string($_REQUEST["string"])."%' OR category LIKE '%".mysql_real_escape_string($_REQUEST["string"])."%')"; } 
   if ($_REQUEST["city"]<>'') {  
   $search_city = " AND category='".mysql_real_escape_string($_REQUEST["city"])."'";    } 
   if ($_REQUEST["from"]<>'' and $_REQUEST["to"]<>'') {   
   $sql = "select date,category,sum(q1) Total,sum(q2) Total2,sum(q3) Total3,sum(q4) Total4,sum(q5) Total5,sum(q6) Total6 from articles WHERE date >= '".mysql_real_escape_string($_REQUEST["from"])."' AND date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city." group by category";} 
   else if ($_REQUEST["from"]<>'') { 
   $sql = "select date,category,sum(q1) Total,sum(q2) Total2,sum(q3) Total3,sum(q4) Total4,sum(q5) Total5,sum(q6) Total6 from articles WHERE date >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_city." group by category";} 
   else if ($_REQUEST["to"]<>'') {
   $sql = "select date,category,sum(q1) Total,sum(q2) Total2,sum(q3) Total3,sum(q4) Total4,sum(q5) Total5,sum(q6) Total6 from articles WHERE date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city." group by category";} 
   else { $sql = "select date,category,sum(q1) Total,sum(q2) Total2,sum(q3) Total3,sum(q4) Total4,sum(q5) Total5,sum(q6) Total6 from articles WHERE id>0".$search_string.$search_city;  } $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); 
   if (mysql_num_rows($sql_result)>0) { 
   while ($row = mysql_fetch_array($sql_result)) { 
     $id = $row["id"];
  $member_name = $row["id"];
    if ($i % 9 == 0) {

   echo'
   <tr><td>$_REQUEST["from"]</td>  
   <td>$_REQUEST["to"]</td>           
   <td>$row["category"]</td>    
   <td>$row["Total6"]</td>    
   <td>$row["Total"]</td> 
   <td>$row["Total2"]</td>    
   <td>'.$row["Total3"].'</td>    
   <td>'.$row["id"].'</td>    
   <td>'.$member_name.'</td>  
   </tr>
   ';
   } else {
       '<td>' . $member_name . '</td>';
    }
    $i++;
    ?>  
   <?php } } else { 
   ?><tr><td colspan="5">No results found.</td><?php    } 
   ?></table><br><br><div class='row no-print'><button class='btn btn-defaul' onclick='window.print();'><i class='fa fa-print'></i>Stampa</button></i><br></div>
2
Contributors
7
Replies
34
Views
3 Years
Discussion Span
Last Post by pritaeas
0

i whant that every result to show it one down the another(mysql grid table) but with that kind of search.

What exactly are you trying to achieve? Can you be a little more specific?

0

i have this row in sql id,q1,q2,q3,q4
and i whant to show in a table like this in table
table(one under another)

id1 q1 q2 q3 q4
id2 q1 q2 q3 q4
id3 q1 q2 q3 q4
0

the problem is that the all of ids shows me in one row not one under the other id

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.