With 2 Database (Joomla + Data) insert don't work

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
simoegio
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Dec 13, 2006 12:51 pm

With 2 Database (Joomla + Data) insert don't work

Post by simoegio » Wed Aug 22, 2007 5:07 pm

hello..
i create my personal component to manage data in a second DB different that joomla's DB to create for example a second registration for the users.
i have create a mycomponent.html.php page and mycomponent.php page..
in the html page where are some forms and when i send forms i want that mycomponent.php register data like a normal registration..

when i read for example the text of the name form after i must insert this in my Data DB..
my code is this..

Code: Select all

      $connessione = mysql_connect($host, $userSQL, $pswSQL);
      mysql_select_db($nameDB, $connessione);   


and after i want write the insert etc..

but the second line of my code (mysql_select_db($nameDB, $conne

Code: Select all

ssione);)  create an error:

[code]Warning: Invalid argument supplied for foreach() in d:\programmi\easyphp1-8\ww[/code]w\wgeb\includes\frontend.php


why??
is correct that i use syntax "mysql_select_db" to create a second comunications to a new database or i must use another syntax??

thank you

User avatar
Chris Davenport
Joomla! Intern
Joomla! Intern
Posts: 95
Joined: Thu Aug 18, 2005 8:57 am
Location: Shrewsbury, Shropshire, United Kingdom

Re: With 2 Database (Joomla + Data) insert don't work

Post by Chris Davenport » Wed Aug 22, 2007 5:49 pm

In general it is best to try to use the API rather than calling the MySQL PHP functions directly.

Take a look here: http://dev.joomla.org/component/option,com_jd-wiki/Itemid,/id,references:joomla.framework:database:jdatabase/

Regards,
Chris.
Joomla! Core Team Member | Documentation Working Group Coordinator

"Reality is merely an illusion, although a very persistent one" - Albert Einstein
"We are suspended in language such that we don't know what is up and what is down" - Niels Bohr

simoegio
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Dec 13, 2006 12:51 pm

Re: With 2 Database (Joomla + Data) insert don't work

Post by simoegio » Wed Aug 22, 2007 6:25 pm

i find the error...

i had use first letter of the username SQL in capital (Users) but if i use normal letter (users) the errors don't appar..
i don't know why..

bye


Post Reply