Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-06-2004, 06:35 AM   PM User | #1
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
Question Won't Delete Row

PHP Code:
        $gametype=$_POST["gametype"];
        
$gamenumber=$_POST["gamenumber"];
        
$result1=mysql_query("DELETE FROM hockeystats_gs_headers WHERE gamenumber='$gamenumber' and gametype='$gametype'",$connection) or print mysql_error();
        
$result2=mysql_query("DELETE FROM hockeystats_gs_shots WHERE gamenumber='$gamenumber' and gametype='$gametype'",$connection) or print mysql_error();
        
$result3=mysql_query("DELETE FROM hockeystats_gs_roster WHERE gamenumber='$gamenumber' and gametype='$gametype'",$connection) or print mysql_error();
        
$result4=mysql_query("DELETE FROM hockeystats_gs_goals WHERE gamenumber='$gamenumber' and gametype='$gametype'",$connection) or print mysql_error();
        
$result5=mysql_query("DELETE FROM hockeystats_gs_penalties WHERE gamenumber='$gamenumber' and gametype='$gametype'",$connection) or print mysql_error();
        if (
$result5)
        {
                echo 
"<p class=\"bodymd\"><font face=Arial size=2>The gamesheet has been removed from the database.</font></p>";
        }
        else
        {
            echo 
"<p> <font face=Arial size=2><p class=\"bodylgbold\">Error Removing Player</p></font>";
        } 
I have this code and it won't delete the row from the table. Is there something wrong with it because if there is, I don't see it.
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com
dniwebdesign is offline   Reply With Quote
Old 04-06-2004, 12:41 PM   PM User | #2
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
A quick question, you have the mysql_error() printing out, what does it say?

Second, in your if statement, shouldn't that be:

PHP Code:
if($result1 && $result2 && $result3 && $result4 && $result5) { 
to make sure all the statments executed?
bcarl314 is offline   Reply With Quote
Old 04-06-2004, 02:29 PM   PM User | #3
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
My error doesn't do anything. It seems to execute just fine (even when I had that if statement you told to include) however the row is still in my database after I executed it.
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com
dniwebdesign is offline   Reply With Quote
Old 04-06-2004, 02:40 PM   PM User | #4
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
Debuggin hints:

1) try running the SQL statements from the command line. Do they work then?

2) Are the columns your using in the where clause varchar, char, or text? If not, drop the single quotes around your variables

3) Run the mysql_affected_rows() command after executing each query.
bcarl314 is offline   Reply With Quote
Old 04-07-2004, 04:01 AM   PM User | #5
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
"mysql_affected_rows()" doesn't seem to print anything...
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com
dniwebdesign is offline   Reply With Quote
Old 04-07-2004, 04:47 AM   PM User | #6
dniwebdesign
Regular Coder

 
dniwebdesign's Avatar
 
Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 838
Thanks: 15
Thanked 9 Times in 9 Posts
dniwebdesign is an unknown quantity at this point
Nevermind, found out the problem. Left out something in my form I use to submit the data.
__________________
Dawson Irvine
CEO - DNI Web Design
http://www.dniwebdesign.com
dniwebdesign is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:35 PM.


Advertisement
Log in to turn off these ads.