I have found an error in my code that somehow having html code with a image with no url causes my mysql query to insert twice. Is there any logic to this or is there something else wrong in my code? Please keep in mind hat I am still learning php and mysql.
HTML code
<td width="70"><img src="" height="70" width="70"></td>
MYSQL code
mysql_query("INSERT INTO `database`.`user_inventory` (`user_id`, `item_id`, `status`) VALUES (1, 1, 'locked')");
An image with no
srctries to load the current page as the image (the same way how<a href="">links back to the current page). If the MySQL query is triggered every time the page is loaded that’s why you’re seeng it happen twice. There’s not really a reason to have an emptysrcanyway.