Can somebody help me combine these 2 iterations, to allow both array items to display on my webpage? What I’m trying to do is to display the videoURL and the corresponding GroupName in my webpage.
First:
try
{
$sql = 'SELECT URL from videoclip';
$result = $pdo->query($sql);
}
catch (PDOException $e)
{
$error ='Error fetching videos:'.$e->getMessage();
include'error.html.php';
exit();
}
while ($row = $result->fetch())
{
$URLS[] = $row['URL'];
}
include 'index.html.php';
Second:
try
{
$sql = 'SELECT GroupName from videoclip';
$result = $pdo->query($sql);
}
catch(PDOException $e)
{
$error ='unable to fecth data:'.$e->getMessage();
include'error.html.php';
exit();
}
while ($row = $result->fetch())
{
$GroupNames[] = $row['GroupName'];
}
include 'index.html.php';
Just combine your query and then build a multidimensional array to pass to
index.html.php