What's the notation to add data from a variable to existing data in a field?
mysql_query("UPDATE stk SET some_field = '????????????' WHERE id = " . $upc_key . "") or die(mysql_error());
What's the notation to add data from a variable to existing data in a field?
mysql_query("UPDATE stk SET some_field = '????????????' WHERE id = " . $upc_key . "") or die(mysql_error());
Use MySQL's CONCAT() function
To add data at the end of existing
mysql_query("UPDATE stk SET some_field = CONCAT(some_field, '????????????') WHERE id = " . $upc_key . "") or die(mysql_error());
To add data at the start of existing
mysql_query("UPDATE stk SET some_field = CONCAT('????????????',some_field) WHERE id = " . $upc_key . "") or die(mysql_error());
That worked. Just needed to escape the double quotes.
Thanks mwasif.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.