I have purchased godaddy linux by mistake and now I have no clue how to do my simple photo gallery which I used to do with classic ASP!
I have created a MySQL table with fields "image_path" and "no_of_images" etc... What I want to do is connect to the database table, get image_path into img tag and loop till the numeric value stored in "no_of_images" is met.
I have tried to do this with this code but it is not working.
<?php
$servername = "localhost";
$username="";
$password="";
$dbname="";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$myid = $_GET['id'];
$sql = "SELECT * FROM gallery where id='$myid'";
$result = $conn->query($sql);
$row = mysql_fetch_row($result);
$image_path = $row[3];
$no_of_images = $row[4];
$x = 1;
while($x <= $no_of_images ) {
echo "<img src="$image_path"/"$x".jpg><br>";
$x++;
}
$conn->close();
?>
mysql_fetch_row. Those different APIs do not intermix with each other. Having checked for errors, would have signaled an error. php.net/manual/en/mysqli.error.php