Re: recursion in php and mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,
        You can use class like the following code .:)

<?php
      require ("mysql.class");
      $conn = new MySQLConnection ($user, $password, $host,$database);
      .......
      .......
      $query1 = new MySQLCommand ($sql1, $conn);
      $query1->Execute();

      $query2 = new MySQLCommand ($sql2, $conn);
      $query2->Execute();
      ......
?>




"Micah Stevens" <micah@xxxxxxxxxxxxxxxxxx>, haber iletisinde sunlari 
yazdi:45E862E6.3090305@xxxxxxxxxxxxxxxxxxxxx
> Classes are overrated. :)
>
> Bastien Koert wrote:
>> you could make the connection variable global, but the best bet here
>> is to use a class and create a db object that your functions could call
>>
>> Bastien
>>
>>
>>> From: Ron Croonenberg <ronc@xxxxxxxxxx>
>>> To: php-db@xxxxxxxxxxxxx
>>> Subject:  recursion in php and mysql
>>> Date: Thu, 01 Mar 2007 23:52:54 -0500
>>>
>>> Hello all,
>>>
>>> I wrote an app in php and it uses recursion.
>>>
>>> Problem I have is that when I connect to a database using
>>> mysql_connect($dbhost, $username, $password); and select a table with
>>> mysql_select_db($database) I cannot access the table anymore from some
>>> function.
>>>
>>> Now I can connect and select a database in that php function  but that
>>> means that process happens A LOT and connecting and selecting everytime
>>> probably slows down the app quite a bit
>>>
>>> Is there a way to connect to a database and select a table "globally"
>>> so that I have access to it in ever php function I write ?
>>>
>>> thanks,
>>>
>>> Ron
>>>
>>> -- 
>>> PHP Database Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>> _________________________________________________________________
>> Find out the restaurants participating in Winterlicious
>> http://local.live.com/default.aspx?v=2&cp=43.658648~-79.383962&style=r&lvl=15&tilt=-90&dir=0&alt=-1000&scene=3702663&cid=7ABE80D1746919B4!1329
>> From January 26 to February 8, 2007
>>
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux