The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DB insert and charset
#1
Hi,

I have a 'trading name' input box and if the '&' symbol is entered, this is written to the database as '& amp;'.
I then run a check that if the current value doesn't match what's in the DB, update the entry.
Currently it always thinks that they don't match (even though the do if I dump the variable).
If I update the & amp; to &; in phpMyAdmin the issue goes away.
Is there a way I can force either the insert or update classes to write it as & rather than '& amp;'?

Hope that makes sense,

Cheers
  Reply
#2
I've worked around this by us the below:

Code:
$trading_name = str_replace("&(amp)","&",$trading_name);
  Reply
#3
Thanks for posting your workaround, Matt!

I think a better solution would be to allow the DB to insert the special character value (&amp) and on your comparison, use htmlspecialchars.

http://php.net/manual/en/function.htmlspecialchars.php
  Reply
#4
Thanks, took of couple of extra lines to create additional variables but have now taken that approach Smile
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)