Sponsor Advertisements
Sponsor Advertisements
|
|
|
#19461 - 07/04/03 12:32 AM
PHP/MySQL Problem in Feedback Feature
|
UGN GFX Whore
Registered: 03/03/02
Posts: 574
Loc: us
|
I have a post comments feature on my site for different essays or short stories. The problem is, instead of adding what you typed for Name, Email, Site, and Comment, it adds a 0 to the db. Everything else works, stuff that you can't change in the form like ip address, timestamp, and the id of the article you are commenting on. Any idea why it does this? I'll give you more info if you want. Thanks for any help, I've spent so much time trying to figure this shit out. Here is the code for the page that does the adding, which is seperate from the page you post from: <?PHP
include("dbconnect.php");
IF($nraktion == "ssub") {
IF ($wc_name == "name") {
$wc_name = "A Stranger";
} ELSEIF ($wc_name == "" ) {
$wc_name = "A Stranger";
}
IF ($wc_email == "email") {
$wc_email = "none";
} ELSEIF ($wc_email == "" ) {
$wc_email = "none";
}
IF ($wc_site == "http://") {
$wc_site = "none";
} ELSEIF ($wc_site == "" ) {
$wc_site = "none";
}
IF ($wc_content == "") {
echo ("You radge, you left the message box blank and should be banned from the internet entirely.");
} ELSE {
$ip = getenv("REMOTE_ADDR");
mysql_query("INSERT INTO writcomments (ip,nid,name,email,site,content,timestamp) VALUES ('$ip','$nid','$wc_name','$wc_email','$wc_site','$wc_content',".time().")");
ECHO ("<img src=main/post/posting.gif alt=\"Posting\">");
} //END ELSE FOR CONTENT
} //END IF NRAKTIOn == SSUB
?>And yes, I know. include is dying and require is the way to go. I know. Whatever.
|
|
Top
|
|
|
|
Sponsor Advertisements
Sponsor Advertisements
|
|
#19462 - 07/04/03 04:20 AM
Re: PHP/MySQL Problem in Feedback Feature
|
UGN Security Staff
Registered: 03/06/02
Posts: 256
Loc: CA, USA
|
<?PHP
require "dbconnect.php";
IF($nraktion == "ssub") {
$wc_name = ($wc_name == "name" || $wc_name == "" ? "A Stranger" : $wc_name);
$wc_site = ($wc_site == "http://" || $wc_site == "" ? "none" : $wc_site);
IF ($wc_content == "") {
echo ("You radge, you left the message box blank and should be banned from the internet entirely.");
} ELSE {
$ip = getenv("REMOTE_ADDR");
mysql_query("INSERT INTO `writcomments` (`ip`,`nid`,`name`,`email`,`site`,`content`,`timestamp`) VALUES ('$ip','$nid','$wc_name','$wc_email','$wc_site','$wc_content','".time()."');")
or die(mysql_error());
ECHO ("<img src=main/post/posting.gif alt=\"Posting\">");
}
}
?>Thats some nice rewritten code  /e shakes penis. --edited--
|
|
Top
|
|
|
|
#19463 - 07/04/03 04:25 AM
Re: PHP/MySQL Problem in Feedback Feature
|
UGN GFX Whore
Registered: 03/03/02
Posts: 574
Loc: us
|
All I have to say is:
You have an error in your SQL syntax near '\'1057292661\')' at line 1
|
|
Top
|
|
|
|
#19464 - 07/04/03 09:22 PM
Re: PHP/MySQL Problem in Feedback Feature
|
UGN GFX Whore
Registered: 03/03/02
Posts: 574
Loc: us
|
Basically, all the information needed gets to the page with the code above. What is happening, is the mysql table is a closet homosexual. I'm going to try making a new table and hope it's straight this time.
|
|
Top
|
|
|
|
#19465 - 07/04/03 09:49 PM
Re: PHP/MySQL Problem in Feedback Feature
|
UGN GFX Whore
Registered: 03/03/02
Posts: 574
Loc: us
|
I created a new table and changed some code, now it works. It works like it should have worked the first time, but that would be too easy. The people at MySQL know that no one likes things to go smoothly which is why cars have shock-absorbers and why condoms are made of latex and prelubricated. Another thing that know is that I love taking it in the ass along with wasting like 4 hours on a problem that can't even decide it's sexuality.
|
|
Top
|
|
|
|
|
Registered: 03/16/13
Posts: 5
|
|
2200 Members
46 Forums
25369 Topics
60539 Posts
Max Online: 1567 @ 04/25/10 10:20 AM
|
|
|
0 registered (),
295
Guests and
294
Spiders online. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|