Coder Social home page Coder Social logo

Insert issue about pdo_class_wrapper HOT 3 CLOSED

noncent avatar noncent commented on August 11, 2024
Insert issue

from pdo_class_wrapper.

Comments (3)

lesslauer avatar lesslauer commented on August 11, 2024

That's not an issue- please make sure that all numeric values are integer, than it will be running...
--> I recently had exactly the same problem, solved it by setting the variables in php to integer ($foo = (int)$foo).

from pdo_class_wrapper.

noncent avatar noncent commented on August 11, 2024

Hi tmuks,

Thanks for using Class. You are getting error because of you are using lat, long values without quotes and the values are double/decimal type. PDO has not an PDO::PARAM for decimals/doubles. So, You can change function _bindPdoNameSpace by adding

// is double found then pdo param as string
case 'double':                    
$this->_oSTH->bindParam( ":s" . "_" . "$f", $array[$f], PDO::PARAM_STR );
break;

in else condition around line number 988.

or you can wrap your values in quotes as given example..

// your insert array data
$dataArray = array(
    "user_id" => 2,
    "title" => "poodles r us",
    "description" => "poodles r us makes u dog happy! NO kennels, just friendly people TO look AFTER your dog WHILE you re away! think OF us friends",
    "address" => "slough, slough, slough sl3 8ay, uk",
    "latitude" => "51.5006615",
    "longitude" => "-0.5303367",
    "property_id" => 6,
    "outdoor_size" => "medium",
    "late_bookings" => 1,
    "cancellation_policy" => 1,
    "created_date" => "2014-08-19 22:36:23"
);
// execute the insert 
$lid = $db->insert('table',$dataArray)->showQuery()->getLastInsertId();

from pdo_class_wrapper.

tmuks avatar tmuks commented on August 11, 2024

Thnaks all,
It was the issue with double value
as neeraj suggested I added following to the function _bindPdoNameSpace

//case 'double':
default:
$this->_oSTH->bindParam( ":s" . "_" . "$f", $array[$f], PDO::PARAM_STR );

And really a good class you created, just few minor enhancement required for optimum results

from pdo_class_wrapper.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.