Było juz trochę tematów związanych z phpAdsNew, ale tematu na mój problem nie było
Mam skrypt filmów z allegro
i po wklejeniu kody wyświetlania wywala mi błędy
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /srv/www/htdocs/web1/html/pages/list.php on line 23
Nie ma żadnych rekordów w tej kategorii.
kod z list.php
<?php
if(isset($_GET['typ'])) { $typ = '`typ` = ' . (int) $_GET['typ'];
}else{
$typ = "((`typ` >= 1 and `typ` <= 4) or (typ = '15') or (typ = '16') or (typ = '17'))";
}
//$typ = (isset($_GET['typ']) ? '`typ` = ' . (int) $_GET['typ'] : '((`typ` >= 1 and `typ` <= 4) or (typ = '15'))');
$cat = (isset($_GET['cat']) ?
' and `category` = ' . (int
) $_GET['cat'] : ''); $order = '';
if ($_GET['top'] == 1)
{
$order = ' order by `ocena` desc';
}
elseif ($_GET['last'] == 1)
{
$order = ' order by `added` desc';
}
$res = mysql_query('select * from `stuff` where ' . $typ . $cat); // ilosć trafień
$res = mysql_query('select * from `stuff` where ' . $typ . $cat . $order . ' order by added desc limit ' . ((int
) $_GET['currentpage'] * 10) . ', ' . ((int
) $_GET['currentpage'] * 10
+ 10
));
if ($hits == 0)
{
echo 'Nie ma żadnych rekordów w tej kategorii.'; }
else
{
{
if($row['added']>0)
$date = sprintf('<img src="ikonki/dodano.jpg"> Dodano: %s godzina %s<br />', date('Y.m.d', $row['added']), date('H:i:s', $row['added'])); else
$date = (string) '';
$comments_count = (int) 0;
$query = sprintf("SELECT COUNT(*) AS CommentsCount FROM komentarze WHERE stuff='%d'", $row['id']); if($comments) {
$comments_count = $record['CommentsCount'];
}
if($row['miniaturka']!='') {
$image = sprintf('<img src="%s" alt="%s" class="icon" align="right" width="160px" height="120px" border="2" style="border: 1px solid #A20000;"/>', $row['miniaturka'], $row['title']); } else {
$image = '';
}
if(isset($categories[$row['category']])) $cat = sprintf("%s: ", $categories[$row['category']]); else
$cat = (string) '';
printf('<table width="461" bgcolor="#F3F3F3" style="margin-bottom:12px; font-family:verdana; font-size:12px;"><tr><td style="text-align:left; clear:both; padding:0 4px;">%s <strong>%s</strong><a href="index.php?page=display&id=%d" class="stufflink" style="font-weight:bold;"><h3>%s</h3></a><br /><br />%s<img src="ikonki/wykres.jpg"> Ocena: %d<br /><img src="ikonki/wykres.gif"> Wyswietlen: %d<br /><img src="ikonki/trabka.gif"> Komentarzy: %d<br /><img src="ikonki/info.gif"> Zasugerował: %s</td></tr></table>', $image,
$cat, $row['id'], $row['tytul'],
$date,
$row['ocena'], $row['counter'],
$comments_count, $row['login']);
}
}
echo '<div style="text-align: center">';
/********* NUMEROWANIE *********/
$temp = min((int
) $_GET['currentpage'] + 5
, ceil((float
) $hits / 9
.0
));
for ($i = max((int
) $_GET['currentpage'] - 4
, 0
); $i < $temp; $i++) {
print("<a href="index
.php?page
=list
¤tpage
=" . $i . "&cat
=" . $_GET['cat'] . "">" . ($i+1) . "</a>"); if($i == ($temp - 1)) {
print("<a href="index
.php?page
=list
¤tpage
=" . ($temp - 1) . "&cat
=" . $_GET['cat'] . ""></a>"); }
}
/*******************************/
?>
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /srv/www/htdocs/web1/html/index.php on line 148
Zarejestrowanych:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /srv/www/htdocs/web1/html/index.php on line 153
z index.php wycinek kodu, błędy są kolejno w 3 i 8 linij.
<p><b>Wszystkich Filmików:<?php
$res = mysql_query('select count(*) from `stuff` where `typ` <= 4 and `typ` >= 1'); ?></p>
<p>Zarejestrowanych: <?php
$res = mysql_query('select count(*) from `fbw_useradmin`'); ?></p>
<p><b>Wszystkich kategori:<?php
?></b></p>
Za pomoc w rozwiązaniu problemu byłbym wdzięczny.
Ten post edytował kiecol 22.04.2007, 22:41:05