| | |
HELP!!!
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
HI
CAN ANYONE SEE Y THIS IS ECHOING OUT TWICE THE AMOUNTS OF EACH FIELD IN MY DATABASE???
MUCH APPRECIATED
CAN ANYONE SEE Y THIS IS ECHOING OUT TWICE THE AMOUNTS OF EACH FIELD IN MY DATABASE???
PHP Syntax (Toggle Plain Text)
<?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
Last edited by peter_budo; Mar 22nd, 2008 at 5:48 pm. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Nov 2007
Posts: 86
Reputation:
Solved Threads: 6
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.
Sage
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.
PHP Syntax (Toggle Plain Text)
$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
![]() |
Other Threads in the PHP Forum
- Previous Thread: adding name 2login
- Next Thread: PHP-MySQL connection error
| Thread Tools | Search this Thread |
ajax apache api array basics beginner binary bounce broken cakephp checkbox class cms code codingproblem combobox cron curl database date display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration interactive ip java javascript joomla js limit link login mail menu mlm mobile multiple mysql nodes oop outofmemmory paging parse paypal pdf php problem procedure query radio ram random recursion regex remote return script search server sessions smash sms soap source space sql syntax system table tutorial up-to-date update upload url validation validator variable video web webapplications websitecontactform xml youtube






