View Single Post
Old 11-29-2002, 02:54 PM   PM User | #11
Wichetael
New Coder

 
Join Date: Nov 2002
Location: Netherlands
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Wichetael has a little shameless behaviour in the past
That simply means that your query: "select * from founds where id=$id" didn't return any results, so either you have no data in you table matching id to $id, or $id has an inapropriate value or the table 'founds' doesn't exist...

Try using this, that should give you some more info:

Code:
<?php
$dbc = mysql_connect('localhost', '', '') or die("Couldn't connect to database");
mysql_select_db('GAME') or die("Couldn't select database");

$query ="SELECT * FROM founds WHERE id=$id";
$result = mysql_query($query);

if (!$result)
  die(mysql_error());

while ($r = mysql_fetch_array($result)) {
  extract($r);
  $fincome = $extractors * 2000 ;
  $sincome = $extractors * $advanced ;
  $income = $fincome + $sincome ;
  
  $query ="UPDATE founds SET balance = $income WHERE id = $id";
  $result = mysql_query($query);
  if (!$result)
    die(mysql_error());
}

echo("Account Balance Updated");

?>
Wichetael is offline   Reply With Quote