How to update a mysql database without reloading page

dotstar

New Member
thanks for looking. I have a very long list of items, users click on an image (a plus sign) to add the item to their personal list. At the moment when they click the + it loads a "add-item.php?itemid=*" which processes the below code then redirects them to their own list, I did have it redirecting back to the global list but then it was unclear to the user if the item was added to their list. how would I go about making it all update the database without going anywhere, im thinking javascript but have never written any. Any help would be brilliant!! :)\[code\]<?php ini_set('display_errors', 'On');error_reporting(E_ALL); $bucketlist=MYSQL_QUERY( "SELECT * FROM membersbuckets where userid = $userid AND bucketid = $bucketid") or die(mysql_error()); $bucketlist=mysql_fetch_array( $bucketlist ) ; if($bucketlist < 1) { mysql_query("INSERT INTO membersbuckets (memberbucketid, userid, bucketid, complete) VALUES ('', '$userid', '$bucketid', '0')"); echo "Adding item to your bucketlist..."; echo "<meta http-equiv='Refresh' content='2; URL=mybucketlist.php'/>"; } else { echo "This item is already on your list, redirecting you to your list"; echo "<meta http-equiv='Refresh' content='2; URL=mybucketlist.php'/>"; }?> \[/code\]Thank you in advance! :)
 
Back
Top