Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Easy Date   Perfect Money   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 02-15-2004, 11:31 PM   #1 (permalink)
Inactive
 
Leader of Men's Avatar
 
Join Date: 10-12-03
Location: Minnesota, USA
Posts: 2,207
iTrader: 0 / 0%
Latest Blog:
None

Leader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really nice
Send a message via AIM to Leader of Men Send a message via MSN to Leader of Men Send a message via Yahoo to Leader of Men
I'm getting better...

I promise, I am

Here's the code:
<?php
$file = file('../posts.php');
$display = $_POST['oldpost'];
$display2 = ("$display+1");

for($x=$display;$x<$display2;$x++) {
echo "$file[$x]";
$oldpost = "$file[$x]";
}

$fp = fopen("../posts.php", 'w+');
$new = str_replace("$oldpost","","$oldpost");
fwrite($fp, $new);
fclose($fp);

?>

Now, I WANT it to delete the old post (which has it's ID sent from admin.php).

Example, if I wanted to delete the post on the first line of posts.php I would put 1. Why does this wipe out the entire posts.php file when I run it?
Leader of Men is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 02-16-2004, 12:15 AM   #2 (permalink)
sim
Banned
 
Join Date: 01-23-04
Posts: 2,367
iTrader: 0 / 0%
Latest Blog:
None

sim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nicesim is just really nice
your replacing $oldpost with "" and writing "" to the file.
sim is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-16-2004, 12:20 AM   #3 (permalink)
Inactive
 
Leader of Men's Avatar
 
Join Date: 10-12-03
Location: Minnesota, USA
Posts: 2,207
iTrader: 0 / 0%
Latest Blog:
None

Leader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really niceLeader of Men is just really nice
Send a message via AIM to Leader of Men Send a message via MSN to Leader of Men Send a message via Yahoo to Leader of Men
But shouldn't I just be writing blank stuff to where $oldpost is?

Or is the entire file somehow $oldpost?

How can I fix this?
Leader of Men is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-16-2004, 06:41 AM   #4 (permalink)
Possible Terrorist
 
kwvarga's Avatar
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
iTrader: 0 / 0%
Latest Blog:
A+ Certification

kwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web prokwvarga is a highly respected web pro
Send a message via AIM to kwvarga
copy to a new file.. copy everyline till you reach $oldpost then skip that line.. then write the rest.. clear the file.. copy all from the other..

*make sure you clear the 2nd one or unseen problems could come up
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
kwvarga is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 11:29 AM.
© Copyright 2008 V7 Inc