its easier to help when you explain what you want in more detail.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
what are the smilies for?
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
is it outputting the images ok, is the delete function the only thing you are having trouble with.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
i typed this up for you. i only fixed the delete images part and copied the rest of your code.
try it, and tell me if there are errors.
<?php
//Set page name
$thispage = 'index.php';
//Fill in database info
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'pickapic';
$con = mysql_connect($host,$user,$pass) or die('Could not connect');
mysql_select_db($db) or die('Error: Could not select database');
if (isset($_GET['do'])) {
$do = $_GET['do'];
switch($do) {
case "delete":
if (isset($_GET['id'])) {
$id = mysql_real_escape_string($_GET['id']);
$sql = "DELETE FROM `photo` WHERE `Pid` = " . $id;
$query = mysql_query($sql) or die('Error: ' . mysql_error());
}
break;
}
}
$table = '<table width="40%" border="0" align="center">';
$sql1 = "SELECT `Pname` FROM `photo`";
$sql2 = "SELECT `Pid`,`link` FROM `photo`";
$query1 = mysql_query($sql1);
$query2 = mysql_query($sql2);
$count = 0;
while ($row = mysql_fetch_assoc($query1)) {
if ($count == 0) {
$table .= '<tr>';
}
$image = $row['link'];
$id = $row['link'];
$table .= '<td><img src="file:///C|/xampp/htdocs/PickaPic/admin/img/' . $image . '" width="150" height="150" border="0" onClick="vvvv(\'' . $id . '\');" /></td>';
$count++;
if ($count == 5) {
$table .= '</tr>';
$table .= '<tr>';
for ($i = 0; $i < 5; $i++) {
$row2 = mysql_fetch_assoc($query2);
$name1 = $row2['Pname'];
$table .= '<td><div align="center"><span class="style6"> ' . $name1 . ' </span></div></td>';
}
$table .= '</tr>';
$count = 0;
}
}
$table .= '</table>';
mysql_close($con);
?>
<html>
<head>
<title></title>
<script type="text/javascript">
function vvvv(id) {
if (confirm("Are you sure you want to delete this image?")) {
window.location = '<?php echo $thispage;?>?do=delete&id='+id;
}
}
</script>
</head>
<body>
<?php echo $table;?>
</body>
</html>
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
is this is personal project?
i was just curious
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
that was really confusing. are you saying that my confirm javascript didn't execute and the image was not deleted.
or are you talking about another code.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
i have no idea what the problem is. i would have to see it for myself to maybe find the error. i didn't see anything wrong with my code.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
i guess you can send it to me. i won't be able to get to it until later today.
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194