Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 9 Times in 9 Posts

    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

  • #2
    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
    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?

  • #3
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 9 Times in 9 Posts
    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

  • #4
    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
    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.

  • #5
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 9 Times in 9 Posts
    "mysql_affected_rows()" doesn't seem to print anything...
    Dawson Irvine
    CEO - DNI Web Design
    http://www.dniwebdesign.com

  • #6
    Regular Coder dniwebdesign's Avatar
    Join Date
    Dec 2003
    Location
    Carrot River, Saskatchewan
    Posts
    845
    Thanks
    15
    Thanked 9 Times in 9 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •