Skip to main content
Known Participant
May 24, 2010
Question

PHP & MySQL insert question

  • May 24, 2010
  • 2 replies
  • 390 views

I have a form that is inserting a selected color (e.g., #663300).  I want to insert the value into the database without the "#".  How do I delete that and just insert the actual numbers into the database?

This topic has been closed for replies.

2 replies

June 1, 2010

Let's say your color code is in $color_data variable:

INSERT INTO color_table(color_code) VALUES(SUBSTRING('{$color_data}', 2))

May 24, 2010

I just did a quick search on google for php strip characters and found some intersting results.