Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

PHP: $_POST[] problem

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
thanks I got it fixed on my own
 
0
Close
Get the value in another variableand then insert it in the query.

Thanks.
 
0
Close
Appraise.net

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back