T
T
TonyStark13372017-09-11 21:12:01
PHP
TonyStark1337, 2017-09-11 21:12:01

How to drive all the news of one category into an array?

Hello, I want to add all the news of one category to 1 array, I did it like this but it doesn’t work

$cat = "it-new";
$resultat = mysql_query("SELECT * FROM `cms_v1.2` WHERE `Categoria` = $cat",$db);
$data = mysql_fetch_array($resultat);
print_r ($resultat);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex_ART, 2017-09-11
@Alex_ART

$cat = "it-new";
$result = mysqli_query($db, "SELECT * FROM `cms_v1.2` WHERE `Categoria` = " . $cat);
$data = array();
while ($row = mysqli_fetch_assoc($result))
{
$data[] = $row;
}
print_r($data);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question