Dynadot โ€” .com Registration $8.99

PHP: $_POST[] problem

Spaceship Spaceship
Watch

dcgamers

Established Member
Impact
1
I am normally a very good php user but that's relative.

I am tring to make a system where you upload multiple things to a mysql database. Here is an example of the code:
PHP:
$query = "INSERT INTO images VALUES (\"\", \"$_POST['title$num']\", \"$_POST['description$num']\" ) ";
Yet this brings me to this:
Parse error: parse error, unexpected T_VARIABLE, expecting ']' in ****

Obviously it's the _POST[] variables with a sub variable. I am told that I could do that but when I remove the ' marks then another error shows.

also seen on sitepoint
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Code:
$query = "INSERT INTO images VALUES ('', '\'' . $_POST['title' . $num] . '\'', '\'' . $_POST['description' . $num] . '\'')";
 
0
•••
thanks I got it fixed on my own
 
0
•••
Get the value in another variableand then insert it in the query.

Thanks.
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back