Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create / update MySQl file.

Status
Not open for further replies.

Pyrrhus

Technical User
Dec 18, 2001
112
AU
New user who needs help. Broke my collar bone today so one finger typing. Excuse cryptic request. Want to take 350 Javascript variables, each 2-char string vars, and write them as fields in a single record of a MySQL database. Need to set up db first of course. Using PHP. Then need to access db, update etc. Does anyone have any code that can point me in the right direction. Thanks.
 
well, if you want to save all in one record, you should use a sepparator to the values (comma is a good example)

AZ,NY,OH,ON

then, you must know the order of the vars.

You should give type text to the record.

This way you must know the order.

To fetch it in php just fetch a row and then do an explode

$query="SELECT field from table";
$result=mysql_query($query);
$string=mysql_fetch_row($result);
$array=explode(",",$string);

This way, in $array you have an array containing all the 350 values, each in each position, starting on index 0.

Hope this helps
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Check out the php/mysql tutorial at it'll walk you through the whole shebang. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
To Anikin
Thanks for the sample code. That should get me going nicely.

To KarveR
Thanks also. I've used Webmonkey before for JS and general e-commerce info, but didn't think of it this time. Your reminder is very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top