OK, so really complicated title, let me explain.
I'm trying to insert SQL queries into my SQL database, e.g.
INSERT INTO sample_db(query) VALUES ('SELECT * FROM users WHERE id={$userID}')
Then later on from another PHP file I'll do something like this:
mysqli_query($queryfromabove);
The problem is the PHP variable does not get passed through. (it exists in the file I call it from) I know this is highly unorthodox, and probably not recommended, but is there any way anyone knows of to do this?
As requested here's the actual code:
$sql="INSERT INTO awards(name,image,query,clm,type,number) VALUES ('".$_POST['name']."','".$_POST['image']."','".$_POST['query']."','".$_POST['column']."','".$_POST['condition']."','".$_POST['number']."')";
mysqli_query($conn,$sql);
I've echoed all of the POSTS and know they have the proper data. The important POST variable here, is $_POST['query'] because it contains:
SELECT * FROM crts WHERE id='$crtid'
Then, from another file (excuse the sloppy variable names, this is a WIP):
$that = mysqli_fetch_assoc(mysqli_query($conn,"SELECT * FROM awards WHERE id=2"));
echo $that['query'].'<br>';
$crtid = $_SESSION['crt']['id'];
$query = $that['query'];
$thisquery = mysqli_query($conn,$query);
$finally = mysqli_fetch_assoc($thisquery);
print_r($finally);
ID 2 is the id of the sql result that I inserted with all the posts.
$queryfromabove = 'query';