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

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

Xml parsing
I need a suggestion about parsing xml with multiply parts like pervious...
i.e. different device

Custom array sort? asc then desc
Any ideas how I could sort this array? I've been trying for a while. Maybe with usort, but I have no

Automatic Webpage ??
I have a page www.mysite.com/test.php with a
<form>
<textarea name=&q

Inter Company -- Resources Related Billing (Services Industry)
Hello,

My company has a scenario where:
Company A bills Company C for INTER (cross

Problem with HTML form
Hello,

I made a HTML form with some fields and check box.
Everything works fine except whe

FPDF Help
I've been playing with the FPDF module. I was building a form and rolling right along and then sudde

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

Breaking results into week blocks
I have a set of dates (and times), which are returned from a mySQL query.

These usually span

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