简体   繁体   中英

SQL insert into table not working

I'm trying to insert status update into my database in table called blabbing, but it's not working.

my php code

$thisRandNum = rand(9999999999999,999999999999999999);
$_SESSION['wipit'] = base64_encode($thisRandNum); // Will always overwrite itself each time this script runs

// ------- POST NEW BLAB TO DATABASE ---------
$blab_outout_msg = "";
if (isset($_POST['status']) && $_POST['status'] != "" && $_POST['status'] != " "){

     $blabWipit = $_POST['blabWipit'];
     $sessWipit = base64_decode($_SESSION['wipit']);
     if (!isset($_SESSION['wipit'])) {

     } else if ($blabWipit == $sessWipit) {

          // End Delete any blabs over 20 for this member
         $status = $_POST['status'];
         $status = stripslashes($status);
         $status = strip_tags($status);
         $status = mysql_real_escape_string($status);
         $status = str_replace("'", "'", $status);
         $sql = mysql_query("INSERT INTO blabbing (mem_id, profile_id, the_blab, blab_date) VALUES('$logOptions_id','$logOptions_id','$status', now())");
         $blab_outout_msg = "";
         }

}

my html code

<div style="background-color:#f2f2f2; border:#ebebeb 1px solid; padding:8px;">
    <form action="home.php" method="post" enctype="multipart/form-data" name="blab_from">
    <textarea name="status" id="status" rows="3" style="width:99%;"></textarea>
    <input name="submit" type="submit" class="btn" value="Blab" /> &nbsp; &nbsp; Limit:  <script>displaylimit("","status",255)</script>
     <input name="blabWipit" type="hidden" value="<? print $thisRandNum;?>" />
    </form>
    </div>

any help appreciated

$thisRandNum = rand(9999999999999,999999999999999999);
$_SESSION['wipit'] = base64_encode($thisRandNum); // Will always overwrite itself each time this script runs

// ------- POST NEW BLAB TO DATABASE ---------
$blab_outout_msg = "";
if (isset($_POST['status']) && $_POST['status'] != "" && $_POST['status'] != " "){

     $blabWipit = $_POST['blabWipit'];
     $sessWipit = base64_decode($_SESSION['wipit']);
    // if (!isset($_SESSION['wipit'])) {

     //} else if ($blabWipit == $sessWipit) {

          // End Delete any blabs over 20 for this member
         $status = $_POST['status'];
         $status = stripslashes($status);
         $status = strip_tags($status);
         $status = mysql_real_escape_string($status);
         $status = str_replace("'", "&#39;", $status);
         $sql = mysql_query("INSERT INTO blabbing (mem_id, profile_id, the_blab, blab_date) VALUES('$logOptions_id','$logOptions_id','$status', now())");
         $blab_outout_msg = "";
       //  }

}

Try this if it works then else if ($blabWipit == $sessWipit) { this condition is not true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM