473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

mysql output in array

Hello

What I want to do is to output the data in table in this order.

[PHP]Array
(
[0] => Array
(
[id] => 1
[name] => English
)

[1] => Array
(
[id] => 2
[name] => Deutsch
)

)[/PHP]

I created a way, but I think it can be done easier..
Jan 17 '08 #1
2 2230
Markus
6,050 Expert 4TB
What way have you 'created'?
Jan 17 '08 #2
[php]
$languages_list=array();
$languages = $db->query("SELECT id,name FROM languages");
while($language=$db->fetch_array($languages)){
$languages_list[]=array('id'=>$language[id],'name'=>$language[name]);
}
[/php]
Jan 17 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: James | last post by:
Hi, I have the following code: <PRE> <?php $username = "####t"; $password = "####"; $hostname = "####"; mysql_connect($hostname, $username, $password) or die("Unable to connect to
9
by: Börni | last post by:
Hi, I have an sql query like this: SELECT column FROM table WHERE column1="3" AND column2="1" This query works perfectly if i run it in the command line, to be exactly it return two results. But...
7
by: frizzle | last post by:
Hi, I know this might sound strange but i think(/hope) it's quite simple: I'm running 2 queries in a mysql DB, first one returns 20 results. Now how can i echo results from the second query...
0
by: dohnut | last post by:
Here's one for some bored problem solver :) I ran across this earlier today and fixed it, but don't exactly know why. (that usually only happens in C :) I'm using Perl version 5.8.0 btw. ...
16
by: frizzle | last post by:
Hi there! I'd like to create a function which input is the result of a mySQL query. The output should be exactly the same, only not a mySQL result array, but a 'real' array. So it should also...
1
by: The|Godfather | last post by:
Hello, I have a "slight" problem with the mySQL C API. I want to bind vectors for output/input prepared statements. However, the C API does NOT support such data binding. Is there ANY other way to...
7
by: asenthil | last post by:
Hai to all, this is senthil... i'm now working in the field of VC++... i want to connect a mysql database... just now tried to retrieve rows from a simple mysql database by using VC++ My...
2
by: Flic | last post by:
Hi, I have a basic db that I access with MySQL query browser. Everything seems fine to me but I am using this db as part of a php shopping basket and when I try to add an item I get: Notice:...
5
by: atyndall | last post by:
OK, Well I've got this script and I'd like to implement this function into it where a function retrieves a specified amount of data from a specific mysql database, rearranges a part of it, and...
4
by: bodhiSoma | last post by:
I've got this weird problem. I'm connecting to MySQL via PHP, querying a particular table, closing the connection then parsing and displaying the results. I then modify the table but when I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.