feha
Posts: 712
|
Posted: 01/25/2004, 2:42 PM |
|
I'm porting now my function for visits counter to CCS.
However I do have a problem to make some native MySQL functions CCS compatible...
example:
$arr_counter_this_week = mysql_fetch_array($get_num_visits_this_week);
problem is with mysql_fetch_array function it works but i want to
use SQL functions compatible to CCS ...
This function when ready will be availble on my site for free to all CCS users ...
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
sebastian
Posts: 15
|
Posted: 01/26/2004, 10:09 PM |
|
Hi feha,
You can use CCDLookUp() function or $dao->query() method to retrieve any value from the database.
Sebastian
|
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 1:12 AM |
|
Thank You Sebastian Yes it works.
There is for example:
mysql_fetch() as $db->f()
mysql_num_rows() as $db->num_rows()
i was looking for
mysql_fetch_array() ?
I do use CCDLookUp() for counting items in subcategory ...
Thank You
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 1:20 AM |
|
Here is link to the source code of my counter
http://www.vision.to/vision/modules/Homepage_MOD/main.php?page_id=24&cid=6
It was made for CC and works ok ...
(Soon comin function for CCS)
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
hidran
Posts: 29
|
Posted: 01/27/2004, 3:46 AM |
|
Take a look at db_mysql.php file and you will see all the member functions of $DBconnectionname so you can see the equivalents to mysql_fetch_array, mysql_num_rows etc.
|
|
|
sebastian
Posts: 15
|
Posted: 01/27/2004, 7:16 AM |
|
feha,
You can use $db->Record, which is an array storing the recently retrieved row, e.g.:
$db->query($query);
if ($db->next_record())
{
$row = $db->Record;
}
Sebastian
|
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 7:40 AM |
|
Yes there is no problem ...
I'm making a function independent from page or other events ...
I need adequate replacement
of mysql_fetch_array();
Anyway it works great even with mysql_fetch_array();
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 7:44 AM |
|
here is sample of SUM ...
//==============================================
//TOTAL NUMBER OF VISITS THIS WEEK
$get_num_visits_this_week = $db->query("SELECT SUM(counter) FROM count_visits WHERE week = '$week_now' AND month = '$mon_now' AND year = '$year_now'");
$arr_counter_this_week = mysql_fetch_array($get_num_visits_this_week);
$visits_this_week = $arr_counter_this_week[0];
//==============================================
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 7:45 AM |
|
now this is for CSS
//==============================================
//TOTAL NUMBER OF VISITS THIS WEEK
$get_num_visits_this_week = $db->query("SELECT SUM(counter) FROM count_visits WHERE week = '$week_now' AND month = '$mon_now' AND year = '$year_now'");
$arr_counter_this_week = mysql_fetch_array($get_num_visits_this_week);
$Tpl->SetVar("week",$arr_counter_this_week[0]);
//==============================================
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 7:45 AM |
|
now this is for CSS
//==============================================
//TOTAL NUMBER OF VISITS THIS WEEK
$get_num_visits_this_week = $db->query("SELECT SUM(counter) FROM count_visits WHERE week = '$week_now' AND month = '$mon_now' AND year = '$year_now'");
$arr_counter_this_week = mysql_fetch_array($get_num_visits_this_week);
$Tpl->SetVar("week",$arr_counter_this_week[0]);
//==============================================
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|
feha
Posts: 712
|
Posted: 01/27/2004, 7:55 AM |
|
Sorry for double post ....
I could use this approach ...
global $DBddd;
$this_week=CCDLookUp("SUM(*) counter", "count_visits ", "week = '$week_now' AND month = '$mon_now' AND year = '$year_now'", $DBddd);
I haven' tested this yet ...
_________________
Regards
feha
www.vision.to
feedpixel.com |
|
|