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.

308 Like 19 Dislike
Previous php-forum Next php-forum
Other php-forum

Problem with PHP code- simple contact form
I'm relativily new to PHP; I know HTML and CSS stuff but I have a problem- I have a contact form wit

[PHP HELP] Php order form.
Hello to everyone @ phpfreaks. Im new to this site and hope to learn lots of things here.

Fir

How to convert this array to string
I am having problems converting this array to a string
using print_r($val[1]); I get:
Code: [

PHP4 to PHP5 Conversion
Hi Everyone,

I am working on a site that is built up on PHP4 and each page is being started f

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

for loop without same $i digits?
Hi,

Can some guru please advise how can I accomplish this with a simple for loop ?

I

Just a white page
Okay so, my website, when I click SignUp on it it takes me to /join.php but its a complete white pag

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

start new row of pictures
on my site www.budstreasureauctions.com there is a featured auctions box that users will pay to get

javascript in php code causes page to display white
Hi All,

Odd one this, I've got the following code (below) which is a simple log in form. The

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