Jump to content

[SOLVED] UPDATE table


cliftonbazaar

Recommended Posts

$sql = "UPDATE players
    SET '$adventure['image']'='{$player[$adventure['image']]}'
    WHERE characterName='{$player['characterName']}'";

 

After fiddling with the code I have worked out that '$adventure['image']' is the problem.  What is the correct syntax?  (and yes, the variable is the correct column name)

Link to comment
https://forums.phpfreaks.com/topic/155456-solved-update-table/
Share on other sites

Single-quotes around a value makes it a sql string, not an sql identifier. Remove the single-quotes that are around '$adventure['image']'

 

You also need to put $adventure['image'] inside of {}, like the other php array variables are in that php string.

 

Link to comment
https://forums.phpfreaks.com/topic/155456-solved-update-table/#findComment-818027
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.