View Single Post
Old 02-05-2022, 05:50 AM  
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
Again I have no idea what you are doing and why you are even using loops if you are doing LIMIT 1, but maybe this will steer you in the right direction.

PHP Code:
<?php
$servername 
"localhost";
$username "user";
$password "pass";
$dbname "db";
$conn = new mysqli($servername$username$password$dbname);
if (
$conn->connect_error) {
    die(
"Connection failed: " $conn->connect_error);
}

$result $conn->query("SELECT * FROM Table WHERE Body != '' LIMIT 1");
if (
$result->num_rows 0) {
    while(
$row $result->fetch_assoc()) {
        
$sresult $conn->query("SELECT * FROM Table WHERE Keyword != '' LIMIT 1");
        while(
$srow $sresult->fetch_assoc()) {
            echo 
"<a href=\"urldotcom\">".$srow['Keyword']."</a>";
        }
    }
} else {
    echo 
"0 results";
}
?>
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote