HI
CAN ANYONE SEE Y THIS IS ECHOING OUT TWICE THE AMOUNTS OF EACH FIELD IN MY DATABASE???

<?php
$count = 0;
$data = array();

$query = "SELECT * FROM profile WHERE ID = '1' ";
$result = MYSQL_QUERY($query);
$line = mysql_fetch_array($result);

foreach ($line as $col_value) {
 $data[$count] = $col_value;
 echo $data[$count];
		   $count++ ;
};

MUCH APPRECIATED

Recommended Answers

All 5 Replies

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.

$query = "SELECT * FROM profile WHERE ID = '1' ";
$result = MYSQL_QUERY($query);
$line = mysql_fetch_array($result);

foreach ($line as $col_value) {
$data[$count] .= $col_value;
echo $data[$count];
}

Sage

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

oh, duh,
was it "count" that was the reserved word?
sage

count is not a reserved word AFAIK. hmmm..

intresting ?
Anyway

like i said thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.