hy i have this collums and what i'm trying to do is to
1.make a search form that can show me the total of the values table q1(the sum) for example that i whant to chose a category wich it have same name at collum but different id,
this is my table

-- phpMyAdmin SQL Dump
-- version 4.1.8
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: 26 Iun 2014 la 14:49
-- Server version: 5.1.73-cll
-- PHP Version: 5.4.23

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!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 utf8 */;

--
-- Database: `bolfescu_1`
--

-- --------------------------------------------------------

--
-- Structura de tabel pentru tabelul `articles`
--

CREATE TABLE IF NOT EXISTS `articles` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` varchar(255) NOT NULL,
  `CarrelliCC` int(11) NOT NULL,
  `CarrelliCC2` int(11) NOT NULL,
  `Carrelli` int(11) NOT NULL,
  `Carrelli2` int(11) NOT NULL,
  `Ripiani` int(11) NOT NULL,
  `Ripiani2` int(11) NOT NULL,
  `Prolunghe` int(11) NOT NULL,
  `Prolunghe2` int(11) NOT NULL,
  `DoppieProlunghe` int(11) NOT NULL,
  `DoppieProlunghe2` int(11) NOT NULL,
  `q1` int(11) NOT NULL,
  `q2` int(11) NOT NULL,
  `q3` int(11) NOT NULL,
  `q4` int(11) NOT NULL,
  `q5` int(11) NOT NULL,
  `date` date NOT NULL,
  `pv` varchar(255) NOT NULL,
  `Carl` int(11) NOT NULL,
  `q6` int(11) NOT NULL,
  `carl2` int(11) NOT NULL,
  PRIMARY KEY (`id`,`category`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Salvarea datelor din tabel `articles`
--

INSERT INTO `articles` (`id`, `category`, `CarrelliCC`, `CarrelliCC2`, `Carrelli`, `Carrelli2`, `Ripiani`, `Ripiani2`, `Prolunghe`, `Prolunghe2`, `DoppieProlunghe`, `DoppieProlunghe2`, `q1`, `q2`, `q3`, `q4`, `q5`, `date`, `pv`, `Carl`, `q6`, `carl2`) VALUES
(1, 'centro ittico ,12345678993', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, '2014-06-26', '', 1, 0, 1),
(2, 'centro ittico ,12345678993', 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 50, 50, 50, 50, 50, '2014-06-26', '', 100, 50, 50),
(3, 'acsa,16515', 5, 5, 55, 5, 5, 5, 5, 5, 5, 5, 0, 50, 0, 0, 0, '2014-06-26', '', 5, 0, 5),
(4, 'acsa,16515', 4, 0, 1, 0, 20, 0, 4, 0, 0, 0, 4, 1, 20, 4, 0, '2014-06-26', '', 1, 0, 1),
(5, 'centro ittico ,12345678993', 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, '2014-06-26', '', 2, 1, 1);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

for ex

(1, 'centro ittico ,12345678993', 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, '2014-06-26', '', 1, 0, 1),
    (2, 'centro ittico ,12345678993', 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 50, 50, 50, 50, 50, '2014-06-26', '', 100, 50, 50),

i whant a sum of q1 of centro ittico....and listed in a table...

div class="form-group"><select class="form-control" name="city">
<option  value="">--</option>
<?php
    $sql = "SELECT * FROM articles GROUP BY category ORDER BY id ASC";
    $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
    while ($row = mysql_fetch_assoc($sql_result)) {
        echo "<option value='".$row["category"]."'".($row["category"]==$_REQUEST["city"] ? " selected" : "").">".$row["category"]."</option>";
    }
?>
</select></div>
<input  class="btn btn-primary"  type="submit" name="button" id="button" value="Conferma" />
  </label>
  <input  type="button" class="btn btn-primary"  type="submit" name="button" id="button"   onClick="location.href='search.php'" value="Cancela" />
</form>
<br /><br />
</div>
<?php
if ($_REQUEST["string"]<>'') {
    $search_string = " AND (full_name LIKE '%".mysql_real_escape_string($_REQUEST["string"])."%' OR email 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 * FROM articles WHERE date >= '".mysql_real_escape_string($_REQUEST["from"])."' AND date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city;
} else if ($_REQUEST["from"]<>'') {
    $sql = "SELECT * FROM articles WHERE date >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_city;
} else if ($_REQUEST["to"]<>'') {
    $sql = "SELECT * FROM articles WHERE date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city;
} else {
    $sql = "SELECT * 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_assoc($sql_result)) {

 echo "  <table class='table table-bordered table-hover '>
  <tr>
    <td><strong>".$row["category"]."</strong></td>
    <td ><strong>Carrelli con piastra luc.ROSSO</strong></td>
    <td ><strong>Carrelli con piastra luc.NERO</strong></td>
    <td><strong>Carelli - senza piastra</strong></td>
     <td><strong>Ripiani</strong></td>
      <td><strong>Prolunghe</strong></td>
       <td><strong>Doppie Prolunghe</strong></td>
   <tr><td>Data : ".$row['date']."</td><td>".$row['q6']."</td><td>".$row['q1']."</td><td>".$row['q2']."</td><td>".$row['q3']."</td><td>".$row['q4']."</td><td>".$row['q5']."</td></tr></table>";

  ?>

<?php
    }
} else {
?>
<tr><td colspan="5">No results found.</td>
<?php    
}
?>

this is my script..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.