SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am running the below stated code:
    Code:
    if($cookie) {
    
    $dbc       = "imhosting_com";
    $cidcxx    = mysql_connect("localhost","imhostin","********");
    
    $SQLc  = "INSERT INTO sales (username, date, amount, description) VALUES ";
    $SQLc .= " ('$cookie', '$datemonth-$dateyear-$dateday', '$total', '$plan at $payment bought by $fName $lName' ) ";
    
    $resultc = mysql_db_query($dbc, $SQLc, $cidc);
    $SQLcc    = "SELECT email FROM affiliate WHERE username='$cookie'";
    $resultcc = mysql_db_query($dbc, $SQLcc, $cidc);
    $rowcc    = mysql_fetch_array($resultcc);
    
    $refbody="You've made a sale!\n
    Sale made on: $datemonth/$dateyear/$dateday
    Sale Total  : $total\n
    Description: $plan @ $payment bought by $fName $lName\n";
    mail($rowcc[email],'You made a sale!',"$refbody","From: sales@imhosting.com");
    
    }
    This is part of a much larger file.

    I get an error (PHP says) it's on this line:

    Code:
    $SQLc  = "INSERT INTO sales (username, date, amount, description) VALUES ";
    But what the hell is wrong with that line? Is it the one before? After? I can't figure it out!
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What did PHP say exactly?
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $SQLc = "INSERT INTO sales VALUES('$username','$date', '$amount', '$description') ";


    And if you have an ID column first than it should be

    $SQLc = "INSERT INTO sales VALUES(null,'$username','$date', '$amount', '$description') ";


    I could be wrong, but I think that looks correct.

  4. #4
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Son Nguyen
    What did PHP say exactly?

    Parse error: parse error in /home/imhostin/imhosting-www/hostingorder.php3 on line 223
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  5. #5
    SitePoint Zealot moshe_be's Avatar
    Join Date
    Dec 2000
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I ran that code on my site and got no errors, maybe the error is elsewhere.

    One possible wrong thing I can find the date format on MySQL is Year-month-day thus the insert should look:

    $SQLc .= " ('$cookie', '$dateyear-$datemoth-$dateday', '$total', '$plan at $payment bought by $fName $lName' ) ";

  6. #6
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting
    I can't spot any syntax error (which is parse error) from the line. So the possibility that the line number is not the right one, check for included files, which alters the line counter.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  7. #7
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Turns out i left out a single ' about 10 lines before....grrrr....took me an hour of hair-tearing to find that stupid thing.
    -Jeff Minard | jrm.cc - Battlefield 2 Stats

  8. #8
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm.... that problem killed 5000 cells in my brain!! Still a lot of them to kill
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •