0

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

3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by Designer_101
0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.