output on insert sql code example
Example 1: sql insert inserted id
DECLARE @Ids_tbl TABLE ([id] INT);
INSERT INTO [sometable] ([ColA],[ColB])
OUTPUT INSERTED.ID INTO @Ids_tbl(id)
VALUES ('valA','valB');
SELECT [id] FROM @Ids_tbl;
Example 2: output data in sql
<?php
$con = mysqli_query("hostname", "username", "pwd", "database");
$sql = "SELECT * FROM `TABLE`";
$result = mysqli_query($con, $sql);
$check = mysqli_num_rows($result);
if($check > 0){
while($data= mysqli_fetch_assoc($result)){
echo $data["ColName"];
}
}
?>