How do I read data from file with delimiters (for instance A;B;ccc;S45A;UU )?
I'd like to write that data to MYSQL table...
Thanks for the help,
Boris Savc 3 2205
Pĺ Tue, 24 Feb 2004 11:27:58 +0100, skrev Boris ©avc
<bo********@odi s-info.com>: How do I read data from file with delimiters (for instance A;B;ccc;S45A;UU )? I'd like to write that data to MYSQL table...
This is -one- way of doing it:
$lines = array(); //Create an array.
$lines = file("my_delime d_data_file.dat ");//Load the lines into the array.
foreach($lines as $line) { //Loop through the array.
list($field1,$f ield2,$field3,$ field4,$field5) = explode(";",$li ne);
//Extract your vars from the line.
mysql_query("IN SERT INTO your_table ('field1',___,' field5')
VALUES(".$field 1.",___,".$fiel d5.")"); //Insert them into the db.
}//End of loop
The ___ part is of course just "fill in the blanks yourself".
The code is of course not complete, but you get the general idea.
--
Fred H
void FredH::Contact( ) {
TextToSpeach.sa y("frode at age dee dee dot en oh");
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jong Choi |
last post by:
Dear All,
I am trying to open the file(walk5.dat) and then read the data
The structures of data are
0, 0, -10, -10, 0, -8.1,-12,-10 , 0,-14,-10,-7,0,
6.096666667,-10,-10,1, -1.118333333,-12,-10,1, -10.06666667,-10,-7,1
There are 25 data in one row and I want to read them and save them.
Each data is seperated by comma(,)
|
by: les_ander |
last post by:
Hi,
matlab has a useful function called "textread" which I am trying to
reproduce
in python.
two inputs: filename, format (%s for string, %d for integers, etc and
arbitary delimiters)
variable number of outputs (to correspond to the format given as
input);
|
by: Greg McIntyre |
last post by:
I have a Python snippet:
f = open("blah.txt", "r")
while True:
c = f.read(1)
if c == '': break # EOF
# ... work on c
Is some way to make this code more compact and simple? It's a bit
spaghetti.
|
by: Timex |
last post by:
I want to delete all comments in .c file.
Size of .c file is very big.
Any good idea to do this?
Please show me example code.
|
by: spike |
last post by:
Im trying to write a program that should
read through a binary file searching for the character sequence "\name\"
Then it should read the characters following the "\name\" sequence
until a NULL character is encountered.
But when my program runs it gets a SIGSEGV (Segmentation vioalation) signal.
Whats wrong?
And is there a better way than mine to solve this task (most likely)
| |
by: Profetas |
last post by:
I have the following code that detects a
<c>
and
</c>
#include <stdio.h>
main(int argc, char *argv)
{
FILE* fp;
char data;
|
by: H |
last post by:
Now, I'm here with another newbie question ....
I want to read a text file, string by string (to do some things with some
words etc etc), but I can't seem to find a way to do this String by String.
Is there anyway, like String s = something.ReadString() ?
Or what may be a fine way to do this ? Only thing I can some up with is to
read 1 char at a time, and look if the next char is a space-sign, and that
way "make" the Strings myself....
|
by: Ray |
last post by:
Hello World,
I made a Windowsform that reads data from a CSV file.
It works fine, but when I have read the data of a record I have to re-Debug
the form to read another record.
So when I put a new seek item in the textbox after I searched for an item
and click the seek button.. it seems it is doing nothing.
And also... what code can I use to genereate a messagebox message when a
seek item is not at all in the CSV file?
|
by: pencoder |
last post by:
Actually i wrote C# codings to read text between delimiters.it works nicely.
in my codings i have a condition it checks whether the delimiter indexed first time or the second time.based on that i read that text file.
But i don't know how to code for multiple delimiters.actually i don't know how to put the condition.can anyone help me.....
thank you
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |