Your browser does not seem to support CSS. If images appear below, please disregard them.
toggle
May
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Sponsored Links
Latest Postings
Topic Options
Rate This Topic
#19461 - 07/03/03 11:32 PM PHP/MySQL Problem in Feedback Feature
Joined: Mar 2002
Posts: 574
Cold Sunn Offline
UGN GFX Whore
Cold Sunn Offline
UGN GFX Whore

Joined: Mar 2002
Posts: 574
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:
Code:
<?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
Sponsored Links
#19462 - 07/04/03 03:20 AM Re: PHP/MySQL Problem in Feedback Feature
Joined: Mar 2002
Posts: 256
ninjaneo Offline
UGN Security Staff
ninjaneo Offline
UGN Security Staff

Joined: Mar 2002
Posts: 256
CA, USA
Code:
<?PHP
 require "dbconnect.php";
 IF($nraktion == "ssub") {    
  $wc_name = ($wc_name == "name" &#0124;&#0124; $wc_name == "" ? "A Stranger" : $wc_name);
  $wc_site = ($wc_site == "http://" &#0124;&#0124; $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 03:25 AM Re: PHP/MySQL Problem in Feedback Feature
Joined: Mar 2002
Posts: 574
Cold Sunn Offline
UGN GFX Whore
Cold Sunn Offline
UGN GFX Whore

Joined: Mar 2002
Posts: 574
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 08:22 PM Re: PHP/MySQL Problem in Feedback Feature
Joined: Mar 2002
Posts: 574
Cold Sunn Offline
UGN GFX Whore
Cold Sunn Offline
UGN GFX Whore

Joined: Mar 2002
Posts: 574
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 08:49 PM Re: PHP/MySQL Problem in Feedback Feature
Joined: Mar 2002
Posts: 574
Cold Sunn Offline
UGN GFX Whore
Cold Sunn Offline
UGN GFX Whore

Joined: Mar 2002
Posts: 574
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

Member Spotlight
Gremelin

Gremelin
Portland, OR; USA
Posts: 7,194
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Forums46
Topics45,531
Posts80,699
Members2,157
Most Online1,567
Apr 25th, 2010
Top Posters(All Time)
UGN Security 38,695
Gremelin 7,194
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Newest Members
Herbert_Sherbert, codemauve, Lillysdragon1984, Brewwit, boa
2157 Registered Users
Who's Online Now
0 registered members (), 3 guests and 1 spider.
Latest News