PDA

View Full Version : sql - delete not work



inik
07-20-2011, 02:51 AM
I try delete line in mysql database and it dont work.Here is a code:


<?php
$sql = "DELETE FROM sentences_servers WHERE sentences_servers.id = '". $_GET['id']. "'";
$result = mysql_query($sql);
if(!$result)
{
echo 'Error...';
}
else
{
header('Location: sentences_servers.php');
}
?>

I dont see any mistake.:confused:

Basil
07-20-2011, 06:18 PM
Your account doesn't have permission to create or delete databases outside of cpanel. This is because they automatically prepend your account name to the database and it's on a shared server so they don't want you being able to delete other people's databases.

If you want to be able to do this programmatically, you're going to have to write a script that logs into cpanel and does it from there.

inik
07-21-2011, 06:28 AM
I have all permissions. (I only test it on localhost)

Basil
07-21-2011, 12:33 PM
Okay, well rather than outputting a string saying there was an error, you should be using mysql_error() (http://php.net/mysql_error) so you can see the actual error it's encountering.

inik
07-22-2011, 12:48 AM
mysql_error : No database selected
I dont include conect.php
Thanks :D