Hele
|
| Posted: 05/31/2005, 3:47 PM |
|
Hello!
I have a project desing with code charge, it works good. Now I want to add to the project a page desing only with php and html.
How do I make the db connection works. I using this sentence and it dont work good:
$Mensaje="";
$db = new clsDBdb1();
$db->query("Select CUENTA, NOMBRE from CLIENTES");
while ($db->next_record())
{
$Mensaje = $Mensaje . $db->f("CUENTA") . "<br>\n";
$Mensaje = $Mensaje . $db->f("NOMBRE") . "<br>\n";
The project in code charge use the connection clsDBdb1.
I think the connection working good but the sql query doesnot.
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 06/01/2005, 5:21 AM |
|
Hello,
Have you added include directive for Common.php into your custom .php file?
_________________
Regards,
Nicole |
 |
 |
Hele
|
| Posted: 06/01/2005, 7:35 AM |
|
Thanks Nicole for responding.
Yes, I have include the common.php.
What else you think i can change to make it works??
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 06/02/2005, 2:47 AM |
|
Do you get any errors/warnings on a page? Did you try to output $Mensaje or field values from $db->f()? What values are returned?
_________________
Regards,
Nicole |
 |
 |
ju2au
Posts: 7
|
| Posted: 06/02/2005, 5:09 PM |
|
Maybe you need to add the term
global clsDBdb1;
|
 |
 |
Hele
|
| Posted: 06/03/2005, 9:42 AM |
|
Tkanks!
Where should I add the term global clsDBdb1?? In then php page or in the Code Charge Project?
I tried it in the php and it does'n work.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 06/03/2005, 6:42 PM |
|
Hele,
I haven't tried doing what you asked about and therefore I don't know the answer, however it could be easier for you to create just a new connection in your PHP program and don't even use any CCS functions.
You can find some examples of connection to a database from PHP at: http://us2.php.net/function.mysql-connect http://www.w3schools.com/php/php_db_odbc.asp http://www.webestilo.com/en/php/php07b.phtml
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Fishertoy
|
| Posted: 07/23/2005, 11:15 AM |
|
Hello, I had the same need, and the thing I did was to put a grid with the connection I wanted, no matter what table to pick for it, then hide it with the before show event, then use CC functions to show some data.
|
|
|
 |
Nicole
Posts: 586
|
| Posted: 07/25/2005, 5:04 AM |
|
Hello,
As I understand you just need a database connection object. There’s no need to add fake grid to a page, here is sample code for creating a new connection class instance
$db = new clsDB<connection_name>();
_________________
Regards,
Nicole |
 |
 |