Jump to content

Recommended Posts

hello folks,

 

question before I start looking into this but...

 

In my database I have the following layout

 

id

date

name

duration

remarks

entries

01

14:59 03-12-2008

User Name

00:12:00

other

ENTRY

 

What i'd like to do is insert some data into the ENTRY field every four minutes, adding not replacing.  I'd like to be able to then extract this information upon request into an xml document, each four minutes entry being a row of data. I guess a seperator would be needed to enable this.

 

1) is it possible to add info to an existing record and use a seperator

2) what is the best method of doing this whilst trying to keep the db as small as possible.

 

thanks for your advice  :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/135632-add-to-a-record-how-to-seperate-entries/
Share on other sites

Well it depends on your data.

 

Say for example it was a 4 character code that referenced somethign( eg: ENTR, EXIT, CONT etc).  Then you could simply place it all into a large string and then split it every 4 characters.  If its not like that then youll have to think about the actual data your placing in.  ";" might look a fine seperator - but what if you accidently enter: "Phrase1; phrase2"?  Personally I like the "|" or the "~" because they occur fairly infrequently ( IMHO)

 

As for the SQL - I think the best thing would be to go:

 

$val = [get the row]

"UPDATE table SET field='".$val.$append."'"

 

I dont know for certain if there is an append method in SQL - but you might be able to go:

 

UPDATE table SET field=table.field+"append" or somethign similar to that.

 

* However if your appending then Woudl you be testing regularly as well? - in which case youll be pulling the dat aanyway so you wont have to worry too much about the number of SQL queries for server load.

Good luck

Heres an idea.

 

Create a new table "entries" that has a userid column and an entry column. Instead of adding to that row, just create a new row each time. Then this way you can pull out each entry for that user and display it how you want without using delimeters. This will not take up any more room, but may be slower in that every 4 minutes that is alot of rows.

 

 

What is being entered every 4 minutes? and why every 4 minutes? As stated above if you want to do it your orginal way a delemiter is the way to go, just choose something that wont be part of the entry text, like |. Then append it to the end of the string.

 

The real question I have is why add something every 4 minutes. Just think about it, there are 1,440 minutes in a day which means 360 updates per day adding 32 characters or more. So 32 * 360 is 11,520 characters a day with an average word being 5 characters, that is 2,000 words (try writing a 2,000 word essay, it is quite a bit). Times that by a week. Thats around 16,000 words in a week. That is just for one user.

 

The DB is going to grow insanely fast when you multiply that by 100 users, which is why I ask that question, why do you need to append data and what type of data is being appened every 4 minutes?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.