Php array from mysql result

2020-02-29 01:19

I am selecting names of my products from products table in MySQL then I want to present these names to something like names array(name1, name2, ) Where name1Some code here, I want store mysql query result into an array with php, but my code return result: 2h, not what I wish. (the correct result should be 36, 35, 34, 33, 32) php array from mysql result

mysqlresult (PHP 4, PHP 5) mysqlresult Get result data. Get a result row as an enumerated array; mysqlfetcharray() Fetch a result row as an associative array, Using mysqldataseek after some mysqlresult calls, before going into a mysqlfetcharray loop,

Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site How do I get a SQL result that will contain multiple rows into an array: Example SQL Table: ID Cat LineID Qty DealID Cost 1 Phone 1 2 8941 25. 00 2 Phone 2 43 8941 85. 00 3 Net 1 2 8941 1. 00 4 App 1 1 8941 87. 00 5 Phone 1 20 8942 98. 00php array from mysql result Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site

hi greg, why do you use the arrayvalues? wouldn't that deassoc the array? it seems he wants the info as an associative array. so why not just push[ row php array from mysql result If you use PDO instead of phpmysql the return value of PDO: : query() implements the Traversable interface, meaning you can use it e. g. with foreach() (unlike the mysql result resource you get from mysql mysqlfetcharray Fetch a result row as an associative array, a numeric array, or both Warning This extension was deprecated in PHP, and it was removed in PHP. When we want to process the result of a MySQL query in PHP, it is often practical, to store the data directly into an array. Impcityant functions in this context are mysqlfetcharray(), mysqlfetchrow() and mysqlfetchassoc(). (PHP 5, PHP 7) mysqlifetcharray Fetch a result row as an associative, a numeric array, or both. Description. E. g. when a MySQL field is an INT you may expect the field to be returned as an integer, however all fields are simply returned as strings.

Rating: 4.89 / Views: 777