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.





Can I Store An Array In MySQL?


I would like to store an array in a MySQL table. The values will be numeric and ranging from 1-999. I'm not sure if this is possible, and if it is then I'm not sure on the correct field type to use.




View Complete Forum Thread with Replies

Related Forum Messages:
Store Mysql Results Into An Array
i just started using php. i've used it before as a maintainer. fun stuff. well now i'm the writer. i want to abstract all the DB commands away from myself and all other developers. so i'm writing a function to query the php database from all users of the database and store them into an array as a return value so that i can seperate my database code from my html creation code.

1. is there a way to put all my database functions into a php file and include that file into all my other php pages? similiarly to a #include in C++ or a import package name in Java?

2. my code to run down the fetched results and store them into an array doesn't seem to be working the way i want it to. if i print out the results from the mysql returned fetch the data is fine. however the array seems to print out "Array[elementnumber]" instead of the value. Code:

View Replies !
Store Values In An Array
$a=10;
$a=15;

while ($a <= $b)
{
$a++;
}

The output is 10,11,12,13,14,15

How to store the values of $a(10,11,12,13,14,15) in an sigle array.

View Replies !
Store Classes In An Array?
Is it possible to store classes in an array? I am fairly new to PHP,
and haven't found anything either way yet.
I have a program that where you can have multiple notes attached to a
ticket, which are stored in a database. I would like to just pull all
the notes from the database, storing each one in a seperate class,
which itself is stored in an array (well, another class, but it's a
classList, it's mainly an array).
I'm getting an error when I run the page:
"Cannot use a scalar value as an array", and "Call to a member function
on a non-object". The second is related to the first, as I'm calling a
function on the array value.
If it is possible, I probably coded something wrong. If that's the
case, I'll post some code.

View Replies !
Get Data From The Db And Store It In An Array
I want to have an input field in my Admin CP when you are creating a Forum where you can input a list of numbers (member ids) seperated by commars, like this:

Quote1,6,4,8,2
These will be the ids of people who can moderate the Forum and will be stored in the db along with all the other stuff like forum name/description etc.

That's easy enough.

Now my problem is I need to get that from the db and store it in an array... basically so I can do something like:

<?php
if(in_array($_SESSION['mem_id'], $forum_moderator_array)) {
    echo('Congratulations, you are a forum moderator.');
}
?>

How can I go about doing this?

View Replies !
Store A Array As A Variable
is there any way that i can store a array as a variable because i dont want to creat a database for thousands of variables. heres what i thought of so far

<?PHP
$arrayval = "1,3,2,7,4,6,8,15,12,78,96,1203,1029,39509,12999";
$array = array($arrayval);
echo $array[1],$array[3],$array[2],$array[5],$array[6],$array[4],$array[7],$array[9],$array[5],$array[10],$array[13];
echo "<hr>";
echo $arrayval;
echo "<hr>";
$sum = $array[1]+$array[3]+$array[2]+$array[5]+$array[6]+$array[4]+$array[7]+$array[9]+$array[5]+$array[10]+$array[13];
echo $sum;
?>

View Replies !
Store Array In Session
i store my shopping carts items in an array in a session like this Code:

View Replies !
What's The Best Way To Store An Array In The Database
I am trying to build a simple tree menu where the main items can be either a link or open up a subList of items which themselves can belinks or open into more submenus and so on.
An example is:

$ar = array(
'new_user' => 'newuser.php',
'tst1' => array(
'subtst' => 'subtstlink.php',
'subtst2' => 'sublink2.php'
),
'heyhey' => 'heyhey.php',
);

I am wondering what is the best way to store that in a mysql database (Both the item name and the link to it). Is there any php function that will allow me to make such an array into some sort of variable (String?) which can then be read easilly and made back into the array for manipulation and creation of the tree menu?

View Replies !
How To Store Array In Cookies?
I try to store array in cookie this way:

for($i=0;$i<5;$i++)
{
    $field[]='test'.$i;
}
$_COOKIE['field2']=$field;

Is it possible do it that way? I don't want to store each value of array list store separately. I'd like to store them at once. If I was storing values just to another "normal" variable (not cookie), I would do it this way: Code:

View Replies !
How Do You Store An Sql Result In A Php Array?
How do you store an sql result in a php array? The array will hold, the following fields; itemid, itemname and itemdesc. I would then require, depending on the user selection to query the array by itmeid, and return the itemname.

View Replies !
Store Variable In An Array
so i have a query that returns a bunch of rows.... i display the contents of the query into a table... one of the variables that the query returns is $title....

after each row is returned im wanting to store the $title variable into an array, so i can then access that array later... here is my code for storing $title into the array Code:

View Replies !
Store An Array In A Text Document
I want to store an array in a text document. what I've been doing so far looks like this:

fputs( $myFile, $myArray );

but all it does is write the word "Array", instead of the actual array. I'm new to php and I've done my best to search the manual and numerous web resources (including this forum) for an answer, so please don't flame.

View Replies !
How To Store Checkbox Values To An Array?
I need to allow the user to select multiple mysql records via an html form checkbox.  On submission of the form I would like to store these values in an array for either multiple record deletion or creating a list of records. Code:

View Replies !
Four Fields That Are Dates, Store As An Array
I have a form that has over 100 fields. I have four fields that are dates that I would like to store as an array. When I submit the form I place the dates in the array like so:

$planworkdate = array("mon" => $planworkdate0,"tue" =>$planworkdate1,"wed" =>$planworkdate2,"thu" =>$planworkdate3);

and insert into mysql database. When I try to retrieve the data I get the word Array for the result. What am I doing wrong?

$query = "SELECT planworkdate from general";
$resultall = mysql_query($query);
$planworkdate=mysql_result($resultall,$x,"planworkdate");

print $planworkdate; ...

View Replies !
Take All The Results From A Query And Store Them In An Array
trying to get my head around arrays, and I want to take all the results from a query and store them in an array so that I can use them  for later use: Code:

View Replies !
Store Form Fields To An Array
i have a form which consists of several fields for name, address, number etc. i use a php form to process this and output it onto a html form. the thing is, i'd like to store the information in an array. so for each user, the array will have their details. and this can be printed on the screen. can you tell me how this is possible. i have seen examples of arrays, but the values are assigned to the variables already.

View Replies !
Store The Entire Table In A Two Dimensional Array
I am reading info from a tab-delimited text file and I was wondering if anyone knew how to get this concept to work. I am trying to store the entire table in a two dimensional array, but the way I'm doing it right now won't work.

for($i=0; $i<$numrows; $i++)
{$columnsvalue[i] = explode(" ",$newfile[i]);}

does anyone else know how to better work with multi-dimensional arrays?

View Replies !
Mysql_fetch_array Way To Pull Out All The Data, Store It In An Array
I have a webpage which runs repetitive queries agaist a database in order to extract one item at a time and then put the items in an HTML table. The reason for this is formatting, plus the page hits 4 databases.

Instead of running multiple queries pulling one item at a time...is there a way to pull out all the data, store it in an array, and then pull individual items from the array with php as I want to insert them in the table? So, example is Code:

View Replies !
Variables To Store (Name,Species,Sex) Inside An Array
In PHP, is there anyway of using variables to store each piece of information (Name,Species,Sex) inside an array. Then, when it comes to fetching the information, the array position (e.g. 0) is called along with the information type (Name etc). A bit like the following: record(1).name The information is coming from the record array, at position 1 displaying names.

View Replies !
Store While Statment Data In Array Using Session And Retrieve?
I wish to store retreve value from my sql using session array and retrieve this value.
here is my while statement, which is displaying records from my database. I want to store all this value in an array using session and than retrieve this value on click of the table row. Code:

View Replies !
Array Problem - Extract And Store In Seprate Variables .
I have an array from a program of the type $list_box_contents[$row][$col]['text'];
 There are 3 columns  and an indefinite no. of rows.

Each array element contains a few bits of information. I want to to extract this and store in seprate variables .

$list_box_contents[$row][2]['text']; has 2 bits of information, a price and a small text box with some text. How can extract the price data from this .

View Replies !
Store The Selected Checkbox Values In A Variable Or An Array?
how to store the selected checkbox values in a variable or an array?

View Replies !
Array Problem... - Store This List In $_SESSION['liste'];
the user selects 6 numbers in a list I have to store this list in $_SESSION['liste']; (I cant do it differently) the list is stored like that: 34-21-44-32-12-11 (cant do it differently either)

what I need to do is to explode the array, get rid of the - , sort the values in ascending order and send them to my table as a string. so in the end I should have: 111221323444

I tried using a variation of laserlight's script (given in a previous post) without success... hope that someone will have time to give me a hand again in telling me what I could change in saberlights script to make it work.

View Replies !
Explode - Open File Store The Numbers In An Array
I have a .txt file looking like this

3
4
56
23
59
10

i want PHP to open that file and store the numbers in an array something like this

$q = "3,4,56,59,10"

Now i want to read $q and see if it contains 56 and 10 (it does) Code:

View Replies !
MySQL Store
Does anyone have a link to a good tutorial for a PHP/MySQL store that uses PayPal?

View Replies !
Store Password In A MySQL DB
Im doing a site in PHP3 and MYSQL. this site has a customers area. The question are:

Which is the best way to store the pass in the database but encrypted? Should i use md5 or does anyone knows a better script to encrypt the pass.

View Replies !
Store Images Into Mysql?
i'm wondering is it possible to store image (jpg) into mysql? (not talking about url of image, just image)

View Replies !
Store In MySQL Or Files
I'm creating a page which downloads some data from some other websites
and then processes it. I was wondering if it was better practice to
store the data in SQL Blob fields or temporary files.
For a rough approximation we're talking about approximately 10,000 15kb
files.

View Replies !
Store Images In MySql?
I am working on a CMS for small web site, I am using 2 images in the product template (banner / thumb nail). Can i store image in a database? or Should i just mention the 'path"?

View Replies !
Store And Retrieve In/from MySql Using Php
Can anyone give me a script which can store information using a form (about 10 fields) into a database and then show the result in another page. This is for a survey. I just need a simple script which can store and retrieve.

View Replies !
Store The BB Code In Mysql
When using BBcode in things like private messages, or comments. is it better to store the BB code in mysql, and then when the private note is read, replace all the BBcode with html? or is it better to convert all the bbcode to html and then store that in the database?

View Replies !
Store The Image Into The MySQL.
is there any tutorial/coding/free tools available in the internet to help me develop my website.basically i want to make user can upload their image but i want to store the image into the mySQL.

View Replies !
Store SESSIONID Into MYSQL
Id like to store for statistic purposes the SESSIONID into a stat table in MySQL. I know the session id is a 32 chars string, so i shoul duse a varchar(32) column type. Do you know if it is possible to save this in some different way. eg HEX number to save space on mydatabase?

View Replies !
Store An Image In A Mysql DB
Can You store an image in a Mysql DB and if so is it worth it?

View Replies !
Best Way To Store Info In MySQL
I'm creating a site where members can create their own photo galleries, and I'm going to use mysql to organize the photos.

What's the best way to store the photo gallery information in the database? Should I create one table per user's gallery (many tables, each with a few rows),

or should I create a single table where all of the photo records will be stored stored, with a column linking each photo to a user (one table with lots of rows)? What's the best way to do this? Does it even make a difference?

View Replies !
Store Sessions In MySQL Database.
I would like to use the PHP session feature, but instead of storing the session data in a file, I would like it to save it in a MySQL database. Is this possible?

View Replies !
How To Store An Image In Mysql Database
How to store an image(gif or jpg files) in mysql database?
Can u give me the code for that??

View Replies !
Uploading Images, Store It In MySql
Im a beginner in PHP and need help in:
- uploading images, store it in MySql, and how to display it on the page.
- categorized the products (ie. guitar, drums, etc.)

Basically, I have a table named "cms_products" with fields prd_title,
prd_description, prd_img, prd_id, prd_price, prd_stock, prd_category

Im not sure if Im going to make another table for the category and image.
Your help is very much appreciated.....

View Replies !
Store/display Images To/from Mysql Using Jsp?
I was looking for a solution on how to store images and display them from Mysql database using jsp or servlet.

View Replies !
Use PHP And Store The Messages In A MySQL Dataqbase.
Im trying to create a forum on my website. I use PHP and store the
messages in a mySQL dataqbase. Messages can be entered in a textarea.
What should i do to prevent that user enter code (javascript or php or
mysql or ...) that can be executed when i show a message with html? Is
it enough to use htmlspecialchar()?
Any tips?



View Replies !
Store Image Path In Mysql
I was wondering if anyone could tell me how to go about uploading an image in php (i know the form code ok) it's just when it comes to storing the path into mysql database ...

View Replies !
Store Tamil Font In To Mysql
i want to store tamil font in to mysql. i know how to store. but  when i send data to mysql then it automatigaly changed the datas. how i stored other language datas.

View Replies !
Store Image Location In Mysql
I'm looking for a solid way to store an image location in mysql. I've been throwing different ideas around all day and nothing is striking me.

I'd like to be able to view the image again later so saving the full path is troublesome and I definitely don't want to save the full url - better if it's all in variables for when I switch servers.

What are some good ways (or a standard way?) to do this? Hope this makes some sense.

View Replies !
Store The Mysql Unique ID Using The $_SESSION?
Is it safe to store the mysql unique ID using the $_SESSION? Also, how can I destroy a session once the user Click X cancel on the top right hand corner of explorer? I meant I dont want to destroy session while the user is on my page doing their work. I want to destroy the session only when they click that red X cancel.

View Replies !
Automated Store Txt File In MySQL
Is there an effeceint way to store a txt or html file into a table and update once every hour or half hour, the file is only a small document and is accessed by a URL.

View Replies !
Store Encrypted Passwords In A Mysql Table.
i want to store encrypted passwords in a mysql table. what is a good recommendation on how to encrypt them. currently i'm using the mysql password() function, but i'm running into problems with spaces.

if a username=test
and password=joe

it still allows password=' j o e '

with any amount of spaces ANYWHERE in the password as long as the string has the correct password text ....i.e. the j, the o, and the e in the correct order.

wtf is up with that? what the hell is the point of the password() function, if it doesn't care about spaces? am i missing something here? if i am, i would love to be helped out, otherwise i'm going to have to use a php encryption method instead of mysql.

View Replies !
Encrypt Passwords To Store In A MySQL Database
I need to encrypt passwords to store in a MySQL database, can anyone please help. It doesnt matter where the encryption occurs (MySQL or the PHP script), but I need to do it! Any examples of code, or helpw ill be great.

View Replies !
Store Images In MySQL And Use Them In Html Files
Does anybody know how to store bitmap data (jpg or png files) in a MySQL table and how to call those files in dynamic php3 generated web pages: I'd like to build an articles database with a jpg file for each article. Data (images and articles) are updated by registred users via a form.

I've found many articles and tips explaining the way to store such bitmap data in a MySQL table, but nobody seems to explain how to get the files from the table and put them in a html file………

View Replies !
Image Upload Store Reference In Mysql Db
The problem I am having, is that the image is never uploaded and no error is generated. Also the record is never inserted into the databae either. What am I doing wrong?

here is my code..... also, the very bottom line which displays a link, never gets rendered to the browser leading me to believe there is an error but I can't see what it is....

I am hosting this site on yahoo servers and am not sure if perhaps there is a permissions issue on the target forlders? But why won't the query insert records into the database either? Code:

View Replies !
Store Images In Mysql And Create Thumbnails
how to store images in mysql and how to create thumbnails for those images?

View Replies !
Store A Download Date In A MySQL Database
I need to store a download date in a MySQL Database when a user makes an order,and check to see if that download date has expired when the user logs in in the future. What would be the best way to do this? timestamp?

Is there a PHP function that can anaylze the timestamp (or some sort of date string) and check to see how much time is left? Example: User orders download access for 24 hours - Comes back 5 hours, 20 minutes later - It should tell him that he has 18 hours fourty minutes left.

View Replies !
Store Image Path/data Mysql
I've got this horribly nasty code that just won't work. It's a profile creator for a "featured band" type of situation. It's supposed to take the image, store it in a directory as well as pass the image path to mysql along with the details from the form.

It uploads the image to the right directory and the textfields are entered fine, but I don't know why it's not storing the image path to mySQL. Can someone clarify things for me?? Code:

View Replies !
Trying To Store And Retrieve Formatted Text From MYSQL
I am trying to store formatted text (windows format) into a MySQL
database and then retrieve it. The field in the database is a
varchar.

I cut and paste the test into a form field formatted, then
call the PHP program to add the record using POST. When I get the
text out, it has lost it's formatting. Formatting in the text is
achieved by multiple spaces not tabs, but even multiple spaces are
converted to a single space and the carrage return/line feeds are
lost. Below is the basic code I am calling when I click POST in the
form. Code:

View Replies !

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