-
Making admin pages and need help.
Hello,
Currently I am working on a site that uses mysql to store content for news articles and more that gets posted onto pages along the site. I have finished the site, and am now moving onto administration pages because I think it would be a cool thing to do. I have completed the login script so that only logged in members can see the pages where you can edit everything, but I have run into a problem. Everything that I want to have happen requires a mysql query to be run on the click of a link. So far I have had no luck getting links to do things like deleting a row of information. If anyone could help me out or lead me in the right direction then that would be great.
Thanks,
~Thorlax
-
Sorry for the double post, but I can no longer edit my original post to add what I have figured out so far.
I have made delete links for each of the rows that lead to homepage.php?d=num. At the top of the page I have the following php block:
PHP Code:
$d = $_GET['d'];
function delete() { include 'library/config.php'; include 'library/opendb.php'; mysql_query("DELETE FROM tblname WHERE id='$d'") or die(mysql_error()); include 'library/closedb.php'; }
if (isset($d)) { delete(); }
The thing I can't figure out is how to get the variable to parse in the query. If anyone knows how to do this then that would be great.
P.S.
I know that the variable is grabbed from the address bar fine because I tried posting "echo $d" elsewhere on the page and it shows the correct number.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|