beansandsausages Posted April 18, 2008 Share Posted April 18, 2008 Hey : Try sumit like this. <?php // other script stuff if($_GET['User_ID']) { $User_ID = $_GET['User_Id']; $sql = ""DELETE FROM itsupport WHERE User_ID='{$User_ID}'"; mysql_query($sql) or die('error'); echo " deleted"; } Quote Link to comment Share on other sites More sharing options...
jaybeeb Posted April 18, 2008 Author Share Posted April 18, 2008 Hey : Try sumit like this. Hi, tried that, same thing is happening, blank screen - no errors - doesnt update. Thanks for the help Quote Link to comment Share on other sites More sharing options...
zenag Posted April 18, 2008 Share Posted April 18, 2008 try echo the line .... "DELETE FROM itsupport WHERE User_ID='$User_ID'"; also try it in sql.... Quote Link to comment Share on other sites More sharing options...
zenag Posted April 18, 2008 Share Posted April 18, 2008 <?php mysql_connect("localhost", "root", "") or die ("Could not connect"); mysql_select_db("itsupport") or die ("Could not connect to DB"); if ($_GET['User_ID']) { echo $_GET['User_ID']; $User_ID = $_GET['User_ID']; $query = "DELETE FROM itsupport WHERE User_ID='$User_ID'"; // define the query string mysql_query(query) or die(mysql_error()); echo "DELETE FROM itsupport WHERE User_ID='$User_ID'"; echo "The Row Number $User_ID has been Successfully Removed"; } ?> Quote Link to comment Share on other sites More sharing options...
jaybeeb Posted April 18, 2008 Author Share Posted April 18, 2008 Same again, blank screen, doesnt delete anything. This is getting very irritating but thanks for the help! Quote Link to comment Share on other sites More sharing options...
beansandsausages Posted April 18, 2008 Share Posted April 18, 2008 Hey : Try sumit like this. <?php // other script stuff if($_GET['User_ID']) { $User_ID = $_GET['User_Id']; $sql = ""DELETE FROM itsupport WHERE User_ID='{$User_ID}'"; mysql_query($sql) or die('error'); echo " deleted"; } I used a small d in ID try with a uppercase D see if makes a diff Quote Link to comment Share on other sites More sharing options...
jaybeeb Posted April 18, 2008 Author Share Posted April 18, 2008 I used a small d in ID try with a uppercase D see if makes a diff Hi, I noticed this when I tried it, also noticed your double inverted commas, but still made no diff Quote Link to comment Share on other sites More sharing options...
soycharliente Posted April 18, 2008 Share Posted April 18, 2008 You are STILL saying mysql_query(query) instead of mysql_query($query) like 2 different people have suggested. Do this and see what happens. <?php mysql_connect("localhost", "root", "") or die ("Could not connect"); mysql_select_db("itsupport") or die ("Could not connect to DB"); if (isset($_GET['User_ID'])) { //echo $_GET['User_ID']."<br />"; $User_ID = $_GET['User_ID']; $query = "DELETE FROM `itsupport` WHERE `User_ID`='$User_ID'"; // define the query string //echo $query."<br />"; $result = mysql_query($query) or die (mysql_error()); if (mysql_affected_rows($result)) { echo "The Row Number $User_ID has been Successfully Removed."; } else { echo "No rows affected." } } else { echo "User_ID is not set to anything."; } ?> Quote Link to comment Share on other sites More sharing options...
jaybeeb Posted April 18, 2008 Author Share Posted April 18, 2008 Do this and see what happens. Line 16 you were missing a ';' and line 17 you had an extra '}' after these were sorted I get an error Parse error: syntax error, unexpected T_ELSE in C:\wamp\www\delete1.php on line 19 Thanks, Quote Link to comment Share on other sites More sharing options...
soycharliente Posted April 21, 2008 Share Posted April 21, 2008 Yes I forgot a ; there wasn't an extra } though. And if you're going to post an error message, you need to post the code that is giving it and show what line the error message is referencing. Because I have no idea what code you're using at this point. I assume it's the code I posted, but it could be some variation that you changed. Quote Link to comment Share on other sites More sharing options...
jaybeeb Posted April 21, 2008 Author Share Posted April 21, 2008 Got this working , code I ended up using was very similar to my update. Just posting for people who search this in the future. Thanks everybody for your help <?php require_once 'library/db.php'; if (!($conn = mysql_connect('localhost', 'root', ''))) { showError(); } if (!(mysql_select_db('itsupport', $conn))) { showError(); } $a = $_GET['id']; $query=mysql_query("delete FROM itsupport WHERE User_ID='$a'", $conn); if ($query) echo "The record was successfully deleted. <br><br>"; else echo "Failed to delete the record <br><br>"; mysql_close($conn); include 'currentissues.php'; ?> Quote Link to comment Share on other sites More sharing options...
soycharliente Posted April 21, 2008 Share Posted April 21, 2008 Mark SOLVED please. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.