Jump to content

Help with delete


supermerc

Recommended Posts

Hey,

 

I have a script that goes to a page, which is a vault filled with items and then it gets the image link and id from each item in it and adds it to my database.

 

However I want my script to delete items from my database if they were taken away from the vault.

 

Ive tried a few things but I dont know how to make it work. This is my code that adds to database:

 

<?php
foreach($images as $array) {
foreach($array as $image) {

$pattern2 = '#src=[\'"][^\'"]+/(.+?\.(?:png|jpe?g|gif))[\'"].+?ONMOUSEOVER=[\'"]itempopup\(event,\'(\d+)\'\)[\'"]#i';
preg_match_all($pattern2, $image, $match);

$st = "SELECT * FROM items WHERE spath = '{$match[1][0]}'";
	$qr = mysql_query($st);
	$check = mysql_fetch_array($qr);
	if ($check > 0){
if ($match[2][0] > 0){
$sa = "SELECT * FROM vault WHERE itemid = '{$match[2][0]}'";
	$qv = mysql_query($sa);
	$check2 = mysql_fetch_array($qv);	
if ($match[2][0] !== $check2['itemid']){
$query = mysql_query("INSERT INTO vault (name, spath, itemid) VALUES ('{$check['name']}','{$check['spath']}','{$match[2][0]}')") or die(mysql_error());
}
}



}


}
}


?>

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/158433-help-with-delete/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.