<?php
// public trailer config
// trailer-config.php
$title = "What_I_am_looking_for";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// select statement
$sql = "SELECT * from SEARCHTABLE where WHAT-I-AM-LOOKING-FOR ='$title' ";
// result from select statement in groups of 4
$result = $conn->query($sql);
if ($result->num_rows > 0) {
$count=0;
while($row = $result->fetch_assoc()){
$count++;
if ($count % 4 == 0) {
echo 'NOT FIRST RECORD';
} else {
echo 'FIRST RECORD';
}
}
} else {
echo '0 results',"\n";
}
?>
我需要输出为FIRST-RECORD 3 NOT-FIRST-RECORDS然后重复。任何帮助将不胜感激。