Hi.
I've been looking for a code, and found something, edited it a little bit and came up with nothing, so here's the original version of it:
<?php
$dbLink = new mysqli('localhost', 'usr', 'pwd', 'dbName');
if(mysqli_connect_errno()) {
die('Failed to connect to MySQL: ' . mysqli_connect_error());
}
$sql = "SELECT `image_path`, `image_name` FROM `images`";
$result = $dbLink->query($sql);
if($result)
{
while($row = $result->fetch_assoc())
{
echo "<img src='{$row['image_path']}' alt='{$row['image_name']}' /><br>";
}
}
else
{
echo "MySQL query failed: " . $dbLink->error;
}
?>
What I need to do is get the data from a single SQL table and put it from appropriate fields to appropriate columns of the table.
I will also need to put certain text, if a value in a certain column is that... For example:
if value = 2 {print 'JACK'}
else if value = 3 {print 'BILL'}
I'm not into web programming, sorry, I'm more into computer programming, but I need to make my site to show the data, so I'm not trying to learn the whole language, just a part of it to make it work.
If you have questions, for example I didn't explained it well, feel free to ask.
Thanks!