Go Back   CodingForums.com > :: Client side development > JavaScript programming

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 05-07-2011, 07:48 AM   PM User | #1
harry343
New Coder

 
Join Date: Apr 2011
Location: Mumbai
Posts: 19
Thanks: 10
Thanked 0 Times in 0 Posts
harry343 is an unknown quantity at this point
creating an alert and continue on this page after alert for admin only

I have an user table like this:-

guid | username | password | firstname | lastname | location | emailad
dress | userrole
-----------------------------------+----------+----------------------------------+-----------+-----------+----------+--------
------+---------------
8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live
.com | administrator
18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c
om | administrator
2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | |
| administrator
(3 rows)

now my postgre query for delete the row ....

$query = "delete from users where username!= 'admin' and guid='".$guid."'";
$result = pg_query($conn, $query);

?>
<script type="text/javascript">
alert("Cannot delete this .\n It is system generated(s).");
</script>
<?php

(1)when I delete the user name one by one then delete occurs in my page userlist.php, I donot want to delete admin so i use username!= 'admin'

in where condition as shown above.
(2)now when I del any username(3 rows) from user table then alert occurs & it delete from userlist.php after that my page userlist.php is

blank. Finaly when i refresh the page then my admin username seen..

when i use return true; function then only alert generate .. delete doesnot occurs ...

Actauly i want:-
(1)if user is not admin then it delete from userlist.php ... nd also i m continue on this page ... like when james and saty want

to delte their acount ..as given in table.
(2)if user is admin then alert generate nd i m continue on this page.


i m tired now plz help me ....


so can anyone put the best condition in my coding.
harry343 is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, php, php5, postgresql

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 07:17 PM.


Advertisement
Log in to turn off these ads.