Page 1 of 1

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

Posted: Wed Aug 22, 2007 5:07 pm
by simoegio
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

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

Posted: Wed Aug 22, 2007 5:49 pm
by Chris Davenport
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.

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

Posted: Wed Aug 22, 2007 6:25 pm
by simoegio
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