Jump to content

MySQL Limit not working !!


balkan7

Recommended Posts

hi i set limit 4 in my litle shopping and just show me 1 not 4, where i wrong whit this ?

index.php
[code]<?
include_once("conn.php");
include_once("lang/english.php");
include_once("includes.php");

include_once("templates/HeaderTemplate.php");

$q1 = "select * from bsoft_catalog, bsoft_categories, bsoft_cd WHERE ItemID = ItemID and ItemCategory = CategoryID and ItemCd = CdID ORDER BY ItemID ASC LIMIT 4";
$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) > '0')
{
$a1 = mysql_fetch_array($r1);

if(empty($a1[ItemImage]))
{
$ItemImage = "<img src=\"no_image.gif\" width=\"145\" alt=\"No Image!\" border=0>";
}
else
{
$size = getimagesize("items_images/$a1[ItemImage]");

if($size[0] > 90)
{
$width = 90;
$height = 85;
}
else
{
$width = $size[0];
$height = $size[0];
}

$ItemImage = "<img src=\"items_images/$a1[ItemImage]\" width=\"$width\" height=\"$height\" alt=\"$a1[ItemName]\" border=0>";
}

include_once("templates/IndexTemplate.php");
}

include_once("templates/FooterTemplate.php");

?>[/code]

templates/IndexTemplate.php
[code]<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<table width=570 valign=top>
<tr>
<td style="background-image: url('images/center.gif')"><?=$lang_katalog_1?></td>
</tr>

<tr>
<td style="padding-left:10"><?=nl2br($aset[naslovna]);?></td>
</table>

<table width=570 valign=top>
<tr>
<td style="background-image: url('images/center.gif')"><?=$lang_katalog_2?></td>
</tr>
</table>
<br>
<div align="center">
<table border="0" width="445" cellspacing="0" cellpadding="0">
<tr>
<td class="ItemTitle" bgcolor="#B2BCBE" width="400">
<p align="center"><?=$a1[ItemName]?></td>
<td bgcolor="#B2BCBE" width="50">
<p align="center"><? if ($a1[Novo] == 1) {
echo "<img src=\"images/novo.gif\" />";
} ?>
</td>
</tr>
</table>
</div>
<table align=center width=450 border=0>
<tr>
<td width="110" align=right border=0><?=$ItemImage?></td>
<td width="340" valign=top>
<table border="0" width="100%" valign=top>
<tr>
<td class=CategoryName bgcolor=#B2BCBE>
<font color="#006699"><?=$lang_index_1?>  </font><a class=CategoryName href="search.php?CategoryID=<?=$a1[ItemCategory]?>"><?=$a1[CategoryName]?></a>
</td>
</tr>
<tr>
<td class=CdName bgcolor=#B2BCBE>
<font color="#006699"><?=$lang_index_2?>  </font><?=$a1[CdName]?></td>
</tr>
<tr>
<td class=ItemDesc colspan=2 bgcolor=#B2BCBE><font color="#006699"><?=$lang_index_3?>  </font><?=nl2br($a1[ItemDesc]);?></td>
</tr>
<tr>
<td class=PriceClass bgcolor=#B2BCBE>
<font color="#006699"><?=$lang_index_4?>  </font><?=$aset[currency_sign]?> <?=$a1[ItemPrice]?></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="#B2BCBE">
<div align=center>
  <a href="view_cart.php"><img src="images/pregled.gif" width="118" height=22 alt="<?=$lang_index_5?>" border=0></a>&nbsp;&nbsp;
<a href="add.php?ItemID=<?=$a1[ItemID]?>"><img src="images/dodaj.gif" width="118" height=22 alt="<?=$lang_index_6?>" border=0></a></div>
</td>
</tr>
</td>
</table>
</table>[/code]
Link to comment
Share on other sites

i have been removed limit 4, and again show 1 record  :-[
and i Try to have this query :

$q1 = "select * from bsoft_catalog, bsoft_categories, bsoft_cd WHERE ItemID = ItemID and ItemCategory = CategoryID and ItemCd = CdID ORDER BY ItemID ASC LIMIT 0,4";
$r1 = mysql_query($q1) or die(mysql_error());

nothing again i have just 1 record, in my datebase i have more of 20 records ...
Link to comment
Share on other sites

table1:

Id | Name
1  | Balkan
2  | Btherl

table2:

Id | Posts
1  | 5

SELECT * FROM table1, table2 WHERE table1.id = table2.id

Id | Name | Posts
1  | Balkan | 5

Notice that "Btherl" is NOT in the results, because it is in only 1 table, not 2 tables.  This may be why you are not seeing the results you want.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.