PDA

View Full Version : Quick code check


manguish
Sun 2nd Jan '05, 1:20pm
I've wrote this to delete the porn referral statistics on my site.


<?php

$DB_site->query("DELETE FROM `statistik_referer` WHERE `Referer` LIKE '%porn%'");
$DB_site->query("DELETE FROM `statistik_referer` WHERE `Referer` LIKE '%incest%'");
$DB_site->query("DELETE FROM `statistik_domain` WHERE `domain` LIKE '%porn%'");
$DB_site->query("DELETE FROM `statistik_domain` WHERE `domain` LIKE '%incest%'");

?>

Just a quick cjeck - i know it works, but is there a better(?) way to write it instead of having 4 $DB_site->query. Make it into 1 query? Dunno

Just for my own curiosity ;)

Zachery
Sun 2nd Jan '05, 1:24pm
Your going to require calling vB's global before that will work so you know ;)

manguish
Sun 2nd Jan '05, 1:27pm
It runs fine mate?

I've added it anyhoo - but it ran no problems without it. As did a couple of other litlle cron jobs i wrote for various jobs in the forum.:confused:

Zachery
Sun 2nd Jan '05, 1:29pm
$DB_site->query(

Thats part of a class inside of vBulletins files, you can't just use $DB_site->

manguish
Sun 2nd Jan '05, 1:31pm
Odd - as i said i added it as you know better ;)

It did work though and so did a couple of others as i said - dunno.

Nothing to do with it being within includes/cron?

Icheb
Sun 2nd Jan '05, 1:32pm
$DB_site->query("DELETE FROM `statistik_referer` WHERE `Referer` LIKE '%porn%' OR `Referer` LIKE '%incest%'");
$DB_site->query("DELETE FROM `statistik_domain` WHERE `domain` LIKE '%porn%' OR `domain` LIKE '%incest%'");

manguish
Sun 2nd Jan '05, 1:34pm
Thanks - i knew there'd be another way to do it ;)

Always like to learn ;)

Zachery
Sun 2nd Jan '05, 1:34pm
Oh your running it as a cron ;) ok

manguish
Sun 2nd Jan '05, 1:39pm
So cron doesn't need it then?

EDIT : apparantly not. It doesn't work with it in lol......