473,385 Members | 1,320 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,385 software developers and data experts.

What is better? an external page or a database

moishy
104 100+
I want to store (and later retrieve) an array.

How is the simplest and best way to do so?
Nov 21 '06 #1
10 1316
ronverdonk
4,258 Expert 4TB
Depends on how long you want to store it: for the duration of a session of over sessions?
For the duration of a session you can store the array in the $_SESSION array. Over sessions you can store in in the database.

It would be easiest to first use PHP serialize() function on the array to make it into a string that can be stored anywhere. After retrieving iy back again in a string variable, you can then use PHP unserialize() function to reconstruct the array again.

Ronald :cool:
Nov 21 '06 #2
moishy
104 100+
No. I don't want is only for that session.

I want it to last at least a week, and on MY server, not HIS system

So, I guess I'll use the serialize(), but how should I store it?
(that was my original question)

Thanx,
Nov 21 '06 #3
moishy
104 100+
And to make things clearer:

I want to store my serialized array somewhere where I can retrieve it with PHP when needed.

What should the code for that be?
Nov 22 '06 #4
ronverdonk
4,258 Expert 4TB
A serialized array is just a straight string. So you can store it, depending on the expected length, in a char or (better) varchar data type table column.

Ronald :cool:
Nov 23 '06 #5
moishy
104 100+
So what should the code for this be?
Nov 23 '06 #6
steven
143 100+
So what should the code for this be?
You will need a database server up and running with relevant access permissions.

Also, php.net has plenty of information on interacting with a dbms, such as MySQL. Just pop in 'mysql' in the search field on http://php.net/ and in the drop down, select "online documentation" and you will have all the information you need.

TheScripts is not a code database, you don't just come and expect code. Make a start, show us what you have done and if you're struggling or need help, people here will be more than happy to assist.
Nov 23 '06 #7
ronverdonk
4,258 Expert 4TB
If you do not know anything about storing data in a MySQL database, then you'd better run off to get some basic education for MySQL (and maybe PHP also).

Ronald :cool:
Nov 23 '06 #8
moishy
104 100+
It just so happens to be that I never got into databases yet.

Quote: show us what you've done

Actually, I've already written a full-fledged website using PHP:

http://www.thelivingsidrah.com
Nov 23 '06 #9
cool man..,
the simple way is what you prefer and understand to use.
it depends on you, whether txt or database.

I cann't show you how to do this, because this is large problem on simple question, but i'm sure you're really had experience on php to accomplish this.

So my suggestion is,
If what you need is just to store un structured data, using txt is a good simple once.
But if you need to store structured data, so you can manipulate this data (sorting, updated per one data, etc), using database is more simple.

all i had mention is not look from the simple or not the code to write, but it's look from the simple logic to implement....
Nov 24 '06 #10
Atli
5,058 Expert 4TB
I'd be very carefull when using external text files. In my oppinion it would be simpler to just learn MySQL than it would be structuring a decent system on your own.
Nov 25 '06 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
112
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please,...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
7
by: Bura Tino | last post by:
Hi, Going forward, what's better to use <td height="20"> or <td style="height:20;">
0
by: ar | last post by:
If I had a form with one textbox on it and I wanted to populate that textbox on page load, how could I do that from a global procedure? I tried creating a separate class file with the following...
20
by: Steven T. Hatton | last post by:
I just read this in the description of how C++ is supposed to be implemented: "All external object and function references are resolved. Library components are linked to satisfy external...
4
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access...
0
by: sub | last post by:
I'm using plone primary as a news system for my school. Now I want to integrate external sources into my plone site. The page is...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.