-1

showcattable is to display a table now i'm calling dispcategoriesstate which will display state of the categories...On the output i'm getting categories state but after that further code execution stops..also no error.
function to show table

function showcattable($con){
    $i=2;
    $select = mysqli_query($con, "SELECT * FROM categories");
    while ($row = mysqli_fetch_assoc($select))
     { 
    echo"<tr>
        <td class='v-align-middle'><div class='checkbox check-default'>
        <input type='checkbox' name='chk[]' value='".$row['cat_id']."' id='checkbox".$i."'>
        <label for='checkbox".$i."'></label>
        </div></td>
        <td class='v-align-middle'>".$row['category_title']." </td>
        <td class='v-align-middle'>".$this->dispcategoriesstate($row['cat_id'],$con);"</td>
        <td>
        <a href='edit_product.php?pro_id=18'>
        <i class='fa fa-pencil-square-o'/>
        </i></a> | 

        <a href='product.php?del_id=18&action=del' onclick=' return confirm('Are you sure you want to delete this?');'>
        <i class='fa fa-close'/>
        </i>
        </a>
        </td>
        </tr>";
        $i++;

    }}


function to display state

function dispcategoriesstate($parent_id,$con) {

        $q="SELECT status FROM categories WHERE cat_id='".$parent_id."'";
        $select=mysqli_query($con,$q);
        $row=mysqli_fetch_array($select);
        if ($row['status']==1)
        {
            return 'active';    
        }
        else
        {
            return 'inactive';
        }

    }
Niraj dev
  • 11
  • 6

1 Answers1

1

Syntax error, semicolon is mistakely added

<td class='v-align-middle'>".$this->dispcategoriesstate($row['cat_id'],$con);"</td>
                                                                            ^

correct it as

<td class='v-align-middle'>".$this->dispcategoriesstate($row['cat_id'],$con)."</td>
Tamil Selvan C
  • 18,342
  • 12
  • 44
  • 63