[SOLVED] Storing values in MySQL for later use

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] Storing values in MySQL for later use

Post by anjanesh »

Is it possible to store a value in MySQL for later use ?
Pure SQL - no PHP coding.

Code: Select all

a=5;
INSERT INTO `table1` VALUES (a,'test');
Anyway to do this ?
Thanks.
Last edited by anjanesh on Sat Mar 26, 2005 10:06 pm, edited 1 time in total.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Normally you would use sessions or some form of general purpose table.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Need to do this in MySQL console or phpMyAdmin or any other MySQL interface only - no php.
sessions in SQL ? Never heard of it.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

You can try temporary tables in mysql, here is the link.
I haven't used them before so I'm not sure what the limitations are or how long the last, but it might be a start

temporary tables
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

You can declare variables and use them. I have done this before, it seems to be little known but can be handy.

http://dev.mysql.com/doc/mysql/en/variables.html
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Wow. Thanks magicrobotmonkey. Dont know how I missed this.
This is good - its there since ver 3 ! Thought only 5 would have this.
Thanks.
Post Reply