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

wav to mp3 + goDaddy
I need to convert wav files to mp3s. From what I have found so far one way to do it is to have my PH

Insert numbers from Barcode scanner into online php page
I have a real big problem, Here is what I'm trying to do. I have a Intermec CN3 handheld computer th

Show specific day of the week
I have been racking my brain trying to get this function to work properly and it is doing so for eve

Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t

convert static html data into dynamic
hi all

i need to convert a website which has static above 2000 articles into dynamic and add

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

split values
I have values that are returned to me in this format:

name=>test,age=>49

PayPal Redirect Issue
When I have my paypal button set so that is redirects to http://empiremarketing.ca/order.php,it work

Final year project, please point me in the right direction
hi there for my final year project I'm aiming to build a php script shell to use as an expert system

Delete all files in folder except with certain name
I have a script that I want to delete all files in a folder (taken from a database) except for one n

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