Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Storing Data


Say I have a number: number = 34043923, this represents a wordID, so the word belonging to this wordID is say: forum (whatever).

This can be stored in 4 bytes (so i am told ) BUT when I save it with fopen/fwrite it takes up 8 bytes (1 for every character) and the file can be read (when opening the file it just reads 34043923).

How can I store this data so it takes up only 4 bytes AND how can I do this storing it in a textfield of a mysql db?




View Complete Forum Thread with Replies

Related Forum Messages:
Storing Data For Use
I want to store an array on the server for use across multiple pages. I know and have been using sessions, but it just kills me to know that if the user turns cookies off, this is all gonna stop working unless I want that big session id in all urls. Also, the info in this array is by no means specific to each user, its the same for all of them. Is there any alternatives to this? Some way of storing an array which would be accessible by multiple pages.

View Replies !
Storing Data In Session
Have a question about storing data in session. I have a blog site with users of course. Instead of having to make a call to getUserData() each time I want user data inside a function (or defining it globally) I thought about storing the data in a session variable and doing one of two things. Keeping that throughout the lifetime of the session, and only re-querying if a change has been made since the request was pulled (Date field in the user table of last_modified) or just storing it in session and un setting the data each page.

Not sure which (if any) is better. Most likely there will be about 20 fields stored, username, email, and some options the user is able to set which should only be boolean variables. I think storing it in session and testing against the timestamp would work great but before I start coding this for my whole site would like to know some input.

View Replies !
Storing Survey Data In The Db
I have a web page containing a form with many questions and I let the user specify one or a few answers by using either radio buttons or checkboxes. I need to know how to store the information (their answers) in a database in case of questions with multiple choices (checkboxes). Should I concatenate the strings corresponding to each checkbox the user has checked for a certain question and store that string in my db or how should I do it?

View Replies !
Storing An Array Of Data
Currently I am working a database, which will store 1000-s of reflectance signatures. These signatures each consist of a few hundred values. I will not need to sub-query the signatures/values, but have a metadata-table for querying. Code:

View Replies !
Storing Compressed Data
I am trying to store a large string representing a RTF document through PHP in a MS SQL Server database. To gain diskspace i want to compress that string. My code looks like this:

str_replace("'","''",addslashes(gzcompress($RTF1)))

The insert succeeds but the problem occurs when i try to retrieve the data form the database and when i try to transform it to the original string, i then use:

$RTFdecompressed = gzuncompress(stripslashes(str_replace("''","'",$RTF)));

But this does not work ok.

View Replies !
Best Aproach Be To Storing Data?
I want to be able to store data as part of my website. I'm assuming that I''ll need to use PHP scripts to provide this functionality, but what would the best aproach be to storing data?. I could use a database of some sort (maybe MySQL?), but I'm wondering whether there are any other aproaches to data storage that would be less elaborate than a full database.

View Replies !
Storing Checkbox Data
I have worked through the PHP Builder tutorial titled Storing Checkbox Data In Your Database several times and have never been able to get it to work. I understand much of the code, but some parts are somewhat fuzzy to me. After looking around, I still think this is probably the best method to use in my application. There are apparently multiple problems with the code that the author has posted in the tutorial and some of the fixes can be found by reading through the replies just below the tutorial.

What I am looking for is anyone who either has a working demo of this tutorial and is willing to send me the files. I already have the tables in my database. Anyone who is willing to work through the tutorial and get it working and then send me the files. If I had a working demo. I can edit it to fit my own application needs.

View Replies !
Storing Voting Data
I am introducing a voting system and I can't figure out (well anyway) how to store the results of each proposal. Registered users can vote on proposals, this vote needs to be recorded somehow.

I'm guessing a list of users and their vote attached to the moderation somehow in the MySQL voting table, or alternatively attach to each user what they have voted on.

Either way I'm not sure how to add a list of users to a particular ID of an SQL row, the only way I can see doing that is having an array of users in a row, but I don't think MySQL supports arrays like that?

View Replies !
Storing Data Securely
I want to find out what options I have regarding storing my data securely in a mysql database.

1. Can I store the data so that it is encrypted?

2. Can I store the data so that it is scrambled so if someone managed to hack into the database, it would not make much sense to them?

View Replies !
Storing Encrypted Data In Cookies
How can I encrypt data and store it in a cookie, so I can later extract and decrypt it... anything short of creating the cookie with an id number that is a referance to the key which is stored in my database? or is that the only way?

View Replies !
Reading XLS File And Storing Data In DB
anyone idea how to read Excel file in php?

keep in mind that i would use php on linux platform so no COM solution ...

View Replies !
Storing Session Data In Mysql
how i can store session data in a MySql Database...this is because my use multiple servers and session data can get lost?

View Replies !
Storing Data For Future Visits
I have this problem:
I have a database with information about games, and users are able to vote
for them. Everytime a user votes for a game I store the unique game name
into a session variable (an array). So if they are in a page were they
already voted, they won't have the option to do so.
The idea is that the session cookie lasts "forever", I don't want them
voting for the same game everytime they get to the site. This isn't soo
strict, I don't care if some few users don't accept cookies and eventually
vote 2 times for the same game.
So what I did is to have a session cookie with a very large expire time and
I noted that the session variable data is stored in my server
in /temp/sess_blabla
my questions are:

1. how much does this data last?, can I make it last forever with
session_cache_expire()?
I still don't like this solution, data would be lost if I change the server,
I would prefer that the client store this info with his session ID so:

2. I've searched and read that you can store data in a cookie, but coudln't
find the way to do it. Can I store this variable in the users session
cookie?, how?

View Replies !
Storing Mysql Connection Data
We run a pretty large site (about 18000 pages) and we use mysql data a lot. The problem is that right now every file that has to connect to the db has it's own $conn statment.
Which means the db_name and password are repeated a million times! So, if we ever wanted to change the password it would take a lifetime.

One way to correct this is to creat a file mysql_info.php in the root and then include it in pages that require the information. Problem is that we would need to write the "bread crums" for every file... For example, if file test.php in root/folder 1/folder 2/folder 3 needed the mysql_info.php then it has to be called as include "../../../mysql_info.php"; . is there an easier way?

View Replies !
PHP And CSS - Storing The Data In An Access Database
I am creating a web based calendar for tracking appointments. I am storing the data in an access database(may go to MySQL later)I have three different catagories that i would like to display with different backrounds and font colors.

View Replies !
Storing Formatted Numeric Data
I am wanting to store price data as n.nn format, so if the user enters "1"
the data that gets stored is "1.00" Is there a way to do this.

View Replies !
Storing Checkbox Data In Your Database
Firs of all, I'm thankful the programer ( Dan LaFlamme ) for this code ( Storing Checkbox Data In Your Database ), it is very good, and I have tested it it was excellent, but there is two problems:

1- always appear this message when I'm browsing your code :
( Warning: Missing argument 5 for make_checkbox_html() in c:apachehtdocscheckboxcheckbox.php on line 59 )

2- I did as you said, and I have designed the database and the tables name as you mentioned, and I have tested your code on your table that you mentioned, but nothing stored in the (lookup_skills) table, so please help me about these problems

View Replies !
Fatal Error Storing Serialized Data
I am trying to store in a file serialized data array with 7,935 lines.

*Fatal error*:
Allowed memory size of 8388608 bytes exhausted (tried to allocate 128
bytes)
in *.../api/api_functions.php* on line *830

That line is:
$data = ExecuteQuery($sql);
$fp = fopen($filename, "w");
fputs($fp, serialize($data)); // HERE is the line 830
fclose($fp);

What can I do to fix that?

View Replies !
PHP Upload ! Storing Image Data In MySQL
I am at my wit's end ! I have used the following script succesfully to
upload an image to my web space. But what I really want to be able to do is
to update an existing record in a table in MySQL with the path & filename to
the image.

I have successfully uploaded and performed an update query on the database,
but the problem I have is I cannot retain the primary key field in a
variable which is then used in a SQL update statement to ensure that I
update the correct field in the MySQL table. I have not included the code
for the SQL update.

To summarise I guess what I am trying to do is create a page for updating
produuct data on an ecommerce site. So the Promary key is the Product Number
and I need to store the image filename in the products table.

Any Help will be gratefuly received. I am sure this is a very very simple
question to an experienced PHP programmer, I just cant get my head around
it all at the minute !

Script: ....

View Replies !
Serializing Data Vs Storing It In A Seperate Table
What would give better performance, serializing a multidimensional array
and storing it in a single entry in a table or storing each element of
the array in a separate table and associating the entries with the entry
in the other table?

Having a separate table would result in two queries instead of one, but
you wouldn't have to deal with the overhead of serializing and
unserializing data.



View Replies !
Storing Form Array Data To MySQL Using PHP
Let's say you've got a form with check boxes like below:

<form method="post" action="path to script">
<input type="checkbox" id="colors[]" value="red" /> Red
<input type="checkbox" id="colors[]" value="blue" /> Blue
<input type="checkbox" id="colors[]" value="green" /> Green
<input type="checkbox" id="colors[]" value="yellow" /> Yellow
</form>

How can I save this data into mySQL and how can I view these data from DB?

View Replies !
PHP Implementations Of Algorithms For Storing Heirarchical Data In A Relational DB
There's lots of ways of representing a hierarchical data structure in a
relational database. These range from the trivially easy to implement in
PHP (adjacency list; each node has an ID and a ParentID) to the fairly
nightmarish (Tropashko's nested intervals).

In starting this thread I'm not looking for a primer on any of these
methods, which Google will happily provide; I'm looking to create a list of
PHP implementations of any such method - and in particular I'm hoping that
someone's tackled Tropashko's stuff in PHP already so that I don't have to
reinvent the wheel ;-)

So please post if you've developed, or know of, any PHP implementation for
handling this kind of data, maybe using the methods I've mentioned, some
Celko-inspired method, or maybe something totally different.

View Replies !
Column Data-Type For Storing Serialized Array In MySQL?
I'm really not sure - I used BLOB in the past- but the arrays are only a few kilobytes. But VARHCAR only allows 255 characters at most and the arrays might contain many more characters than that.

View Replies !
Storing Leading Zeros In Mysql Int And Varchar Data Types
This issue is more of a MySQL issue than php. I am trying to store a 5 digit integer and a 9 character varchar field in a table. Both have to be able to take values with a leading zero such as 02130 or 089fg7agf.

I am successfully storing the data however the stored data loses the zero at the beginning in both cases. I thought about perhaps using a float data type, however for the varchar value that wouldn't work.

View Replies !
Selecting Part Of An Image And Storing It In An ODBC Data Source
What I need to do is this:

"On the fly"....

1. Select part of an image provided by the user (i.e. define a
thumbnail)
2. Store this 'thumbnail' in an OLE field in an ODBC database (created
in Access 2000)
3. Be able to retrieve this thumbnail from the OLE field at a later
date and display it.

I realise that this is quite an involved problem but I would be very
grateful for any parts of the solution,

View Replies !
Random Variables + Storing Pokémon Data + Adding To Intergers
-How do you set a variable to a random number between two numbers? Such as, setting the variable $var to a random number between 1 and 5.

-Yup. Pokémon. Sounds stupid, however, we have interests. So, like, how should I store Pokémon Data? (Pokémon are like creatures or monsters. The closest things possible to it are Monster Rancher, Digimon, and Demikids). It's more than likely going to be stored in a table... yet, I don't see how it could be really possible.

-Okay, I have a field called "Money". How would I add or subtract numbers from that field?

View Replies !
Encrypt Customer Information Using PHP Before Storing The Data In A MySQL Database.
My PHP version is 4.3.2.

I would like to securely encrypt customer information using PHP before storing the data in a MySQL database.

Is it possible to do this using a public / private key system so that once data is encrypted on my web server it can only be decrypted on a pc with the private key (such as a PC in my office)?

View Replies !
Storing XML
I'm designing a website that will use XML to store all the content of my
web pages. I will use a PHP script to parse the XML. Should I store the
XML in a MySQL database or should I simply store the XML in *.xml files
on my server? Which would would yield better performance? And would
using one PHP script to parse all the pages be too much on one script
(I'll have about 600 pages)?

View Replies !
Storing Vs Not
printing $database[somevar] a couple times in your code or manipulting it, such as multiplying it by 2, or storing it under $myvar and using $myvar.

View Replies !
Cookie Storing
I have this script so far:

<?
session_start();
if (!isset($_SESSION['track'])) {
$_SESSION['track'] = 0;
} else {
$_SESSION['track']++;
}
?>

Which sets a cookie. I can also check if the cookie exists when the user goes to another page.

How do you store information in the cookie? For example if I want to store a number like 1200, and then get that information from the cookie again when they go to another page?

View Replies !
Storing Classes
I have a script which calls up a class stored in a file FormatText.class . I don't want my .class files to be accessible if anyone types the URL of the class - I only want my class file accessible by a PHP script called by my server. I use

require_once "FormatText.class";o get the class. Where do people typically place the class files when designing software? Shoud I put it in the root folder?

I also have a text file I often call that contains sensitive database information. I placed that file in the main directory, (one up from the www directory). How safe is that file? Is that standard practice?

View Replies !
Storing Dates?
i am trying to design a script for sending mot reminders out 2 clients they sign up online then 10days before there mot expires the script sends a e-mail out reminding them what would be the best way to store the dates in my database?

View Replies !
Storing Array In A Row
I run a site with staff-submitted reviews, and most of them are written
by one author. However, we also do "multiple" reviews. Up until now I
just had a userid for a 'Multiple' account and submitted them under
that, but this makes it harder to print lists of all the reviews by one
person, so ideally I wanna make a multiple select form so we can just
select all the contributors and have the values saved in the database -
in one row (something like "56,34,21" etc).

I've coded a multiple select form with all the authors of articles for
my site on, and I want to store the results of this in one row so I can
grab them as an array later - how can I go about doing this? I just
googled and came across using <select name="author[]"> in my HTML, and
then using serialize() to process it, but it fails. When I run the
following code, the value for 'multiplearray' remains at 0 whether I
select single OR multiple values on the form:

<?php
$dbhost = ###
$dbuser = ###
$dbpass = ###
$dbname = ###

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
connecting to mysql');
mysql_select_db($dbname);

if(isset($_POST['save']))
{

$author = serialize($_POST['author']);

$query = "INSERT INTO review_test (multiplearray) VALUES
('$author')";
mysql_query($query) or die('Error ,query failed');
echo "Query successful!";
}

echo "<form name='test' method='post' action=''>";

$query2 = "SELECT Staff_id, displayname FROM users WHERE
userlevel !=0
ORDER BY username";
$result2 = mysql_query($query2) or die('Error : ' .
mysql_error());

echo "<select name='author[]' id='author[]' multiple='multiple'
size=&#3910;'>";
while($row2 = mysql_fetch_array($result2, MYSQL_NUM))
{
list($Staff_id, $displayname) = $row2;
echo "<option value='$Staff_id'>$displayname</option>";
}

echo "</select>";
echo "<br><br><input name='save' type='submit' id='save' value='Post
Review'>";
echo "</form>";

?>

View Replies !
Storing Dates In DB
What do you think is the best way to store Dates into a database ?
If you want to keep logs or buckups....

I am using date('dmYHis')
but I doesn't work really well ...
Is it better to use date(U) ?

View Replies !
Session Not Storing ID
I am attempting to create a login in script using a session variable to hold the user id. I have got the log in facility working. Just before I redirect the user I set the session variable to the ID.

Then when I get to the next page I check to see if the session exists, if it does then I output it. The only problem is that instead of outputting the ID I keep getting 'Session ID: Resource id #7' Code:

View Replies !
Storing Sessions
Can anyone tell me what is the best way to store sessions into database in order to recognize that user next time he access the site?I thought about IP address but then I remembered that it is different every time.What thing regarding a user is always the same?

View Replies !
Storing Results For Later Use?
Is it possible to store results that are parsed from an xml file and then use them on a different web page? Basically I want to store the data within the nodes and then use that data on another web page. Kinda like adding pagination but instead of gettign the info from a db I am getting it from a xml file. Code:

View Replies !
Storing Sessions...
Does it matter how and where they're stored?

I was reading through this tutorial and I can across a discussion on where sessions are stored. I was under the impression that this wasn't something I had to worry about..

View Replies !
Storing An Array In A Db
I know your first reaction will be "WHY?!?!" But can it be done? Can I store
a php array in a postgresql database?

View Replies !
Storing SQL In A XML File
I'm trying to store a sql statement in a xml file like so:

<sql>"SELECT customers.customers_email_address, customers.customers_password,can_seller_profiles.seller_social_name,manufacturers.manufacturers_imag e FROM customers ,can_seller_profiles ,manufacturers WHERE customers.customers_id = '$acc_id' AND can_seller_profiles.seller_customers_id = '$acc_id' AND manufacturers.manufacturers_id = '$seller_man_id'"</sql>


but when I echo the the sql in php the vars aren't being populated. I'm trying to avoid hard coding the statements do theres something like 30 plus statements.

View Replies !
Storing The Value Of A Textbox
I have a form with a textbox and A submit button. I want the value of the textbox to be stored in a variable so as to pass through to other pages. I have reached this point:

page 1
<?php

session_start();

if (isset($_POST['txtusername']))
   $_SESSION['test'] = $_POST['txtusername'];
$_SESSION['test'] = 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

Im testing it both on localhost and web server. Unfortunately, the opening page is blank.

View Replies !
Mp3 / Pdf Storing Into Database
What's disadvantages of storing mp3/pdf/doc files into database instead of uploading to a folder . If you store into database its very easy to restrict user to download the files.

View Replies !
Storing Passwords
How do you guys go about filtering passwords before storing name. I have my username filter set to only allow numbers and letters but not how to implement a filter for passwords as people may prefer using characters, for better protection, which may inadvertently lead to cross scripting vulnerabilities.

View Replies !
Storing Arrays
Im trying to figure out a good way to store an array in mysql, and be able to retrieve the entire array, back into an array.

Im building a form that allows authors to submit "Tags" for their books, so people can search on these "Tags" and it will search the Authors table in mysql for matching tags, so that readers can simply enter a tag, and find books that match the tags.

For example:

Thru a form, an author might type

php,mysql,development - Those would then by submitted by a form, So what function could i use to put those into an array?

Then how would i store the array in mysql and be able to retrieve it back into an array, for example

/author.php?author=mike

If mike's tags were php,mysql,development id like to list that on the php page next to his book.

So what im trying to do is, 1. Get comma seperated values and put them into an array. 2. Store the array in mysql, and be able to retrieve it back into an array(i know database functions, just not sure what datatype i should use for the column to store these in).

View Replies !
Storing Settings In A DB
I have a table containing two fields, `name` and `value`. Is it possible to loop through all rows in the table, and assign a variable of with the name stored in `name` and value `value`? It's the storing variables when you don't know the name of the variable you're creating that's a problem.

View Replies !
Storing XML In MySQL
What I am trying to accopmlish is to somehow store XML data into MySQL (using PHP I'm guessing). Can anyone point me in the right direction to get started?

View Replies !
Storing URL Value Into A Variable.
Is there any way to store url into a variable and then use the variable to send the user back to the same page from where he came.

View Replies !
Storing Translations
-translations for different languages are stored in .ini files.
-the choosen language is stored in a $_session['lang'] variable.
-for every file accessed i load the .ini file representing the $_session['lang'] and store it in the _strings() array.and use those strings for substitution.

The Question: is it better if i store the translated text once in a similar $_session variable for use during the whole session.or better to create a new instance of the i18n class and reload the .ini translation file for every new page the user access?

View Replies !
Storing App Settings
storing settings in php files like this:

File : settings.php
<?php
$settings['cacheDir']='cache_directory'
$settings['templateDir']='template directory'
?>

File: index.php
require_once("settings.php");

is is secure enough or should i store those settings in constants instead? i mean is there any chance that the user can override those settings when accessing the index.php page from the web?

View Replies !
Storing _FILES
how do you store all the information inside _FILES[] when you do a post. How long does a file stay in the temp dir before you have to move it or it gets deleted. I need to know this because I want one php file to have the upload GUI and another to actually store the file on the server but I do not know how to pass the file information between the two.

View Replies !
Storing On The Fly Images
I have a script that lets users pick an image and add text to it using this php script: Code:

View Replies !
Storing An Image
<?php
header('Content-type: image/jpeg');
$filename="downloads/Image/large/21-47-110-1.jpg";
$img_temp = imagecreatefromjpeg($filename);
$img_thumb=imagecreatetruecolor(132,99);
imagecopyresampled($img_thumb,$img_temp,0,0,0,0,132,99,imagesx($img_temp),imagesy($img_temp));
imagejpeg($img_thumb, "", 60);

//this is the bit I am not sure about.
$handle = fopen("downloads/Image/large/test.jpg", "a");
fwrite($handle, $img_thumb);
fclose($handle);
imagedestroy($img_thumb);
?>

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved