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"; } Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520219 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 Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520230 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.... Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520237 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"; } ?> Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520239 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! Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520244 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 Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520250 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 Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520253 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."; } ?> Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520404 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, Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-520419 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. Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-522387 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'; ?> Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-522690 Share on other sites More sharing options...
soycharliente Posted April 21, 2008 Share Posted April 21, 2008 Mark SOLVED please. Link to comment https://forums.phpfreaks.com/topic/100938-solved-deleting-rows-from-mysql/page/2/#findComment-522809 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.