Jump to content

Problem with PHP/Mysql


Gruzin

Recommended Posts

hi guys, I want to display the result form db and add it some Edit and Delete function, here is my effort but think I'am not on  a correct way. Your ideas will be very appreciated.

P.S I won't post the Reslut script, it works ok, here is the delete function, which of course doesn't work...

[code]<?php
$con = mysql_connect("localhost","user","pass"); //connect to db
if(!$con){
  die('Error:'.mysql_error());
  }
mysql_select_db("user", $con); //select db

$query = "SELECT * FROM link_manager WHERE id ORDER BY id";
$result = mysql_query($query) or die("Error: " . mysql_error());
while($row = mysql_fetch_array($result))
$id = $row['id'];
$query2 = "DELETE * FROM link_manager WHERE id = $id";
$result2 = mysql_query($query2) or die("Error: " . mysql_error());
header( 'Location: http://www.mysite.net/links/') ;
mysql_close($con);
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/19138-problem-with-phpmysql/
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.