HELP!!!

Reply

Join Date: Jul 2007
Posts: 258
Reputation: Designer_101 is an unknown quantity at this point 
Solved Threads: 12
Designer_101's Avatar
Designer_101 Designer_101 is offline Offline
Posting Whiz in Training

HELP!!!

 
0
  #1
Mar 21st, 2008
HI
CAN ANYONE SEE Y THIS IS ECHOING OUT TWICE THE AMOUNTS OF EACH FIELD IN MY DATABASE???

  1. <?php
  2. $count = 0;
  3. $data = array();
  4.  
  5. $query = "SELECT * FROM profile WHERE ID = '1' ";
  6. $result = MYSQL_QUERY($query);
  7. $line = mysql_fetch_array($result);
  8.  
  9. foreach ($line as $col_value) {
  10. $data[$count] = $col_value;
  11. echo $data[$count];
  12. $count++ ;
  13. };

MUCH APPRECIATED
Last edited by peter_budo; Mar 22nd, 2008 at 5:48 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Re: HELP!!!

 
0
  #2
Mar 22nd, 2008
hmmm,
first off, I don't know why your code isn't throwing an error to begin with.
you have an extra ";" at the end there... once you end a function } you don't need to use a ;

I think your problem might be the $count++ but I can't be 100 p on that.
also put a . before the = in your foreach statement and I think that does what you are trying to do.
  1. $query = "SELECT * FROM profile WHERE ID = '1' ";
  2. $result = MYSQL_QUERY($query);
  3. $line = mysql_fetch_array($result);
  4.  
  5. foreach ($line as $col_value) {
  6. $data[$count] .= $col_value;
  7. echo $data[$count];
  8. }

Sage
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 258
Reputation: Designer_101 is an unknown quantity at this point 
Solved Threads: 12
Designer_101's Avatar
Designer_101 Designer_101 is offline Offline
Posting Whiz in Training

Re: HELP!!!

 
0
  #3
Mar 22nd, 2008
hey
thanks for the advise
but i tried using a different variable names and it worked perfectly, maybe a reserved word in php or something.

Yeh anyways much appreciated ;D

thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Re: HELP!!!

 
0
  #4
Mar 22nd, 2008
oh, duh,
was it "count" that was the reserved word?
sage
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,760
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: HELP!!!

 
0
  #5
Mar 23rd, 2008
count is not a reserved word AFAIK. hmmm..
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 258
Reputation: Designer_101 is an unknown quantity at this point 
Solved Threads: 12
Designer_101's Avatar
Designer_101 Designer_101 is offline Offline
Posting Whiz in Training

Re: HELP!!!

 
0
  #6
Mar 23rd, 2008
intresting ?
Anyway

like i said thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC