Code: Select all
<?php
$data = mysql_query("SELECT * FROM dealers") or die(mysql_error());
while($info = mysql_fetch_array( $data )) : ?>
<td align="center"><?php echo $info['in']?><br>
<form action="dealercounter.php" method ="post">
<input name="in" type="hidden" value="<?php print $info['dealership']?>">
<input type="submit" value="In +1" >
</form>
</td>
<? endwhile; ?>Code: Select all
<?php
$newname = $HTTP_POST_VARS['in'];
@ $db = mysql_pconnect('localhost','****','*******');
mysql_select_db(intranet);
$result = mysql_query("SELECT * FROM dealers
WHERE dealership='$newname'");
while($row = mysql_fetch_array($result))
{
echo $row['dealership'] . " " . $row['in'];
$increment = $row['in'];
$increment++;
echo "<br>".$increment;
}
mysql_query("UPDATE dealers SET in = '$increment'
WHERE dealership = '$newname'");
$result2 = mysql_query("SELECT * FROM dealers
WHERE dealership='$newname'");
while($row = mysql_fetch_array($result2))
{
echo "<br>".$row['dealership'] . " " . $row['in'];
}
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=dealertrade.php">';
exit;
?>I have this working perfectly on another database, doing the exact same thing. Can anyone let me know WHY this is not behaving here? If you need any additional information I will be happy to provide, just not sure what all you may need.
Edit: It occured to me that I never actually specified the problem, whoops. Anyway the problem is that when I go through all of this the update isn't updating properly. It updates the number but doesn't update the database.
-Z