Hey there! any question in your mind? Ask It Now!.

Popular Categories





iam getting a blank row each time whenever iam fetching the data from the database how can i avoid it?

+3 votes
126 views
asked in Programming by amit_pammu Expert (5,030 points)

2 Answers

0 votes
answered by monika (2,040 points)

hello you can try like this :

<?php

if ($_POST)
{
    // open the connection
    $conn = mysql_connect("localhost", "root", "password");
    // pick the database to use
    mysql_select_db("company_register",$conn);

    $sql = "INSERT INTO `tblsignups` VALUES 
('NULL', '$_POST[company]', '$_POST[email]', '$_POST[phone]', '$_POST[address]', '$_POST[comments]', '$_POST[contact_person]')";

    $result = mysql_query($sql, $conn) or die(mysql_error());

    mysql_close($conn);
}

?>
commented by amit_pammu Expert (5,030 points)
// this is my code....along with the useful data i'am also..getting the whole table rows

h2>Products</h2>

<table>
    <tr>
        <th>product name</th>
        <th>product image</th>
    </tr>
    <?php
    foreach ($arrPro as $category):
        ?>

   <tr>        <td>
            <?php
            if ($category['Category']['productcat_id'] == $id) {
                echo $category['Category']['productname'];
            }
            ?>
        </td>
        <td>   
            <?php
            if ($category['Category']['productcat_id'] == $id) {
                $x= $category['Category']['productimage'];
                echo $this->Html->image('products/'.$x);
               
           
            }
            ?>
        </td>
        <td>
            <?php
commented by monika (2,040 points)
Thanks for reply,Hello amit could you tell if you are getting the tables rows so in which case blank rows are coming ? So that i can analysis your code.
0 votes
answered by Avijit
There are two options as I see, first you may check the database and see how the records are constructed second you

may post your code somewhere like in the pastebin, so that I can review and tell you?

Related Questions

0 votes
0 answers 436 views
+8 votes
1 answer 90 views
+1 vote
1 answer 88 views
+7 votes
7 answers 1,046 views
+1 vote
2 answers 93 views
+3 votes
1 answer 364 views
0 votes
1 answer 105 views
+4 votes
3 answers 131 views

Not a Member yet?

Ask to Folks Login

My Account
613 Folks are online
84 members and 529 guest online
Your feedback is highly appreciated