PHP MySQL Return Results Issue


Posted on 16th Feb 2014 07:03 pm by admin

Hi guys,

I'm running joomla and made a module which is using ajax.
Basically i just have an html input textbox which i put a SQL statement in and then onblur it does the ajax script which returns the query results.

my sql query: "SELECT * FROM jos_users"

So, why does this:
Code: $result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
for ($x=1; $x<=count($row); $x++)
{
echo $row[$x]."<br />";
}
}

return this:
QuoteAdministrator
admin
your-email@email.com
21232f297a57a5a743894a0e4a801fc3
Super Administrator
0
1
25
2005-09-28 00:00:00
2009-10-14 13:11:45

while this:
Code: $result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
foreach ($row as $item)
{
echo $item."<br />";
}
}

return this:
Quote62
62
Administrator
Administrator
admin
admin

your-email@email.com
21232f297a57a5a743894a0e4a801fc3
21232f297a57a5a743894a0e4a801fc3
Super Administrator
Super Administrator
0
0
1
1
25
25
2005-09-28 00:00:00
2005-09-28 00:00:00
2009-10-14 13:11:45
2009-10-14 13:11:45

Thanks for any light you can shed.

No comments posted yet

Your Answer:

Login to answer
308 Like 19 Dislike
Previous forums Next forums
Other forums

How to search for several parameters from objects in a database?
I have a database with lots of information about objects.
Now I would like to search for 4 or 5 p

reating a background image
I am building a site in drupal and have a php form in it, due to certain annoyances with module buil

Check if another session of the page is running?
I want to keep people from opening multiple tabs, or sessions of my Facebook app. Is it possible to

Upload, SSL and more php help
I recently just installed a ssl cert and do i use https for the whole site or just for the checkout.

Two fgetcsv related questions ;D
First of im trying to get a file from a merchants server but the directory is protected, I know the

Retrieving innerHTML with cURL?
Hey all (sorry I know I'm a leecher, but I soon won't be. This is my first PHP project, but not my l

Trouble verifying database password
Thankyou to everyone who responded to my last post (I can't find the posting, it has been buried). <

Need help in log in and log out?
hi there all of u. i have recently created a site for someone. i have placed log in and log out and

compile php5 with DOM
Hi,

I can't manage to compile php 5.3.0 from source on Windows to include DOM,
in spite of

Making multiple rows with one query
I have a table called efed_handler_characters with two fields handler_id and bio_id. What query 2 is

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash