How to populate a CB Field with a Country List

14 years 9 months ago #100835 by babersix
I Tried to do it but I became this error:

Error

consulta SQL: Documentación

SELECT *
FROM `jos_comprofiler_field_values`
WHERE 1 `fieldid``fieldtitle``ordering`
LIMIT 0 , 30

MySQL ha dicho: Documentación
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`fieldid``fieldtitle``ordering`
LIMIT 0, 30' at line 1


Please somebody help me, I dont use usually Phpmyadmin and I dont speak usually english, for me is dopel difficult!! please help me :pinch:

Please Log in to join the conversation.

14 years 8 months ago #104992 by ichat
the thing i find strangest to this all is that the author forgets to mention the str replace functions for people to be abled to insert field id's -

also its not verry hard to insert contry flags,

you'd just have to add a folder to your webroot like

/img/contryflags (or something simular)...

and create the icons like english.ico dutch.ico french.ico (or gif if you prefer)...

and add somthing like
<img src=/img/contryflags/$contryname /> within the loop that pulls the list from your db...

of caurse these ar all made up ... YOU are responseble to find the right code to actually do the job... ...

Please Log in to join the conversation.

14 years 8 months ago #105478 by strangefruit
Replied by strangefruit on topic Re:How to populate a CB Field with a Country List
I know this is old but could someone please breakdown and explain the SQL used/required in the country-list and for general insertions into new CB fields.
I get the first part in quotes and can see the fieldid is "63" and sorting starts with the "1".

"INSERT INTO `jos_comprofiler_field_values` VALUES" (21 ,63,'Afghanistan', 1 ,0);


TIA

Post edited by: strangefruit, at: 2009/07/20 09:40

Please Log in to join the conversation.

14 years 7 months ago #108488 by malocardo
Hi All

I am new to the forum and I am hoping to find more information about how to work around the comprofiler_field_values structure of CB.

Like many of you, my site requests users to provide the country/state/city of their residences. In addition to the registered users, I also have venues that require addresses and locations and for these data, I use tables (country/state/city/venue) external to CB. When a user needs to select a location, he would first choose the Country in a drop down menu, and then the State drop down will be populated with the appropriate choices, and when a State is picked, appropriate City choices will populate the City drop down menu, and then venues in that city will then be presented in a following drop down menu. This is a very common practice and users have little tolerance for anything less.

Regretably, however, the country/state solutions based on CB's comprofiler_fields and comprofiler_fields_value structure seems to restrict the possibility of assigning relationship among the countries and states, thus I am convinced that the aforementioned "intelligence" can NOT be built into with CB with its existing structure. Any thoughts?

If that is the case, then I would have to bypass comprofiler_fields_(values) structure and have CB query external tables for country/state/city and use external JS script to control the menu update. Has anyone done this before? Is this practical or just plain suicidal? Any recommendation on where to start?

Many thanks for your inputs.

SH

Please Log in to join the conversation.

14 years 5 months ago #114728 by e1enterprises
Replied by e1enterprises on topic Re:How to populate a CB Field with a Country List
Since this was originally written in 2005 things have changed a bitin phpmyadmin. When you click on jos_comprofiler_field_values, or whatever the table is called on your db, the "Insert data from a text file into the table" link no longer exists. Instead, you will need to to do the following:

After clicking on the previously-mentioned table, click on the Import tab at the top in the right panel. You will see where you can click Browse to locate the country_list text file. After you do that scroll down and click on the radio button next to "CSV using LOAD DATA".

The only thing you need to change is in the textbox next to "Column names" you should either type or paste in the following:

fieldid,fieldtitle,ordering

Click the "Go" button and that's it. It should say that it was successful. Basically the same procedure for the State as well.

It would be nice, though, if this came prepopulated. I know of many that have never even heard of phymyadmin more or less how to use it.

Please Log in to join the conversation.

14 years 4 months ago #115437 by romannumeralus
Replied by romannumeralus on topic Re:How to populate a CB Field with a Country List
I agree that some of these fields should just be pre-populated. However, I have a problem. I've successfully imported lists before, but I can't figure out how now. Something seems to have changed because when I go to import the list with the CSV using LOAD DATA format, and I follow the directions you have listed, I get the following error:

Error

SQL query:

LOAD DATA INFILE '/tmp/phpQJl5ua' INTO TABLE `jos_comprofiler_field_values` FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'(
`fieldid` , `fieldtitle` , `ordering`
)

MySQL said: Documentation
#1045 - Access denied for user 'XXXXXXXX' (using password: YES)

But I'm in the db and using it. How can my access be denied? All in all, it will not allow me to import the list. And I've substituted X's for my actual db name. Please help!

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.568 seconds

Facebook Twitter LinkedIn