PHP Guestbook Question:
When a reply post in a guestbook is being made, a threadID variable is being sent and loaded from a LoadVars() instance in flash mx. This query is working ok:
$query = "INSERT INTO forumPosts (threadID, username, message, posted)
VALUES($threadID, '$username', '$message', $posted)";
if(!mysql_query($query)) {
fail("Error inserting thread");
}
But the next one following it on the same script is not happening, and I'm presuming $threadID is not being found...
$query = "UPDATE forumThreads SET replies += 1, lastPost = $posted WHERE
threadID = $threadID";
if(!mysql_query($query)) {
fail("Error inserting thread");
}
Any ideas on how to get the second guestbook query happening?
Cheers,
TonyMontana
zollet posted this at 08:37 — 22nd January 2003.
He has: 1,016 posts
Joined: May 2002
instead of fail("Error inserting thread"); try fail(mysql_error());
It should tell you what the problem is...
TonyMontana posted this at 23:16 — 22nd January 2003.
They have: 218 posts
Joined: Apr 2001
The problem is with the $threadID variable. I can print it and send it back to Flash after the first query like so:
print "&thread=$threadID";
But after the second query..nothing there. The fail() function in it's current form unfortunately doesn't provide any clues.
TonyMontana
TonyMontana posted this at 06:40 — 23rd January 2003.
They have: 218 posts
Joined: Apr 2001
I figured this one out...
"UPDATE forumThreads SET replies += 1
turns into...
"UPDATE forumThreads SET replies = replies + 1
And it works.
TonyMontana
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.