I have a php function that interogates a table and gets all the fields in a column if a condition is fulfield. So the function returns a collection of elements. The problem is that i want this function to return an array that i can parse and display. The code below:
function get_approved_pictures(){
$con = mysql_connect("localhost","valentinesapp","fBsKAd8RXrfQvBcn");
if (!$con)
{
echo 'eroare de conexiune';
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mynameisbrand_valentineapp", $con);
$all = (mysql_query("SELECT picture FROM users WHERE approved = 1"));
$row=mysql_fetch_assoc($all);
// mysql_close($con);
return $row['picture'];
}
Where am I wrong?
mysql_extension is deprecated. Usemysqli_or PDO