-
IAL32.
User deleted
Quando apro la pagina store.php, mi esce il seguente errore: CODICEFatal error: Call to a member function query() on a non-object in /membri/theultimatepts/members/store.php on line 4
Ecco il codice:CODICE<?
$includes[title]="Point Store";
$sqlDB=$Db1->query("SELECT * FROM store_items WHERE active='1' and qty>0");
if($Db1->num_rows() > 0) {
while($item=$Db1->fetch_array($mysqlDB)) {
$list.="
<tr class=\"tableHL3\">
<td height=5 colspan=2></td>
</tr>
<tr class=\"tableHL2\">
<td nowrap=\"nowrap\" width=\"100\">
<small>
Quantity: $item[qty]<br />
".iif($item[points]>0,"Point Cost:</b> $item[points]<br />")."
".iif($item[cash]>0,"Cash Cost:</b> $item[cash]<br />")."
<a href=\"index.php?view=account&ac=buy_item&id=$item[id]&".$url_variables."\">Purchase Item</a>
</small>
</td>
<td>
<b>$item[title]</b><br />
".nl2br($item[description])."<br />
</td>
</tr>
";
}
}
else {
$list="<tr class=\"tableHL2\"><td><b>There are no items in the store right now. Please check back frequently!</b></td></tr>";
}
$includes[content]="
Welcome to the point store. Here you can purcase items using your account balance and points!
<table cellpadding=1 cellspacing=0 class=\"tableBD1\" width=\"100%\">
<tr>
<td>
<table width=\"100%\" cellpadding=0 cellspacing=0>
$list
<tr class=\"tableHL3\">
<td colspan=2 height=5></td>
</tr>
</table>
</td>
</tr>
</table>
";
?>
L'errore me lo da nella linea 4, cioè qui:
$sqlDB=$Db1->query("SELECT * FROM store_items WHERE active='1' and qty>0");
Grazie. -
.
Come crei $Db1? . -
.
Devi creare l'oggetto $Db1, e possibilmente dichiarare $includes come array prima di farne uso. . -
IAL32.
User deleted
L'oggetto $Db1 è già dichiarato(come global), così come $includes: CODICEfunction get_userid_from_session($sessid, $sessid2, $uid) {
global $vip, $Db1;
$mintime = time() - 36000;
// AND (remote_ip = '$vip')
$sql = $Db1->query("SELECT user_id FROM sessions WHERE (sess_id = '$sessid') AND (sess_id2='$sessid2') AND (user_id='$uid') and (remote_ip='$vip' or ipvoid='1')");
$row = $Db1->fetch_array($sql);
return $row[user_id];
}
function update_session_time($sessid, $sessid2) {
global $Db1;
$newtime = time();
$result = $Db1->query("UPDATE sessions SET start_time='$newtime' WHERE (sess_id = '$sessid') AND (sess_id2='$sessid2')");
return 1;
}. -
Alchimist.
User deleted
Devi dichiararlo global sia all'interno che fuori la funzione (o le funzioni). Manca un pezzo di codice, quindi non so se tu l'abbia fatto... .