Pretty Printing in PHP [Arrays]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aligajani
Forum Newbie
Posts: 1
Joined: Thu Mar 18, 2010 12:50 am

Pretty Printing in PHP [Arrays]

Post by aligajani »

Pretty Printing Arrays in PHP? Auto_Increment Problem, Help =(?
it prints like this, shud be 7 lines and no repetition:
”Array ( [0] => 2 [id] => 2 [1] => Dell [name] => Dell [2] => http://beta.aligajani.com/2009ProfilePic.jpg [url] => http://beta.aligajani.com/2009ProfilePic.jpg [3] => 100 [width] => 100 [4] => 100 [height] => 100 [5] => 1200 [price] => 1200 [6] => 10 [quantity] => 10 ) ”

my list object code is:
function getObjectsArray() {
$query = "SELECT * FROM cart";
$result = mysql_fetch_array(mysql_query($query));
return $result;

OH and also, it prints just the first Element in the table.
moreover, the auto_increment doesnt work out even after i added the query, like if I empty the 2 entry table to 0 data, and enter new, it starts with id=3
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Pretty Printing in PHP [Arrays]

Post by requinix »

I was going to help you. Really: I had already read the question and was writing something in the Reply page... But since you PMed me for no reason but to solicit advice, I will not.
Post Reply