Hello basically I am trying to return the 3 values that are in category_name table.
however this is proving impossible…. When I do the var dump i get array(2) { [0]=> string(3) "one" ["category_name"]=> string(3) "one" } and i dont know what i am doing wrong
$connection = mysql_connect("localhost","admin","");
mysql_select_db("test",$connection);
$result = mysql_query("SELECT category_name FROM category ");
$result2 = mysql_fetch_array ($result);
var_dump ($result2)
You need a loop, since
mysql_fetch_array()will only fetch one row at a time:The above loops
mysql_fetch_array()until there is no data left, adding the rows returned from the DB into the$catsarray.