0
Notice: Undefined index: album_name in C: xampp htdocs gallery.php on line 69
Line 69:
$album_name = $db->data[0]['album_name'];
code of this part:
$db->query( "select * from fotos" )->fetchAll();
if ( $db->rows >= 1 )
{
$album_name = $db->data[0]['album_name'];
echo "<h1>" . $album_name . "</h1>\n";
echo "<a href=\"album.php\" class=\"back\"><img src=\"images/left.png\"/> Voltar</a>";
I need to select to put the album name on my site, but I have this problem
Below the
$db->query( "select * from fotos" )->fetchAll();
but before IF puts a print_r($db); and sends the result.– Thiago Santos
mysql Object ( [query] => select * from photos [data] => Array ( [0] => Array ( [foto_id] => 4 [foto_url] => test.jpg [foto_caption] => [foto_data] => 2017-02-07 00:00:00 [foto_album] => 1 [foto_pos] => 0 [foto_info] => ) [1] => Array ( [foto_id] => 5 [foto_url] => test2.jpg [foto_caption] => [foto_data] => 2017-02-07 00:00:00 [foto_album] => 1 [foto_pos] => 1 [foto_info] => ) [result] => Resource id #8 [Rows] => 2 [config:protected] => Array ( [host] => localhost [port] => 3306 [dbname] => photoupload [user] => root [password] => ) [host:protected] => localhost [port:protected] =>
– Tiago Teixeira
3306 [user:protected] => root [pass:protected] => [dbname:protected] => photoupload [con:protected] => Resource id #6 )
– Tiago Teixeira
As you can see inside your object there is no "album_name", you are sure that the table is Photos?
– Thiago Santos
is another table the album, just make another select inside this for $album_name ?
– Tiago Teixeira
I’ll put an answer down here to get it written better
– Thiago Santos