jeudi 24 août 2017

i want t search values from database using checkboxes php mysql

this is my working code for an solo column, but i need to fetch two column more from that table. How i can i do that. please help

Database name: auction

Table name : addproduct

Column names : pro_price, pro_code, hsn_code

This is my code,

if(isset($_REQUEST['search'])){
$pro_price = $_REQUEST['pro_price'];
foreach ($_REQUEST['pro_price'] as $pro_price) {
    $statearray[] = mysql_real_escape_string($pro_price);
}
$states = implode ("','", $statearray);
$sql = "SELECT * FROM addproduct WHERE pro_price IN ('$states'))";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) == 0)
{
    echo "Sorry, but we can not find an entry to match your query...<br><br>";
}
else
{
    echo "<table border='1' width='900' class='srchrslt'>
    <tr class='head'>
    <td>pro_name</td>
    <td>pro_brand</td>
    <td>hsn_code</td>
    <td>pro_tax2</td>
    <td>pro_tax3</td>
    </tr>";
    while($row = mysql_fetch_assoc( $result ))
    {              
        echo "<tr>";

        echo "<td>" . $row['pro_name'] . " </td>";
        echo "<td>" . $row['pro_brand'] . " </td>";
        echo "<td>" . $row['hsn_code'] . " </td>";
        echo "<td>" . $row['pro_tax2'] . " </td>";
        echo "<td>" . $row['pro_tax3'] . " </td>";
        echo "</tr>";
    }
    echo "</table>";
}

}

please help...and thank you




Aucun commentaire:

Enregistrer un commentaire