inserting serialized values into fields?
Hi, I m using,
PHP Version: 5.2.14
MySQL Version: 5.0.91
i would like to insert values 12000 to 14999 into (item_id) field, via phpmyadmin
tables and fields have been created, i was wondering if some one here could please help me with a sql query to insert 3000 values into a field.
Im rather new to the managing database, i hope i'm not confusing, here;s what i want,
I would like values to be created below these.
So item ID will be incremented from 12000 to 14999?
What about tag ID? Would they all have values of 128, or incremented from 129 to 12129? or would they be null or zero?
sorry, should have made it clearer,
# item_id will increment
# tag_id will remain the same at 128
$query = "insert into `tbl_name` (item_id,tag_id) values";
$q = false;
$q .= (!$q) ? "" : ", ";
$q .= "('".$i."','128')";
Last edited by aj_nsc; 05-02-2011 at 04:00 PM.
I used the query provided, but I think its not in the right syntax, but then again, i m new to sql.
i should mention, values are being added to the existing table 'ws_items', whhich i have substituted in the query provided.
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$i=12000' at line 1
It's not an SQL query, it's a tiny PHP program that generates an SQL query.
...which means that you will not be using it via phpmyadmin, but rather run it on the server via your web browser. So what you need to do is to create a php file, then within it include the mysql connect portion to connect to the database, then include the snippet provided by aj_nsc, upload it to the server, then physically go to the http://yourdomainname.com/yourscript.php (whatever that may be), and run it that way.
okay, i feel sheepish for not realizing that. I'll create a php script and post back how it went. Thank you all for help.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread