Question: ```
if($band == "something"){
     $que = "BETWEEN '1000' and '2000'";
}

if($band == "somethingelse"){
     $que = "BETWEEN '2000' and '5000'";
}

if($band == "somethingelseelse"){
     $que = "BETWEEN '5000' and '10000'";
}

if($band == "againsomethingelse"){
     $que = "BETWEEN '10000' and '30000'";
}

$query = mysql_query("SELECT * FROM table WHERE col $que order by datetime desc LIMIT 50");

```

Can't seem to find what i am missing here... I want to make the "between" statement into a php variable so it will change the query items with a given input. there are multiple different inputs for different ranges. when I enter the between manually such as (SELECT \* FROM table WHERE col BETWEEN 1000 AND 2000 order by datetime desc LIMIT 50) I have no problems. it dose not work with the variable
This is my first post here so any help is greatly appreciated!

Answer: 
You could save the dictionary as type `TEXT`, so it would be saved as:

```
"{ 'Prem': { 'age' : '23' , 'sex': 'male' } , 'Sameer' : { 'age' : '22' , 'sex' : 'male'} }"

```

You can save this in the database like this:

```
ogdict = { 'Prem': { 'age' : '23' , 'sex': 'male' } , 'Sameer' : { 'age' : '22' , 'sex' : 'male'} }
c.execute('INSERT INTO tablename VALUES ("{}")'.format(ogdict))

```

And then use the builtin python `eval()` funtion to turn it back into a dictionary:

```
c.execute('SELECT * FROM tablename')
dbdict = eval(c.fetchone()[0])

```

Now, the dictionary from the database is saved in the `dbdict`, and you can use it like a normal dictionary, so calling `dbdict['Prem']` will yield the value of `{'age': '23' , 'sex': 'male'}`.
You need two tables.

First for exmpl Persons:

```
id name
1  Prem  
2  Sameer
...

```

Second stored value:

```
id fk_persons age sex
1  1          23  male
2  2          22  male

```

usualy structure is table for dictionary.