Insert not inserting!
Hi Ray,
I'm trying to capture the input of a search field and save it to the db any ideas
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$InsertQuery = new WA_MySQLi_Query($web_catalogues_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "searchphrases";
$InsertQuery->bindColumn("searchphrase", "s", "".((isset($_POST["zoom_query"]))?$_POST["zoom_query"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
I've even tried this
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$InsertQuery = new WA_MySQLi_Query($web_catalogues_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "searchphrases";
$InsertQuery->bindColumn("searchphrase", "s", "test phrase", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
Here is the full header info
<?php ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);?>
<?php require_once('../site_header_inc.php'); ?>
<?php require_once('../Connections/web_catalogues_i.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php require_once('../webassist/mysqli/queryobj.php'); ?>
<?php
$rsCatalogue = new WA_MySQLi_RS("rsCatalogue",$web_catalogues_i,1);
$rsCatalogue->setQuery("SELECT * FROM catalogue WHERE catalogue.CatalogueID=?");
$rsCatalogue->bindParam("i", "".$_SESSION['catID'] ."", "-1"); //paramCatID
$rsCatalogue->execute();?>
<?php
$rsGrpMenu = new WA_MySQLi_RS("rsGrpMenu",$web_catalogues_i,0);
$rsGrpMenu->setQuery("SELECT * FROM view_menu_groups WHERE view_menu_groups.CatalogueID=? AND view_menu_groups.CatGrpActive<>0");
$rsGrpMenu->bindParam("i", "".$_SESSION['catID'] ."", "-1"); //paramCatID
$rsGrpMenu->execute();
?>
<?php
$rsBrandMenu = new WA_MySQLi_RS("rsBrandMenu",$web_catalogues_i,0);
$rsBrandMenu->setQuery("SELECT * FROM view_menu_brands WHERE view_menu_brands.BrandCatID=?");
$rsBrandMenu->bindParam("i", "".$_SESSION['catID'] ."", "-1"); //paramCatID
$rsBrandMenu->execute();
?>
<?php function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}?>
<?php $start_search = getmicrotime();?>
<?php
$rsFeatured = new WA_MySQLi_RS("rsFeatured",$web_catalogues_i,9);
$rsFeatured->setQuery("SELECT view_availablestockall.catAltText, view_availablestockall.catMenuLabel, view_availablestockall.catIcon, view_availablestockall.catDiscPrice, view_availablestockall.catDollarDisc, catRetailPrice, view_availablestockall.catItemDescShort, view_availablestockall.itemAvailable,view_availablestockall.catItemPrice, view_availablestockall.CatItemNameURL FROM view_availablestockall WHERE view_availablestockall.StkCatalogueID=? AND view_availablestockall.catMenuVisible<>0 AND MATCH(catItemDescLong) AGAINST ('" . $_GET['zoom_query'] ."' IN BOOLEAN MODE)");
$rsFeatured->bindParam("i", "".$_SESSION['catID'] ."", "-1"); //paramCatID
$rsFeatured->execute();
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$InsertQuery = new WA_MySQLi_Query($web_catalogues_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "searchphrases";
$InsertQuery->bindColumn("searchphrase", "s", "".((isset($_POST["zoom_query"]))?$_POST["zoom_query"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
Cheers
Norman