<?php require_once('Connections/site.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_site, $site);
$query_Recordset1 = "SELECT * FROM obiecte";
$Recordset1 = mysql_query($query_Recordset1, $site) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pagina Principala</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Times New Roman, Times, serif;
    font-size: 18px;
    color: #FFFFFF;
}
body {
    background-color: #000000;
    background-repeat: no-repeat;
}
a:link {
color:#FFFFFF;
text-decoration:none;
}
a:visited {
color:#FFFFFF;
text-decoration:none;
}
a:hover {
color:#FFFFFF;
text-decoration:line-through;
}
a:active {
color:#FFFFFF;
text-decoration:none;
}
-->
</style></head>

<body>
<?php

mysql_select_db($database_site, $site) or trigger_error(mysql_error(), E_USER_NOTICE);
$q = mysql_query("SELECT * FROM obiecte") or trigger_error(mysql_error(), E_USER_NOTICE);
echo "<table border=1 width=1650px style='text-align:center'><tr>";
echo "<td>ID</td>";
echo "<td>Nume Produs</td>";
echo "<td>Lungime</td>";
echo "<td>Bucati</td>";
echo "<td>Latime</td>";
echo "<td>Culoare</td>";
echo "<td>Cantitate Comandata</td>";
echo "<td>Total Cantitate Comandata</td>";
echo "<td>Pret Cumparare</td>";
echo "<td>Total Pret Cumparare</td>";
echo "<td>Pretul Meu</td>";
echo "<td>Total Castig</td>";
echo "<td>Total Castig Fara Pret Cumparare</td>";
echo "<td>Total Pret Materiale Cumparate</td>";
echo "<td>Total Castiguri</td>";
echo "<td><a href=edit.php>Adauga Produse</a></td></tr>";

while ($r = mysql_fetch_array($q))
{
echo "<tr><td>" . $r['id'] . "</td>";
echo "<td>" . $r['nume'] . "</td>";
echo "<td>" . $r['lungime'] . "</td>";
echo "<td>" . $r['bucati'] . "</td>";
echo "<td>" . $r['latime'] . "</td>";
echo "<td>" . $r['culoare'] . "</td>";
echo "<td>" . $r['cantitate_de_comandat'] . "</td>";
echo "<td>" . $r['total_comandat'] . "</td>";
echo "<td>" . $r['pret_cumparare'] . "</td>";
echo "<td>" . $r['pret_cumparare_total_comandat'] . "</td>";
echo "<td>" . $r['pretul_meu'] . "</td>";
echo "<td>" . $r['total_castig'] . "</td>";
echo "<td>" . $r['total_castig_fara_pret_cumparare'] . "</td>";
echo "<td>" . $r['total_pret_cumparare'] . "</td>";
echo "<td>" . $r['total_castiguri'] . "</td>";
echo "<td><input type=submit name=delete id=delete value=Sterge /></td></tr>";
}

?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

so this is my page(its scripts is generated by Dreamweaver CS3) my question is : how do i connect the button(Sterge) so it deletes the column its on ?

Recommended Answers

All 3 Replies

hai foxwizzy,

you done for in your code for editing the entries (see at line 94).

so why dont you follow same procedure for deleting the entry (just suggestion only)? like as follows (at line no 113)

<a href="delete.php?entry_id=<? echo r['current_entry_id']?>">Delete</a>

use the same thing here for deleting entries by passing its entry id value to the appropriate page(i mean 'delete.php' if it is existed).

i think you got my point and its work fine for this kind of requirement

let me know if you feel any doubt in my answer (if you dont want like that kind of answer)

happy coding

sub heaing went rong

sorry for late reply
radhakrishna.p
Works perfect 10x for help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.