insert/update functions for mysql, what do you think?


Posted on 16th Feb 2014 07:03 pm by admin

I am working on two really simple functions that automatically generate (and execute) insert and update mysql queries and I have some questions:

Can there be any problems later on if functions treat numeric and string values the same? The function reports error if some value is neither numeric nor string (checked by using is_numeric and is_string functions), otherwise it just uses mysql_real_escape_string on all values in array and adds '' everywhere. Unlike microsoft access, mysql doesn't seem to care if you put '' on numeric value.

The simplest usage of insert function (for form data entry) would be:

db_insert('users', 'name,e_mail,bio', $_REQUEST);

First argument is table, another is the list of fields (separated by comma) , and third is the associative array of data that you want to insert.

Can you notice any problems?

No comments posted yet

Your Answer:

Login to answer
329 Like 10 Dislike
Previous forums Next forums
Other forums

limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h

extract a file from zip file
hi,
i know how to unzip a zip file in php, but is there a way to just extract a certain file only

Mail Form receiving emails with no content
Hi, I hope someone here can help me.
I have a simple form in my website, it was working OK, after

Renaming array keys
The issue: renaming array keys inside a foreach loop.

I'm trying to build a pie chart image w

utf8_general_ci error ??
I have all kinds of data to be inserted in database table

//I am getting this error

Yo

Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont re

Script not running properly
Hello Everyone
This is a basic script for posting to a database. I'm not sure why it doesn't work

Product categories for registration
Dear all,

We are going live with the Supplier registered next week. At standard, the 'sel

Working with Global Variables
hi, I'm not really sure why the following code is returning a "Call to a member function getBan

problem with sql querry in php script
Hello guys,

What I want to do is I want to read out a csv file and then but te conent ot the

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash