hi every one

i find this code

and i read this descreption about it :

code to call function after u click on it

<a href="<?php $_SERVER['PHP_SELF']?>?type=del">
<img src="del.png"/>

my qidtion : can i know any information about image when i call function using this code

i mean can i know id of the image which user click on it

if my image jpg can i use it with this code

how i use it ??

this part3


//call functions


how i use it


10 Years
Discussion Span
Last Post by nav33n

The first code is setting the name of the image. Are you keeping your images in a Link database? If you are you can query your db with the $_GET:

$imagename = $_GET['type'];
$imageinfo = mysql_query("SELECT ID FROM Images WHERE Image_Name = '".$imagename."'") or die(mysql_error());
$imageid = $info['ID'];

Not really sure what your looking for but that is how you can see the image information. If your wanting to view what user clicked on a specific image thats just another table and a little more code.
Table Image Click:
ID, ImageID, Userid, any other info you want.

//include the code above
$ImageClick = mysql_query("INSERT INTO Image_Click (ImageID, Userid, other fields) VALUES (`".$imageid."`, `".$_SESSION['userid']."`, `".$otherfields."`)") or die(mysql_error());

Then you can query this table and view the users that have clicked on what images and possibly the time or any other info you want to view.




is that mean i can do that "


$imageID = $_GET['type'];
mysql_query("DELETE FROM Images WHERE picID= '".$imageID."'") or die(mysql_error());






<a href="<?php $_SERVER['PHP_SELF']?>?type=$row["picId"]">
<img src="$row["link"]"/>


is this code will delete image after user clicked on it

Edited by mike_2000_17: Fixed formatting


Here is the idea.
Pass the id of the image in the query string. <a href='deleteimage.php?id=4'>Delete now </a> Then, in deleteimage.php, get the id, and delete the image.

$id = mysql_real_escape_string($_GET['id']);
$q = "delete from table where imageid = '$id'"; // if you are storing the image in the table (which is a very bad idea)
//redirect the user back to the image display screen
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.