View Full Version : arghh! delete from mysql db!
Hello,
<?php
include "connect.php";
mysql_db_query($database, "DELETE FROM `shop` WHERE id = $id ") or die("Shop Database DELETE Error");
print "Deleted successful!";
include "disconnect.php";
?>
if the $id is a number this does work, but it does not work if it is something like 'ads123'. So how do i fix this :S?
interactive
06-24-03, 01:47 PM
What type is the id field? Sounds like it could be a integer?
its a text field now, it used to be varchar
interactive
06-25-03, 12:55 PM
Alright still kind of confused about the whole matter. But an easy way to like trouble shoot a mysql query is to have your script just print out the query (so instead of mysql_query just replace it with echo and take off the or die for a second). Then when the page runs copy and paste it in to PHPmyadmin. Works pretty good for me when I can't figure something out. It should tell you what the error is.
ill try it out. But what i want it to do, is to delete the row, where a field called 'id' = "sometext123"
interactive
06-25-03, 01:00 PM
Right right, but if there's something wrong with your query PHPMYADMIN will tell you.
alright, well ill try it :)
problem solved :D
just wrote a thing using isset().......(you don't care do you?)
Placer14
06-27-03, 07:54 AM
next time, go with !isset(); :) :P
vBulletin v3.5.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.