Recover SQL syntax error data

The answer that sarahk provided is how you want to build the content. I think the part about which the OP is confused is how to handle the IF statements for its switches.

For example, you must set the data in a variable and add it based on if statements, such as

if (mysqli_num_rows ($ sql)> 0)
{
while ($ row = mysqli_fetch_array ($ sql)) {
$ output = & # 39; & # 39 ;;
$ exit. = & # 39;& # 39 ;;
$ exit. = & # 39;& # 39; $ row["title"]. & # 39;& # 39 ;;
$ exit. = & # 39;& # 39; $ row["name"]. & # 39;& # 39 ;;

yes ($ row["type"]== 2) {
$ exit. = "type 2";
}
else if ($ row["type"]== 1) {
$ exit. = "Type 1";
}
else if ($ row["type"]== 3) {
$ exit. = "type3";
}
else if ($ row["type"]== 4) {
$ exit. = "type 4";
}
$ exit. = & # 39;& # 39; $ row["add_date"]. & # 39;& # 39 ;;
$ exit. = & # 39;& # 39 ;;
echo $ output;
}
}
plus

PHP:

You can also convert the if / else if multiple in a case statement, since it would be a fairly simple change, and if you want to build the entire page, you can eliminate the removal of $ ouput at the beginning of the while loop. and move the echo to the outside, but I think that this configuration is more to what the OP is looking for.