i have a problem with my php and sql code. I trying to make code that when i enter some data that related with the database, the output should show 'zero' if the row user_designid equal to 0 and if vice versa it will show 'one'. but the problem is both of output only show the first anwser ('zero').
Php file (co.php is my config)
<?php
require "co.php";
$link = mysqli_connect($h,$u,$p,$db);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
$q = "select * from tab_ss_user where User_name ='".$_POST['name']."'";
$result = mysqli_query($link,$q);
if($result){
echo "<table border='1' >
<tr>
<td align=center> <b>user Id No</b></td>
<td align=center><b>Name</b></td>
<td align=center><b>Password</b></td>
<td align=center><b>responsibility</b></td></td>";
while($data = mysqli_fetch_row($result))
{
echo "<tr>";
echo "<td align=center><option>$data[0]</option></td>";
echo "<td align=center>$data[1]</td>";
echo "<td align=center>$data[2]</td>";
//this is the problem
if($data['User_DesignID'] == 0 ){
echo "<td align=center> zero </td>";
}
else{
echo "<td align=center> one </td>";
}
echo "</tr>";
}
echo "</table>";
}
else{
echo ' Failed';
}
?>
that all thank you.