chuddyuk Posted July 2, 2006 Share Posted July 2, 2006 Before anyone says it, iv tried searchin the forum to see if i can work out why my script isnt working, but had no luck. its a simple one anyway:im trying to delete records from my db using this code:[code]<?include "connect.php";$id = $_REQUEST['id'];$query = "DELETE FROM gallery WHERE id = '$id'";$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());echo "Database Updated.";?>[/code]I get the error: Cannot query the database.Query was emptyanyone know where im going wrong? :) Link to comment https://forums.phpfreaks.com/topic/13465-php-delete-problem/ Share on other sites More sharing options...
trq Posted July 2, 2006 Share Posted July 2, 2006 Your assigning your query to a variable called $query, then executing a query with the variable $sql.Try...[code]$result = mysql_query($query) or die("Cannot query the database.<br>" . mysql_error());[/code] Link to comment https://forums.phpfreaks.com/topic/13465-php-delete-problem/#findComment-52021 Share on other sites More sharing options...
chuddyuk Posted July 2, 2006 Author Share Posted July 2, 2006 Your a star mate, it was staring me right in the face. Much Appriceated! Link to comment https://forums.phpfreaks.com/topic/13465-php-delete-problem/#findComment-52024 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.