Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP & MySQL insert question

New Here ,
May 24, 2010 May 24, 2010

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?

TOPICS
Server side applications
375
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 24, 2010 May 24, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 31, 2010 May 31, 2010
LATEST

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

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines