rwachowiak Posted March 13, 2008 Share Posted March 13, 2008 heres what i got so far: when i click the delete link it wants to actually download the update.php <?php include 'libs/dbopen.php'; //If cmd is not hit if(!isset($cmd)) { $query = "SELECT * FROM news Order by DateAdded DESC"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<span class='titlebar3'><a href='update.php?cmd=delete&id={$row['id']}'>{$row['Title']} - Delete</a></span><br>" . "{$row['Content']} <br>" . "<span class='description'>Date Added: {$row['DateAdded']}</span> <br><br>"; } } ?> <? if($cmd=="delete") { $sql = "DELETE FROM news WHERE id={$row['id']}"; $result = mysql_query($sql); echo "Row deleted!"; } include 'libs/dbclose.php'; ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted March 13, 2008 Share Posted March 13, 2008 Just a shot here, since I assume you mean the update.php and not upload.php and assuming PHP is installed and works. Try to change your <? tag to <?php Quote Link to comment Share on other sites More sharing options...
rwachowiak Posted March 13, 2008 Author Share Posted March 13, 2008 Just a shot here, since I assume you mean the update.php and not upload.php and assuming PHP is installed and works. Try to change your <? tag to <?php whoops yes, it is update.php and yes php is installed and working fine, i have a few other scripts ive got going on this site and i tried that <?php and no luck! Quote Link to comment Share on other sites More sharing options...
revraz Posted March 13, 2008 Share Posted March 13, 2008 When you hover over the URL, how does it look in your status bar? Also, where do you $_GET['cmd'] and $_GET['id'] ? Quote Link to comment Share on other sites More sharing options...
rwachowiak Posted March 13, 2008 Author Share Posted March 13, 2008 When you hover over the URL, how does it look in your status bar? Also, where do you $_GET['cmd'] and $_GET['id'] ? links look like: http://srv2/update.php?cmd=delete&id=1 what do you mean where do i get those?! i suppose im missing something lol Quote Link to comment Share on other sites More sharing options...
revraz Posted March 13, 2008 Share Posted March 13, 2008 <?php if($_GET['cmd']=="delete") { $sql = "DELETE FROM news WHERE id={$_GET['id']}"; $result = mysql_query($sql) or die (mysql_error()); echo "Row deleted!"; } include 'libs/dbclose.php'; ?> Quote Link to comment Share on other sites More sharing options...
rwachowiak Posted March 13, 2008 Author Share Posted March 13, 2008 <?php if($_GET['cmd']=="delete") { $sql = "DELETE FROM news WHERE id={$_GET['id']}"; $result = mysql_query($sql) or die (mysql_error()); echo "Row deleted!"; } include 'libs/dbclose.php'; ?> works great thanks 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.