Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Rotator phpbb
sajborg
post
Post #1





Grupa: Zarejestrowani
Postów: 271
Pomógł: 0
Dołączył: 20.08.2003
Skąd: Szczecinek

Ostrzeżenie: (0%)
-----


Siemka robie serwis na phpbb.I mam pewien problem mianowicie mam takie rotator banerów.

[php:1:14e0dc1c07]<?php
$sql="SELECT * FROM homp_baner";
$result=$db->sql_query($sql);
$ile=0;
while ($db->sql_fetchrow($result)){
$ile++;
}
function baner ($typ){
$losowy=rand(0,$ile);
$sql="SELECT * FROM homp_baner WHERE baner_id='".$losowy."' AND baner_typ='".$typ."'";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Nie mogę wyswietlić Banera.", "", __LINE__, __FILE__, $sql);
}
$baner=$db->sql_fetchrow($result);
if ($baner['baner_show']==$baner['baner_show_max']){
baner($typ);
}else{
if ($baner['baner_typ']=='FLASH_'.$typ.''){
return $baner['baner_flash'];
$sql="UPDATE homp_baner SET baner_show=baner_show+1 WHERE baner_id='".$losowy."'";
$db->sql_query($sql);
}else{
return '<img src='.$baner['baner_url'].' border=0 alt='.$baner['baner_alt'].'>';
$sql="UPDATE homp_baner SET baner_show=baner_show+1 WHERE baner_id='".$losowy."'";
$db->sql_query($sql);
}
}
}

?>[/php:1:14e0dc1c07]

Moze nie jest najlepszy ale narazie to testy.I mam problem wszysko by działało gdybym tego nie zrobił jako funcja.Bo jak jest funkcja to taki error jest sad.gif

Kod
Fatal error: Call to a member function on a non-object in g:wwwphpbb.netfunction.php on line 7


Linia 7 to

[php:1:14e0dc1c07]<?php
if(!$result = $db->sql_query($sql))

?>[/php:1:14e0dc1c07]
O co tu chodzi jak to zrobic questionmark.gif


--------------------
Warsztat: gPHPEdit | Linux 2.6.17-11-generic (Ubuntu)
Sprzęt: Noteook BenQ A33E
___________________________________________________
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 06:08