OK Show me a row like you said:
Columns: amount, id, miscdesc
1: 7.50
2: 7.50
3: 7.50
With three columns? Yet you have 2? Then an example output as in what do you want the code to return to you...

OK Show me a row like you said:
Columns: amount, id, miscdesc
1: 7.50
2: 7.50
3: 7.50
With three columns? Yet you have 2? Then an example output as in what do you want the code to return to you...
How could this hapen to meeeeeeeeeeeeeee?lol.
I want the code to return me the data of the amount column in a total.
Example output:
£7.70
Last edited by Calon; 05-10-2008 at 08:53 PM.
Oh.
Wow. Thats basic.
This will create an array of those values.PHP Code:$amount = array();
$i = 0;
while($row = mysql_fetch_array($query) {
$amount[$i] = str_replace('£, '', $row['amount']); // get the unicode for sterling sign
++$i;
}
How could this hapen to meeeeeeeeeeeeeee?lol.
Code:<?php //mysql login code was here lol $query = mysql_query("SELECT * FROM `money`") $amount = array(); $i = 0; while($row = mysql_fetch_array($query) { $amount[$i] = str_replace('£, '', $row['amount']); // get the unicode for sterling sign } ?>
Hypertext forgot to indentate!!
Back for a while.
Parse error: syntax error, unexpected T_VARIABLE in /home/calonuk/public_html/money.php on line 6
*Awaits help.*
I missed a closing quote. That should work now.Code:<?php //mysql login code was here lol $query = mysql_query("SELECT * FROM `money`") $amount = array(); $i = 0; while($row = mysql_fetch_array($query) { $amount[$i] = str_replace('£', '', $row['amount']); // get the unicode for sterling sign } ?>
GTFO.
How could this hapen to meeeeeeeeeeeeeee?lol.
I missed a closing quote. That should work now.Code:<?php //mysql login code was here lol $query = mysql_query("SELECT * FROM `money`") $amount = array(); $i = 0; while($row = mysql_fetch_array($query) { $amount[$i] = str_replace('£', '', $row['amount']); // get the unicode for sterling sign } ?>
GTFO.Doesn't seem to be working.PHP Code:<?php
mysql_connect( 'localhost', 'calonuk_trains', '*******' ) or die(mysql_error());
mysql_select_db( 'calonuk_website' ) or die(mysql_error());
$query = mysql_query("SELECT * FROM `money`")
$amount = array();
$i = 0;
while($row = mysql_fetch_array($query) {
$amount[$i] = str_replace('£', '', $row['amount']); // get the unicode for sterling sign
}
?>
any table stuff or something? I'm really tired and cant think
Want to hide these adverts? Register an account for free!