![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Guest
Posts: n/a
|
PHP experts .. please help!!
I'm trying to make a script to delete a row from a mysql table ......
Can someone tell me what's wrong ??!? Please take a look on the last 7 lines .. without them it works (but the script is not complete) PHP Code:
|
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Too lazy to set a custom title
Join Date: Jan 2002
Location: Holland
Posts: 9,870
|
$sql = "DELETE FROM poly_links WHERE id='$id';";
$result = mysql_query($sql); Try this
__________________
Don't let greediness blur your vision | You gotta let some shit slide icq - 441-456-888 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Too lazy to set a custom title
Join Date: Jan 2002
Location: Holland
Posts: 9,870
|
Does have $id a vaule??
Just put on top print "id value :$id<br>\n"; then you know it has a value..otherwise there is nothing to delete
__________________
Don't let greediness blur your vision | You gotta let some shit slide icq - 441-456-888 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Registered User
Join Date: Apr 2003
Posts: 2
|
Code:
{ $sql = "DELETE FROM poly_links WHERE id=$id"; $result = mysql_query($sql); echo "News Deleted."; } You can verify this by putting: Code:
die("SQL QUERY: " . $sql); DELETE FROM poly_links WHERE id= then that's not valid SQL. Grumpy's quoting suggestion is good practice. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Mar 2003
Location: Los Angeles, CA USA
Posts: 204
|
The quoting isn't necessary for numeric characters, if the field id is in fact numeric. You should write a function to convert all your empty numeric values to NULL and to quote all your strings. A lot of people call these clean up functions, etc. Also mysql_query does not return anything on DELETE or INSERT. So there is no sense in setting $result to nothing
![]() I don't know what error you're getting, but chances are you have no value in $id as suggested previously. Also - I am *guessing* that I cannot see your entire script - but if that *is* the whole script, you need register_globals on...which is a very, very bad thing to do. register_globals if for pretend environments.
__________________
icq5708193 aptgp III -- Build a Blog, an RSS feed, a text TGP, and a thumb TGP all from one installation. Own Comus or AutoGallery? Have APTGP III Installed free for 30 days; no obligations. |
![]() |
![]() ![]() ![]() ![]() ![]() |