close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

MySQLi insert issues

Thread began 8/20/2014 2:25 pm by Steve | Last modified 8/22/2014 9:39 am by Jason Byrnes | 1880 views | 14 replies |

Steve

MySQLi insert issues

Trying to update a prior working INSERT but not having any errors from the MySQLi Insert behavior to see why it will not work.

Note the uploads an image (works) and then the INSERT redirects as if things went well (no errors) but there is no record created.

Here;s the code that does not work:

<?php require_once('../Connections/minBlog_i.php'); ?>

<?php require_once('../webassist/framework/framework.php'); ?>
<?php require_once('../webassist/framework/library.php'); ?>
<?php require_once("../webassist/file_manipulation/helperphp.php"); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php require_once('../webassist/mysqli/queryobj.php'); ?>


<?php
$rsType = new WA_MySQLi_RS("rsType",$minBlog_i,0);
$rsType->setQuery("SELECT * FROM tblinvtype WHERE tblinvtype.mid = 2 AND tblinvtype.status = '0' ORDER BY tblinvtype.typeName");
$rsType->execute();
?>
<?php



// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../uploadedImg/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "800",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "../uploadedImg/",
'FileName' => "thumb_[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "350",
'ResizeHeight' => "",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_2 End
// WA_UploadResult1_3 Start
$WA_UploadResult1_Params["WA_UploadResult1_3"] = array(
'UploadFolder' => "../uploadedImg/small/",
'FileName' => "_thumb2[FileName]",
'DefaultFileName' => "",
'ResizeType' => "2",
'ResizeWidth' => "220",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_3 End
// WA_UploadResult1 Params End
?>

<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "imageUp", "0", "", "true", $WA_UploadResult1_Params);
}
?>

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$InsertQuery = new WA_MySQLi_Query($minBlog_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "test";
$InsertQuery->bindColumn("field", "s", "".((isset($_POST["Title"]))?$_POST["Title"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("fieldtwo", "s", "".((isset($_POST["event"]))?$_POST["event"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("sess_news");
$InsertQuery->execute();
$InsertGoTo = "main.php";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>




Here's a test page that DOES work and inserts into a test table:

<?php require_once('../Connections/minBlog_i.php'); ?>
<?php require_once('../webassist/mysqli/queryobj.php'); ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$InsertQuery = new WA_MySQLi_Query($minBlog_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "test";
$InsertQuery->bindColumn("field", "s", "".((isset($_POST["fld1"]))?$_POST["fld1"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("fieldtwo", "s", "".((isset($_POST["fld2"]))?$_POST["fld2"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("sestest");
$InsertQuery->execute();
$InsertGoTo = "main.php";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>




Any ideas on what could be wrong or tools / examples to echo the Insert query?

Sign in to reply to this post

Jason ByrnesWebAssist

i need to see the code in context with the form.

please attach the page rather than the code snippets.

Or a link and FTP info so I can troubleshoot directly.

Sign in to reply to this post

Steve

ok, give me a bit as I am starting to deconstruct the page to see if any of the prior extensions or sequence is causing the problem.

Sign in to reply to this post

Steve

moved to private

Sign in to reply to this post

Steve

clean page will be
http://rivieralaser.com/Admin/photo_insert2.php

Sign in to reply to this post

Jason ByrnesWebAssist

I am being redirected to a page that requires login on inserting a record, what is the login?

where is a page that writes all the records from the target table?

Sign in to reply to this post

Steve

added to private

Sign in to reply to this post

Jason ByrnesWebAssist

also, the FTP is not allowing me to make any changes, i need to be able to edit in order to troubleshoot.

Sign in to reply to this post

Steve

Sorry... FTP permissions updated

Sign in to reply to this post

Jason ByrnesWebAssist

something in the tinyMCE implementation is causing the form to not post properly.

i comented this code:
<script language="javascript" type="text/javascript">
/*tinyMCE.init({
mode : "textareas",
theme : "simple"
});*/
</script>

and the insert started working.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...