Page 1 of 1

[SOLVED] Storing values in MySQL for later use

Posted: Thu Mar 24, 2005 6:14 am
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.

Posted: Thu Mar 24, 2005 6:40 am
by CoderGoblin
Normally you would use sessions or some form of general purpose table.

Posted: Fri Mar 25, 2005 4:32 am
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.

Posted: Fri Mar 25, 2005 5:47 am
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

Posted: Sat Mar 26, 2005 1:54 pm
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

Posted: Sat Mar 26, 2005 10:05 pm
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.