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.
Did you know?Explore Trending and Topic pages for more stories like this.

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 can i use [] tags instead of <> tags for profiles??
On my site im making ive made it so u can register, login and u have a profile which u can update..<

Best way to check for end of a record and send it back to the first record
I'm hoping someone can help me out and explain the best way to accomplish this.

What I'm doin

Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont re

how to populate a drop down box
Hi buddies!

PROCEDURE DOWNLOAD_REPORT_FORM (report_name varchar) is begin DOWNLO

string to currency format
Hi guys...

Actually I chunk out some data from txtfile and one of the data contains amount va

Looking for help on using joining mysql tables and php....
Does anyone have any good links to references on how to pull mysql data, through joining tables and

C - Reading a file into a byte array
Hi,

I'm trying to read a file into a byte array in C. I have to use C as this is for a loadru

New to PHP and just trying to understand a little code.
I hope I'm not annoying anyone or breaking the rules but I was wondering about this bit of code righ

WORDPRESS - Multiple Loops Only Going to One Post?
I have various pages with multiple loops and i need them to be individual to all other categories.

MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them

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