I want to be able to display data from mysql for example an anime name and episode and be able to click on a button to add to an episode and one to remove from episode till now i was able to do it. Tricky thing is for multiple anime on the same page i need a different way to do it than this:
Code: Select all
$sql="SELECT * FROM anime WHERE username = '$username' ";
$result=mysql_query($sql) or die(mysql_error());
while($rows=mysql_fetch_array($result))
{
if (isset($_POST['submit1']))
{ mysql_query("UPDATE anime SET episode='$rows[episode]'+1 where name='$rows[name]' AND username='$username'") or die("cannot send your password");
header("Location: {$_SERVER['HTTP_REFERER']}");
}
if (isset($_POST['submit2']))
{ mysql_query("UPDATE anime SET episode='$rows[episode]'-1 where name='$rows[name]' AND username='$username'") or die("cannot send your password");
header("Location: {$_SERVER['HTTP_REFERER']}");
}
?>
<form name="myform" action="atview.php" method="post">
<table>
<tr>
<center><td>anime:</td></center>
<center><td><?php echo "$rows[name]"; ?></td></center>
</tr>
<tr>
<center><td>episode:</td></center>
<center><td><input name="submit2" type="submit" value="-" /><?php echo "$rows[episode]"; ?><input name="submit1" type="submit" value="+" /> </td></center>
</tr>
</table>
</form>
<?php
}
mysql_close();I hope you can understand what i said because I find it hard to explain, thank you for your help...