MySQL Forums
Forum List  »  PHP

Trying to return data from fields containing an underscore char
Posted by: Philippe Lévi
Date: December 22, 2020 09:27AM

Hello experts,

Being an (almost) newbie in php, I am facing a probably simple issue which I just can't solve given my limited knowledge there.

I inherited a Joomla website database where a series of fields in a table are like 'name_fr-FR' or 'name_en-GB' etc...
These fields obviously contain various language variants for the same product.

- When I try to load data with, say, "select name_fr-FR from table xxxx" I keep
getting a 1054 error.
- If I do a "select * " I don't get any complaint but when I do
foreach ($products as $pr)
echo $pr->name_fr-FR;

it returns absolutely nothing meaning that either it did not fetch the data or it doesn't want to output it.

I read around that I should kind of escape the _ in the field name but can't figure it out.

Can anyone help me out there?

Thx and happy holidays from Paris, France.

Philippe

Options: ReplyQuote


Subject
Written By
Posted
Trying to return data from fields containing an underscore char
December 22, 2020 09:27AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.