NameSilo

PHP: $_POST[] problem

SpaceshipSpaceship
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.
AfternicAfternic
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
•••
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Live Options
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back