 <p>try</p> <pre><code>$con = mysqli_connect("localhost","root","","test_sms"); if (mysqli_connect_errno()) { echo "Failed to connect:" . mysqli_connect_error(); } $value = "INSERT INTO userstbl (usr_name, usr_pwd, usr_fname, usr_lname) VALUES ('Aftab','xyz','Aftab','Hussain')"; $sqlin = mysql_prep($value); if (!mysqli_query($con, $sqlin)){ die ('Error: ' . mysqli_error($con)); } $sqlot = "SELECT * FROM usertbl"; $sqlo = mysql_prep($sqlot); $sqlout = mysqli_query($con , $sqlo); echo "&lt;table border='1'&gt;&lt;tr&gt;&lt;th&gt;ID&lt;/th&gt;&lt;th&gt;Username&lt;/th&gt;&lt;th&gt;Password&lt;/th&gt;&lt;th&gt;First Name&lt;/th&gt;&lt;th&gt;Last Name&lt;/th&gt;&lt;/tr&gt;"; while ($row = mysqli_fetch_array($sqlout)); { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['usr_id'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['usr_name'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['usr_pwd'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['usr_fname'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['usr_lname'] . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } mysqli_close($con); ?&gt; </code></pre>