Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Undescriptive error HELP PLEASE

    Could not do this because You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

    Code:
    <?php session_start();
    
    include('config.php'); 
    
    // connect to the mysql server
    $link = mysql_connect($server, $db_user, $db_pass)
    or die ("Could not connect to mysql because ".mysql_error());
    
    // select the database
    mysql_select_db($database)
    or die ("Could not select database because ".mysql_error());
    
    $email = $_SESSION["email"];
    $id = $_SESSION["id"];
    $level = 1;
    $change = "UPDATE $table SET level=$level WHERE id=$id;";
    $qry = mysql_query($change) or die ("Could not do this because ".mysql_error());
    header("Location: http://www.raidingprofessionals.com/thankyou.html");
    ?>
    I have no idea why all of a sudden its doing this. This has worked previously.

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,538
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Echo out $change. What do you get?

    Also, you need to sanitize. It may not be your issue now, but it could be later.

  • #3
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok it seems like the session variable 'id' isn't registering.

    Basically this is how the process goes:

    Form
    register.php -- here it submits to my database, then auto fills another form and submits it. When that form submits, it's action is to a different site (aweber), it redirects to the payment page through clickbank and then after that to this file. The variable isn't carrying over to callback.php

    Is there a way to fix this?

    Hope that made sense.

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,538
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, if clickbank is on a different url and sets a session value, that value won't appear on your domain. And if it has no way of passing back a value, then there's nothing you can do (and its a bad setup).

    If id is setup on your side, then data is passed to a different site, the id value should stay on your site.

  • #5
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    1
    Thanked 0 Times in 0 Posts
    That's what I thought.

    Here is where I define the variable in register.php

    Code:
    $insert = mysql_query("insert into $table values ('NULL', '".$_POST['email']."', '".$_POST['password']."', '".$_POST['firstname']."', '".$_POST['lastname']."', 'NULL', 'NULL')")
    or die("Could not insert data because ".mysql_error());
    $id = mysql_insert_id();
    $email = $_POST["email"];
    $name = $_POST["firstname"];
    $_SESSION["id"] = $id;

  • #6
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok some more testing has shown that the session seems to either be ending before I go back to my server, or clearing the variables.

    Here is my entire Register.php file.

    Code:
    <?php Session_Start(); 
    
    include("config.php"); 
    
    // connect to the mysql server
    $link = mysql_connect($server, $db_user, $db_pass)
    or die ("Could not connect to mysql because ".mysql_error());
    
    // select the database
    mysql_select_db($database)
    or die ("Could not select database because ".mysql_error());
    
    // check if the username is taken
    $check = "select id from $table where email = '".$_POST['email']."';"; 
    $qry = mysql_query($check) or die ("Could not match data because ".mysql_error());
    $num_rows = mysql_num_rows($qry); 
    if ($num_rows != 0) { 
    echo "Sorry, there the email $email is already taken.<br>";
    echo "<a href='javascript:history.go(-1)'>Try again</a>";
    exit; 
    }
    if($_POST['email'] == '' or $_POST['password'] == '' or $_POST['firstname'] == '' or $_POST['lastname'] == '') {
    echo "Sorry, your information is not complete. Please fill out all the fields properly. <br> <a href='javascript:history.go(-1)'>Click Here to Go Back</a>";
    exit;
    }
    // check the passords
    if ($_POST['password'] != $_POST['password2']) {
    echo "Both passwords are not matching <a href='javascript:history.go(-1)'>Try again</a> <BR>";
    exit;
    } else {
    // insert the data
    $insert = mysql_query("insert into $table values ('NULL', '".$_POST['email']."', '".$_POST['password']."', '".$_POST['firstname']."', '".$_POST['lastname']."', 'NULL', 'NULL')")
    or die("Could not insert data because ".mysql_error());
    $id = mysql_insert_id();
    $email = $_POST["email"];
    $name = $_POST["firstname"];
    $_SESSION["id"] = $id;
    
    //start session for global variable
    $_SESSION["email"] = $email;
    $_SESSION["name"] = $name;
    
    // print a success message
    echo $id;
    echo $_SESSION["id"];
    echo $_SESSION["email"];
    //header("Location: http://www.raidingprofessionals.com/joinpost.php");
    echo "Success!";
    
    
    ?>
    
    <html lang="en">
    <head>
        <title>Raiding Professionals - Register</title>
        <script>
    function submitit(){
    var form = document.myform;
    form.submit();
     
    }
    </SCRIPT>  
    </head>
    <body onload='submitit();' >
        <div style='visibility:hidden;'>
        <!-- AWeber Web Form Generator 3.0 -->
    <style type="text/css">
    #af-form-1495052730 .af-body .af-textWrap{width:70%;display:block;float:right;}
    #af-form-1495052730 .af-body .privacyPolicy{color:#000000;font-size:12px;font-family:, serif;}
    #af-form-1495052730 .af-body a{color:#000000;text-decoration:underline;font-style:normal;font-weight:normal;}
    #af-form-1495052730 .af-body input.text, #af-form-1495052730 .af-body textarea{background-color:#FFFFFF;border-color:#CCCCCC;border-width:2px;border-style:inset;color:#000000;text-decoration:none;font-style:normal;font-weight:normal;font-size:inherit;font-family:inherit;}
    #af-form-1495052730 .af-body input.text:focus, #af-form-1495052730 .af-body textarea:focus{background-color:inherit;border-color:#CCCCCC;border-width:2px;border-style:inset;}
    #af-form-1495052730 .af-body label.previewLabel{display:block;float:left;width:25%;text-align:left;color:#000000;text-decoration:none;font-style:normal;font-weight:normal;font-size:inherit;font-family:inherit;}
    #af-form-1495052730 .af-body{padding-bottom:15px;background-repeat:no-repeat;background-position:inherit;background-image:none;color:#000000;font-size:12px;font-family:, serif;}
    #af-form-1495052730 .af-footer{background-color:transparent;background-repeat:no-repeat;background-position:top left;background-image:none;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:#000000;font-family:, serif;}
    #af-form-1495052730 .af-header{background-color:transparent;background-repeat:no-repeat;background-position:inherit;background-image:none;border-bottom-style:none;border-left-style:none;border-right-style:none;border-top-style:none;color:#000000;font-family:, serif;}
    #af-form-1495052730 .af-quirksMode .bodyText{padding-top:2px;padding-bottom:2px;}
    #af-form-1495052730 .af-quirksMode{padding-right:15px;padding-left:15px;}
    #af-form-1495052730 .af-standards .af-element{padding-right:15px;padding-left:15px;}
    #af-form-1495052730 .bodyText p{margin:1em 0;}
    #af-form-1495052730 .buttonContainer input.submit{color:#000000;text-decoration:none;font-style:normal;font-weight:normal;font-size:inherit;font-family:inherit;}
    #af-form-1495052730 .buttonContainer input.submit{width:auto;}
    #af-form-1495052730 .buttonContainer{text-align:center;}
    #af-form-1495052730 body,#af-form-1495052730 dl,#af-form-1495052730 dt,#af-form-1495052730 dd,#af-form-1495052730 h1,#af-form-1495052730 h2,#af-form-1495052730 h3,#af-form-1495052730 h4,#af-form-1495052730 h5,#af-form-1495052730 h6,#af-form-1495052730 pre,#af-form-1495052730 code,#af-form-1495052730 fieldset,#af-form-1495052730 legend,#af-form-1495052730 blockquote,#af-form-1495052730 th,#af-form-1495052730 td{float:none;color:inherit;position:static;margin:0;padding:0;}
    #af-form-1495052730 button,#af-form-1495052730 input,#af-form-1495052730 submit,#af-form-1495052730 textarea,#af-form-1495052730 select,#af-form-1495052730 label,#af-form-1495052730 optgroup,#af-form-1495052730 option{float:none;position:static;margin:0;}
    #af-form-1495052730 div{margin:0;}
    #af-form-1495052730 fieldset{border:0;}
    #af-form-1495052730 form,#af-form-1495052730 textarea,.af-form-wrapper,.af-form-close-button,#af-form-1495052730 img{float:none;color:inherit;position:static;background-color:none;border:none;margin:0;padding:0;}
    #af-form-1495052730 input,#af-form-1495052730 button,#af-form-1495052730 textarea,#af-form-1495052730 select{font-size:100%;}
    #af-form-1495052730 p{color:inherit;}
    #af-form-1495052730 select,#af-form-1495052730 label,#af-form-1495052730 optgroup,#af-form-1495052730 option{padding:0;}
    #af-form-1495052730 table{border-collapse:collapse;border-spacing:0;}
    #af-form-1495052730 ul,#af-form-1495052730 ol{list-style-image:none;list-style-position:outside;list-style-type:disc;padding-left:40px;}
    #af-form-1495052730,#af-form-1495052730 .quirksMode{width:190px;}
    #af-form-1495052730.af-quirksMode{overflow-x:hidden;}
    #af-form-1495052730{background-color:transparent;border-color:inherit;border-width:none;border-style:none;}
    #af-form-1495052730{overflow:hidden;}
    .af-body .af-textWrap{text-align:left;}
    .af-body input.image{border:none!important;}
    .af-body input.submit,.af-body input.image,.af-form .af-element input.button{float:none!important;}
    .af-body input.text{width:100%;float:none;padding:2px!important;}
    .af-body.af-standards input.submit{padding:4px 12px;}
    .af-clear{clear:both;}
    .af-element label{text-align:left;display:block;float:left;}
    .af-element{padding:5px 0;}
    .af-form-wrapper{text-indent:0;}
    .af-form{text-align:left;margin:auto;}
    .af-header,.af-footer{margin-bottom:0;margin-top:0;padding:10px;}
    .af-quirksMode .af-element{padding-left:0!important;padding-right:0!important;}
    .lbl-right .af-element label{text-align:right;}
    body {
    }
    </style>
    <form method="post" class="af-form-wrapper" action="http://www.aweber.com/scripts/addlead.pl" id='myform' name='myform' >
    <div style="display: none;">
    <input type="hidden" name="meta_web_form_id" value="1495052730" />
    <input type="hidden" name="meta_split_id" value="" />
    <input type="hidden" name="listname" value="membersonlywow" />
    <input type="hidden" name="redirect" value="http://1.xoriun.pay.clickbank.net" id="redirect_85ef0c2bf2856aeb6280fb7d8f4f3198" />
    
    <input type="hidden" name="meta_adtracking" value="My_Web_Form_2" />
    <input type="hidden" name="meta_message" value="1" />
    <input type="hidden" name="meta_required" value="name,email" />
    
    <input type="hidden" name="meta_tooltip" value="" />
    </div>
    <div id="af-form-1495052730" class="af-form"><div id="af-header-1495052730" class="af-header"><div class="bodyText"><p>&nbsp;</p></div></div>
    <div id="af-body-1495052730" class="af-body af-standards">
    <div class="af-element">
    <label class="previewLabel" for="awf_field-10696223">Name: </label>
    <div class="af-textWrap">
    <input id="awf_field-10696223" type="text" name="name" class="text" value=""  tabindex="500" />
    </div>
    <div class="af-clear"></div></div>
    <div class="af-element">
    <label class="previewLabel" for="awf_field-10696224">Email: </label>
    <div class="af-textWrap"><input class="text" id="awf_field-10696224" type="text" name="email" value="" tabindex="501"  />
    </div><div class="af-clear"></div>
    </div>
    <div class="af-element buttonContainer">
    <input name="submit2" class="submit" type="submit" value="Submit" tabindex="502" />
    <div class="af-clear"></div>
    </div>
    <div class="af-element privacyPolicy" style="text-align: center"><p><a title="Privacy Policy" href="http://www.aweber.com/permission.htm" target="_blank">We respect your email privacy</a></p>
    <div class="af-clear"></div>
    </div>
    </div>
    <div id="af-footer-1495052730" class="af-footer"><div class="bodyText"><p>&nbsp;</p></div></div>
    </div>
    <div style="display: none;"><img src="http://forms.aweber.com/form/displays.htm?id=jCycrAysTOzMDA==" alt="" /></div>
    </form>
    <script type="text/javascript">
        <!--
        (function() {
            var IE = /*@cc_on!@*/false;
            if (!IE) { return; }
            if (document.compatMode && document.compatMode == 'BackCompat') {
                if (document.getElementById("af-form-1495052730")) {
                    document.getElementById("af-form-1495052730").className = 'af-form af-quirksMode';
                }
                if (document.getElementById("af-body-1495052730")) {
                    document.getElementById("af-body-1495052730").className = "af-body inline af-quirksMode";
                }
                if (document.getElementById("af-header-1495052730")) {
                    document.getElementById("af-header-1495052730").className = "af-header af-quirksMode";
                }
                if (document.getElementById("af-footer-1495052730")) {
                    document.getElementById("af-footer-1495052730").className = "af-footer af-quirksMode";
                }
            }
        })();
        -->
    </script>
        <script type='text/javascript'>
            var name = "<?php echo $name; ?>";
            var email = "<?php echo $email; ?>";
            document.getElementById("awf_field-10696223").value = name;
            document.getElementById("awf_field-10696224").value = email;
            document.write(name);
            document.write(email);
            document.getElementById('myform').submit();
        </script>
        <a href='#self' onclick='document.myform.submit()'>Click Here to Submit</a>
    <!-- /AWeber Web Form Generator 3.0 
    <script type='text/javascript'>
        document.getElementById(awf_field-10696223).value = name;
        document.getElementById(awf_field-10696224).value = email;
    </script>-->
    <script type='text/javascript'>
        
    </script>
    </div>
    </body>
    </html>
    
    <?php
    }
    ?>


  •  

    Posting Permissions

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