Jump to content

Reloading problem


son.of.the.morning

Recommended Posts

Yea i know this, i am just tring to create the primary functions in. The other part of the code is a while loop that creats a list of records, each row containing a button that says delete with the url as...

 

<a href"?id=<?php ehco $rows['id'] ?>">delete</a>

 

it them returns the url and then i GET the var ID from the url using the code i showed on the previous post. Sorry i havnt explained my self very well here

Link to comment
Share on other sites

I didnt want to post the code becuase there is quite a lot of it but here it is anyway

 

<?php

if(isset($_GET['id'])) {

$DeleteId = $_GET['id'];

mysql_query("DELETE FROM blog_posts WHERE ID=$DeleteId") or die (mysql_error());

echo "Record #".$DeleteId." had been sucessfully deleted.";

} ?>

 

 

<?php 
				$rowNum = "0";
				while($record_rows = mysql_fetch_array($records_returned)){
					if(++$rowNum % 2 == 1 ) {
			?>
                <form action="" method="post" name="DeleteSelected">
                <div class="Record">
                	<div class="Thumbnail"><img src="../img/articles/thums/<?php echo $record_rows['img_url']; ?>" class="RecordThumbnail"/></div>
                    <div class="RecordContent">
                    	<div class="PostTitle"><strong><?php echo $record_rows['title']; ?></strong></div>
                        <div class="CheckItem">
                        	Select: <input name="DeleteItem<?php echo $record_rows['id']; ?>" type="checkbox" value="<?php echo $record_rows['id']; ?>" />
                        </div>
                        <div class="PostSnipit"><?php echo substr($record_rows['post'], 0,50)."..."; ?></div>
                    	<div class="SelectOptions">
                        <div class="DeleteRecord" name="sub">Delete Article</div>
                        <div id="VeiwRecord">Hide Details</div><div id="DeleteConfirm">Are you sure you would like to delete this record?   <a href="?id=<?php echo $record_rows['id']; ?>" class="BlankLink"><input name="SingleRecordDelete" type="button" value="Yes." class="DeleteBtn" /></a>   <input name="" type="button" value="No." class="DeleteBtn" id="HideDeleteOptions" /></div>
                        <div id="ViewMoreHidden">
						<div class="MoreText"><?php echo substr($record_rows['post'], 0,250)."..."; ?></div>
                            <div class="PostedOn"><i><?php echo "Posted on: ".$record_rows['date_posted']; ?></i></div>
                        </div>
                    </div>
                    </div>
                </div>
                <?php } else {?>

 

 

Link to comment
Share on other sites

The problem is not in the few lines of code that deletes the recored (that work's doesn't it) and the problem is not in the block of code that displays the data (that works doesn't it), the problem, if it is being caused by the code, is in the order in which the data is being deleted in the database table and when the data is being selected from the database table when the page is requested, which is why Pika asked for ALL the logic.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.