ok, these may be in the wrong section, but I've only been doing php for a few weeks so9 I think I'm a noob.
first, how do querys return results??
I've got this $money=mysql_query("SELECT money FROM pupils WHERE name='$user'");
$data=mysql_fetch_array($money);
print("$data");
I've tried just printing $money but get an resource id 2 printed??
with the above code I get Array printed? Help?
The second bit is I'm getting the number of shares and there prices from tables, is there any way I can multiply these together as it seems not to work!
code:
$query=mysql_query("SELECT owned.share, shares.price, owned.number FROM owned, shares WHERE ((owned.name ='$user')&&
(shares.share=owned.share))");
while ($row =@ mysql_fetch_array($query)) {
$table_body .="
<table>
<tr><td>$row[share]</td>
<td>$row[number]</td>
<td>$row[price]</td>
<td>$row[number*price]</td></tr>";
}
?>
<table>
<? echo $table_body; ?>
</table>
It connects to the database fine but I can't manipulate the data correctly.