Welcome! Log In Create A New Profile

Advanced

DELETING

Posted by MOKIRI 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
DELETING
September 16, 2011 08:54AM
Will i be wrong if i just delete the row without first displaying a confirmation messase "Do you really want to delete the information" or the objective is just to see my ability to delete data from the database?
avatar
Mac
Re: DELETING
September 16, 2011 02:03PM
You should always give the user an opportunity to confirm. With one wrong click there is no going back. Imagine you are the President and click a button "Fire nuclear rockets at House 132" without an opportunity to make sure it is not your house at number 131.
Re: DELETING
September 20, 2011 01:52PM
lol! that great mac you are really inspiring us
Re: DELETING
September 22, 2011 09:09AM
LOL...... Ok thanks for that i never thought it could be that dangerous
Re: DELETING
September 22, 2011 11:24AM
im done
Re: DELETING
October 05, 2011 01:19PM
Hi Mac,i still have that deleting problem,it does not delete
here is the code:
Language: PHP
if (isset($_REQUEST[';delete';])==';yes';) {   $error="do you really want to delete? <a href=';delete.php';>Yes</a> or <a href=';list.php';>No</a></p>";   }elseif (isset($_REQUEST[';delete';])) { //then the sql delete statement

the yes and no links displays but yes does not work.
Re: password
October 05, 2011 01:28PM
Hi Mac,i just want to ask if there are marks for using password protection method md5,the reason is that when i use it,it does not remember the password i have inserted but it can accept the one stored in the database.eg-if insert ddd as apassword on the login page which is the password i have successfully registered with,i cant get access to the other pages(insert,list...),but when i open mysql and copy the password stored with md5 methord\function i can access the pages.i am not sure if i should use it or not when i upload my portfolio.confused smiley
avatar
Mac
Re: password
October 05, 2011 02:35PM
43895107 Wrote:
-------------------------------------------------------
> Hi Mac,i just want to ask if there are marks for
> using password protection method md5,the reason is

That is considered advanced PHP. It is not in the requirements.
avatar
Mac
Re: DELETING
October 05, 2011 02:37PM
43895107 Wrote:
-------------------------------------------------------
> Hi Mac,i still have that deleting problem,it does
> not delete
> here is the code:

Well, you are not sending variables with your a href to inform that you are sure
Language: PHP
<a href="delete.php?delete=absolutely">Yes ......   }elseif (isset($_GET[';delete';]==';absolutely';)) {
Re: DELETING
October 05, 2011 03:02PM
I have tryed it but nothing cms to work cuz no record is been deleted
here it is:
Language: PHP
if (isset($_GET[';delete';])==';yes';) {   $error="do you really want to delete? <a href=';delete.php?delete==absolutely';>Yes</a> or <a href=';list.php';>No</a></p>";   }elseif (isset($_GET[';delete';])==';absolutely';) { sql delete query
avatar
Mac
Re: DELETING
October 05, 2011 03:49PM
well, then your delete query is wrong. Do your own tests to see where the script is taking you.

Language: PHP
}elseif (isset($_GET[';delete';])==';absolutely';) { echo "deleted"; //if this is echoed, then you know the code has executed to this point correctly, and the problem lies elsewhere.
Re: DELETING
October 06, 2011 10:58AM
Hi Mac,my delete sql cms to work fine without those if statements.but when i try to insert those if statements like you said it does not work.i'm thinking of submiting it with delete that does not have a confrim.here is what i tryed again:
Language: PHP
if (isset($_REQUEST[';delete';])=="yes") {   $error="do you really want to delete? <a href=';delete.php?delete==absolutely';>Yes</a> or <a href=';list.php';>No</a></p>";   }elseif (isset($_REQUEST[';delete';])=="absolutely") {   $SQL="DELETE FROM mydiscs WHERE disc_id=';$disc_id';";//delete all from the table named my_discs .....................................................................................................my sql error $SQL="SELECT............................................................................ .......................................................................................................my sql error $error=" the record has been deleted";
avatar
Mac
Re: DELETING
October 06, 2011 11:58AM
You will have to struggle through this yourself - I cannot check every part of your code sad smiley

Consult your material because you are making basic typing errors.

You cannot write
Language: PHP
$error="do you really want to delete? <a href="delete.php?delete==absolutely">Yes</a> or <a href="list.php">No</a>"; // too many ';';   $error="do you really want to delete? <a href=\"delete.php?delete==absolutely\">Yes</a> or <a href=\"list.php\">No</a>"; // you must escape \ double quotes used within double quotes //or $error=';do you really want to delete? <a href=';delete.php?delete==absolutely';>Yes</a> or <a href=';list.php';>No</a>"; // use single quotes

Why adding this to the $error variable - you can just echo it straight away.
Use GET as opposed to REQUEST.
Re: DELETING
October 06, 2011 02:37PM
this is not echoed
Language: PHP
}elseif (isset($_GET[';delete';])=="absolutely") { echo "deleted";
Re: DELETING
October 06, 2011 02:50PM
after echoing the page i have found out that the problem is on the elseif part:
Language: PHP
elseif (isset($_GET[';delete';])=="absolutely") {
cuz from there only the echo statement does not work but from here it works:
Language: PHP
echo"<p>do you really want to delete? <a href=';delete.php?delete==absolutely';>Yes</a> or <a href=';list.php';>No</a></p>"; echo "delete";
Re: DELETING
October 07, 2011 02:41PM
i have try to edit a line in my database but i keep on have the else part, i don't know if it is my logic that is wrong or the code. here is the code
Language: PHP
if (isset($_GET[';shop_name';]) && is_numeric($_GET[';shop_name';]) && $_GET[';shop_name';] > 0) { // query db $shop_name = $_GET[';shop_name';]; $result = mysql_query("SELECT * FROM stock WHERE shop_name=$shop_name") or die(mysql_error()); $row = mysql_fetch_array($result);
Re: Edit
October 07, 2011 03:03PM
i have try to edit a line in my database but i keep on have the else part, i don't know if it is my logic that is wrong or the code. here is the code
Language: PHP
if (isset($_GET[';shop_name';]) && is_numeric($_GET[';shop_name';]) && $_GET[';shop_name';] > 0) { // query db $shop_name = $_GET[';shop_name';]; $result = mysql_query("SELECT * FROM stock WHERE shop_name=$shop_name") or die(mysql_error()); $row = mysql_fetch_array($result);
avatar
Mac
Re: DELETING
October 07, 2011 05:04PM
Why do you post the same question in two different threads??
Sorry, you can't reply to this topic. It has been closed.