0

I have this code:

 <?php
 $servername = "localhost";
 $username = "jobs_XXXX";
 $password = "XXXXXX";
 $dbname = "jobs_XXXX";

 // Create connection
 $conn = mysqli_connect($servername, $username, $password, $dbname);
 // Check connection
 if (!$conn) {
 die("Connection failed: " . mysqli_connect_error());
 }

 $sql = "SELECT job_numb, job_name, comments FROM jobs_canjobs";
 $result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
    echo "Job Number: " . $row["job_numb"]. " Job Name: " . $row["job_name"]. " Comments" . $row["comments"]. "<br>";
}
} else {
echo "0 results";
}

 mysqli_close($conn);
?>

And what I would LIKE is that the TR loops with the next data row and for some reason It isn't doing anything. I know displaying SQL data is supposed to be easy, but I cannot see what I am doing wrong. Any help would be appreciated.

I did not know I was mixing statements.

EDITED with SQLi and works. Now I have to format into a table.

Sean Rawles
  • 55
  • 1
  • 8

0 Answers0