473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Get array from string

Hi,

I would like to store data from a string in a database after some
stripping. So for example:

<li><a href="xxx">yyy</a> - zzz
<li><a href="aaa">bbb</a> - ccc

In this example (which is one string) I would like to store the
variable data in a MySQL table. In order to do that I need to first
get the variable data from the string, which I can manage I think.

But how do I get the data into the database? Do I need to insert the
data into one or more arrays? And how can I then insert it into the
table?

Kind regards,

Martijn
Jul 17 '05 #1
5 2695
Martijn Hertog wrote:
Hi,

I would like to store data from a string in a database after some
stripping. So for example:

<li><a href="xxx">yyy</a> - zzz
<li><a href="aaa">bbb</a> - ccc

In this example (which is one string) I would like to store the
variable data in a MySQL table. In order to do that I need to first
get the variable data from the string, which I can manage I think.

But how do I get the data into the database? Do I need to insert the
data into one or more arrays? And how can I then insert it into the
table?

Kind regards,

Martijn


Hi Martijn,

I suggest you create a table with:
1) unique id (PK)
2) hrefvalue (text)
3) hlinktext (text)
4) extracomment (text)

and store a record at a time in it.
I don't see any advantage in storing arrays of strings in a database. (If
possible with MySQL, which I am not sure of because I only use Postgresql)

Regards,
Erwin Moller
Jul 17 '05 #2
Erwin Moller <si******************************************@spam yourself.com> wrote in message news:<40*********************@news.xs4all.nl>...
Martijn Hertog wrote:
Hi,

I would like to store data from a string in a database after some
stripping. So for example:

<li><a href="xxx">yyy</a> - zzz
<li><a href="aaa">bbb</a> - ccc

In this example (which is one string) I would like to store the
variable data in a MySQL table. In order to do that I need to first
get the variable data from the string, which I can manage I think.

But how do I get the data into the database? Do I need to insert the
data into one or more arrays? And how can I then insert it into the
table?

Kind regards,

Martijn


Hi Martijn,

I suggest you create a table with:
1) unique id (PK)
2) hrefvalue (text)
3) hlinktext (text)
4) extracomment (text)

and store a record at a time in it.
I don't see any advantage in storing arrays of strings in a database. (If
possible with MySQL, which I am not sure of because I only use Postgresql)

Regards,
Erwin Moller


Thank you Erwin,

Which code can I use to get the data into the database table?

Kind regards,

Martijn
Jul 17 '05 #3
he*****@yahoo.com (Martijn Hertog) schrieb:
Which code can I use to get the data into the database table?


mysql_query()

Hava look at the documentation, starting at
http://www.php.net/manual/en/ref.mysql.php.

Regards,
Matthias
Jul 17 '05 #4
Okay, that seems to be a function that should be used of course. Could you
please send me an example code for the whole procedure, since I am not quite
sure how to get the variables ready for usage in an MySQL insert function.

Kind regards,

Martijn

"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:c2**********@usenet.esken.de...
he*****@yahoo.com (Martijn Hertog) schrieb:
Which code can I use to get the data into the database table?


mysql_query()

Hava look at the documentation, starting at
http://www.php.net/manual/en/ref.mysql.php.

Regards,
Matthias

Jul 17 '05 #5
For example, I have the string:

#li##a href=http://www.cia.gov/cia/#CIA Factbook#/a# - Overview of Korea's
people, geography etc #li##a href=http://encarta.msn.com#Encarta#/a# -
Korean geography, society, culture, economy, government, and history.
----------
I would like the data in this string stored in a MySQL table, like this:
id url name
description
------------------------------------------------------------------------
1 http://www.cia.gov/cia/ CIA Factbook Overview ....
2 http://encarta.msn.com Encarta Korean ...

Kind regards,

Martijn
"Martin" <he*****@tiscali.nl> wrote in message
news:40**********************@dreader2.news.tiscal i.nl...
Okay, that seems to be a function that should be used of course. Could you
please send me an example code for the whole procedure, since I am not quite sure how to get the variables ready for usage in an MySQL insert function.

Kind regards,

Martijn

"Matthias Esken" <mu******************@usenetverwaltung.org> wrote in
message news:c2**********@usenet.esken.de...
he*****@yahoo.com (Martijn Hertog) schrieb:
Which code can I use to get the data into the database table?


mysql_query()

Hava look at the documentation, starting at
http://www.php.net/manual/en/ref.mysql.php.

Regards,
Matthias


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
11
by: deko | last post by:
I need to create a basic one-dimensional array of strings, but I don't know how many strings I'm going to have until the code is finished looping. pseudo code: Dim astrMyArray() Do While Not...
4
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
3
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3......
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
7
by: Jim Carlock | last post by:
Looking for suggestions on how to handle bad words that might get passed in through $_GET variables. My first thoughts included using str_replace() to strip out such content, but then one ends...
14
by: Peter Hallett | last post by:
I would like to set up a string array as a class member, or field, and then populate this array by reading in from a text file, but I cannot find the appropriate syntax. The getter and setter are...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
2
dlite922
by: dlite922 | last post by:
difficult to explain, easier to show: Here's what my data looks like on the PHP side: Array ( => Array ( => 20003001 => ABC RESTAURANT
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.