/    Sign up×
Community /Pin to ProfileBookmark

Post delete using Ajax

Alright, I’ve been looking around and around, and I still haven’t found a way to get this to work.

[code=php]$sqldel = “DELETE * FROM `post` WHERE post_id = $row[‘post_id’]”;[/code]

Thats the original SQL statement to delete the post.

Now, this is the functionn I attempted to design in Ajax to get this to work, obviously it doesn’t. I’m gonna need the call statemnts and everything. I’m really no good at this whole thing, but I am attempting to learn it.

[code=php]error_reporting(E_ALL);
function Delete(what) {
$sqlDel=”delete from `post` where `ID`='” . what . “‘”;
mysql_query($sqlDel) or die(mysql_error());
echo . “Post ” . what . “deleted”;
}[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 20.2007 — For one thing, you need a "$" in front of your "what" variable names, throughout.
Copy linkTweet thisAlerts:
@R_NoonauthorJul 20.2007 — Okay, keep in mind though I haven't said this yet xD

That, I've never before worked with php functions. Only with JS functions, so alot of my errors will be in just basic PHP function coding.
×

Success!

Help @R_Noon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...