Jump to content
MakeWebGames

Recommended Posts

Posted

$_GET['Page'] = isset($_GET['Page']) ? $_GET['Page'] : 0;
$Boo = $db->num_rows($db->query("SELECT `whatever` FROM `table` "));
$Pages = ceil($Boo / 10);
echo 'Pages:';
if ($Pages == 0) {
 echo 'None';
} else {
 for($i=1; $i<=$Pages; ++$i) {
  $Page = ($i-1)*10;
  if ($Page == $_GET['Page']) { 
 echo '[b]',number_format($i),'[/b]';  
  } else { 
echo '[url="shops.php?Start=',$Page,'"]',number_format($i),'[/url]';
  }
  if($i % 25 == 0) { echo '
'; }
 }
}

 

Try using something like this, hope it helps :)

Posted

if you code this correctly you can have one shop create lots more links to other shops... all youd need to do is add an itmid for the items you want to shw in which shops...

Posted

try this out it will list what you need visible...

<?php
include "globals.php";
if ($_GET

 == "Weapons") {
 $shopname = "If its Weapons you need your here";
 $from = "items";
 $type = "weapon > '0'";
 $show = 100;
}
elseif ($_GET

 == "Armour") {
 $shopname = "Our Best Armour Shop";
 $from = "items";
 $type = "armor > '0'";
 $show = 100;
}
elseif ($_GET

 == "Medical") {
 $shopname = "Our Best Medical Supplies Shop";
 $from = "items";
 $type = "itmtype = 'ID OF ITEM TYPES FOR MEDICAL ITEMS'";
 $show = 100;
}

else {
echo"<h1> this shop dont exsist</h1>";
die();
}
$res = mysql_query("SELECT * FROM $from WHERE $type ORDER BY itmbuyprice ASC") or die(mysql_error());
echo "<p class=\"heading\">$shopname</p>";
echo "<table style=\"margin: 0 auto 0 auto; border: solid #292929 0px; width: 90%;\">
<tr style=\"background-color: #6fde45;\"><td style=\"width: 1px;\"><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Img</p></td>
<td><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Item</p></td>
<td><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Price</p></td>
<td><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Buy</p></td></tr>";
while ($row = mysql_fetch_array($res)) {
 if ($row[itmbuyable] == 0)
   continue;
 $rfc = mt_rand(0, 100);
 if ($show < $rfc)
   continue;
 if (!$i) {
   $bg = "#ffffff";
   $i = 1;
 }
 elseif ($i) {
   $bg = "#ececec";
   $i = 0;
 }
 $imageuri = $row[itempic];
 if (!$imageuri)
   $imageuri = "images/items/default.jpg";
 echo "<tr style=\"background-color: $bg;\"><td><p style=\"margin: 0 0 0 0;\"><img src=\"$imageuri\" title=\"$row[itmdesc]\" style=\"height: 45px;\" /></p></td>
 <td><p style=\"margin: 0 0 0 0;\"><a href=\"";
 if ($from == "items")
   echo "item";
 else
   echo "weapon";
 echo "info.php?ID=$row[itmid]\">$row[itmname]</a></p></td>
 <td><p style=\"margin: 0 0 0 0;\">$". number_format($row[itmbuyprice]) ."</p></td>
 <td><p style=\"margin: 0 0 0 0;\"><a href=\"item";
 if ($from == "items")
   echo "buy";
 else
   echo "buy";
 echo ".php?id=$row[itmid]\">Buy</a></p></td></tr>";
}
echo "</table>";
$h->endpage();
?>

 

then add links to explore.php for shops example

a href=shops?page=Weapons

a href=shops?page=Armour

Posted

<?php include "globals.php"; if ($_GET

== "Weapons") { $shopname = "If its Weapons you need your here"; $from = "items"; $type = "weapon > '0'"; $show = 100; } elseif ($_GET

== "Armour") { $shopname = "Our Best Armour Shop"; $from = "items"; $type = "armor > '0'"; $show = 100; } elseif ($_GET

== "Medical") { $shopname = "Our Best Medical Supplies Shop"; $from = "items"; $type = "itmtype = 'ID OF ITEM TYPES FOR MEDICAL ITEMS'"; $show = 100; } else { echo"<h1> this shop dont exsist</h1>"; die(); } $res = mysql_query("SELECT * FROM $from WHERE $type ORDER BY itmbuyprice ASC") or die(mysql_error()); echo "<p class=\"heading\">$shopname</p>"; echo "<table style=\"margin: 0 auto 0 auto; border: solid #292929 0px; width: 90%;\"> <tr style=\"background-color: #6fde45;\"><td style=\"width: 1px;\"><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Img</p></td> <td><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Item</p></td> <td><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Price</p></td> <td><p style=\"margin: 0 0 0 0; font-weight: bold; color: #ffffff;\">Buy</p></td></tr>"; while ($row = mysql_fetch_array($res)) { if ($row[itmbuyable] == 0) continue; $rfc = mt_rand(0, 100); if ($show < $rfc) continue; if (!$i) { $bg = "#ffffff"; $i = 1; } elseif ($i) { $bg = "#ececec"; $i = 0; } $imageuri = $row[itempic]; if (!$imageuri) $imageuri = "images/items/default.jpg"; echo "<tr style=\"background-color: $bg;\"><td><p style=\"margin: 0 0 0 0;\"><img src=\"$imageuri\" title=\"$row[itmdesc]\" style=\"height: 45px;\" /></p></td> <td><p style=\"margin: 0 0 0 0;\"><a href=\""; if ($from == "items") echo "item"; else echo "weapon"; echo "info.php?ID=$row[itmid]\">$row[itmname]</a></p></td> <td><p style=\"margin: 0 0 0 0;\">$". number_format($row[itmbuyprice]) ."</p></td> <td><p style=\"margin: 0 0 0 0;\"><a href=\"item"; if ($from == "items") echo "buy"; else echo "buy"; echo ".php?id=$row[id]\">Buy</a></p></td></tr>"; } echo "</table>"; $h->endpage(); ?>

Just to be annoying, and keep my word - recoded towards my personal preferences

<?php
include(DIRNAME(__FILE__) . '/globals.php');
$pages = array('Weapons', 'Armour', 'Medical');
if(!in_array($_GET['page'], $pages)) {
echo "This shop does not exist!";
$h->endpage();
exit;
}
if($_GET['page'] == "Weapons") {
$shopname = "If its Weapons you need you're here";
$from = "items";
$type = "weapon > 0";
$show = 100;
} else if($_GET['page'] == "Armour") {
$shopname = "Our Best Armour Shop";
$from = "items";
$type = "armor > 0";
$show = 100;
} else if($_GET['page'] == "Medical") {
$shopname = "Our Best Medical Supplies Shop";
$from = "items";
$type = "itmtype = 'ID OF ITEM TYPES FOR MEDICAL ITEMS'";
$show = 100;
}
$res = $db->query(sprintf("SELECT * FROM %s WHERE %s ORDER BY itmbuyprice ASC", $from, $type));
echo "<p class='heading'>".$shopname."</p>
<table style='margin: 0 auto 0 auto; border: solid #292929 0px; width: 90%;'>
<tr style='background-color: #6fde45;'>
	<td style='width: 1px;'><p style='margin: 0 0 0 0; font-weight: bold; color: #ffffff;'>Img</p></td>
	<td><p style='margin: 0 0 0 0; font-weight: bold; color: #ffffff;'>Item</p></td>
	<td><p style='margin: 0 0 0 0; font-weight: bold; color: #ffffff;'>Price</p></td>
	<td><p style='margin: 0 0 0 0; font-weight: bold; color: #ffffff;'>Buy</p></td>
</tr>";
while($row = $db->fetch_row($res)) {
if(!$row['itmbuyable'])
	continue;
$rfc = mt_rand(0, 100);
if($show < $rfc)
	continue;
if(!$i) {
	$bg = "#ffffff";
	$i = 1;
} else {
	$bg = "#ececec";
	$i = 0;
}
$imageuri = $row['itempic'];
if(!$imageuri)
$imageuri = "images/items/default.jpg";
echo "<tr style='background-color: $bg;'>
<td><p style='margin: 0 0 0 0;'>[img=".$imageuri."]</p></td>
<td><p style='margin: 0 0 0 0;'><a href='";
	echo ($from == "items") ? "item" : "weapon";
echo "info.php?ID=".$row['itmid']."'>".$row['itmname']."</a></p></td>
<td><p style='margin: 0 0 0 0;'>$". number_format($row['itmbuyprice']) ."</p></td>
<td><p style='margin: 0 0 0 0;'>[url='itembuy.php?id=".$row[']Buy[/url]</p></td>
</tr>";
}
echo "</table>";
$h->endpage();
?>
Posted

Wow... nice one ppl i didn`t think of that, but... maybe he is trying to say that in one shop to display the items in pages ...

like he said, a shop with 100 items having more pages so the frame won`t need to scrool down so much (25 items per page from the same shop)

I`m not so good at this but you could try something like this:

 

$pages=(int) ($items/25)+1;

if($items % 25 == 0)

{

$pages--;

}

for($i=1;$i <= $pages;$i++)

{

$stl=($i-1)*35;

print "<font color=green>Page: </font><font color=green>$i</font>

";

}

print "

";

$q=$db->query("SELECT .... ORDER BY $by $ord LIMIT $st,25");

$no1=$st+1;

$no2=$st+25;

...

Posted

try this out it will list what you need visible...
include "globals.php";
if ($_GET

 

then add links to explore.php for shops example

a href=shops?page=Weapons

a href=shops?page=Armour


 == "Weapons") {
 $shopname = "If its Weapons you need your here";
 $from = "items";
 $type = "weapon > '0'";
 $show = 100;
}
elseif ($_GET

 == "Armour") {
 $shopname = "Our Best Armour Shop";
 $from = "items";
 $type = "armor > '0'";
 $show = 100;
}
elseif ($_GET

 == "Medical") {
 $shopname = "Our Best Medical Supplies Shop";
 $from = "items";
 $type = "itmtype = 'ID OF ITEM TYPES FOR MEDICAL ITEMS'";
 $show = 100;
}

else {
echo" this shop dont exsist
";
die();
}
$res = mysql_query("SELECT * FROM $from WHERE $type ORDER BY itmbuyprice ASC") or die(mysql_error());
echo "$shopname";
echo "
Img
Item
Price
Buy";
while ($row = mysql_fetch_array($res)) {
 if ($row[itmbuyable] == 0)
   continue;
 $rfc = mt_rand(0, 100);
 if ($show < $rfc)
   continue;
 if (!$i) {
   $bg = "#ffffff";
   $i = 1;
 }
 elseif ($i) {
   $bg = "#ececec";
   $i = 0;
 }
 $imageuri = $row[itempic];
 if (!$imageuri)
   $imageuri = "images/items/default.jpg";
 echo "
   if ($from == "items")
   echo "item";
 else
   echo "weapon";
 echo "info.php?ID=$row[itmid]\">$row[itmname]
 $". number_format($row[itmbuyprice]) ."
   if ($from == "items")
   echo "buy";
 else
   echo "buy";
 echo ".php?id=$row[itmid]\">Buy";
}
echo "
";
$h->endpage();
?>

I use the original shops.php file.

When i replace with this code it says "this shop dont exsist"

I also use just links in explore for the shops (i.e: shops.php?shop=1 wich states for weapons, shops.php?shop=2 wich states for armors and so on...)

Sry Illusions i bumped at code :)

@Kabbz the code gives errors no mather what i change to it but, yes i want "shops.php?shop=1" to display the 100 items in pages (4 pages with 25 items per page)

thx all for learning me :)

Posted

I said that i`m not good at coding (no at all) but maybe these guys will help you and maybe someone else is also looking for something like this.

As i read the posts recently i decided to make an account so i can thank others for the scripts.

I would give you help but... :D

Posted

shops.php?shop=2
try this out it will list what you need visible...
include "globals.php";
if ($_GET

 

then add links to explore.php for shops example

a href=shops?page=Weapons

a href=shops?page=Armour

I use the original shops.php file.

When i replace with this code it says "this shop dont exsist"

I also use just links in explore for the shops (i.e: shops.php?shop=1 wich states for weapons, shops.php?shop=2 wich states for armors and so on...)

Sry Illusions i bumped at code :)

@Kabbz the code gives errors no mather what i change to it but, yes i want "shops.php?shop=1" to display the 100 items in pages (4 pages with 25 items per page)

thx all for learning me :)


 == "Weapons") {
 $shopname = "If its Weapons you need your here";
 $from = "items";
 $type = "weapon > '0'";
 $show = 100;
}
elseif ($_GET

 == "Armour") {
 $shopname = "Our Best Armour Shop";
 $from = "items";
 $type = "armor > '0'";
 $show = 100;
}
elseif ($_GET

 == "Medical") {
 $shopname = "Our Best Medical Supplies Shop";
 $from = "items";
 $type = "itmtype = 'ID OF ITEM TYPES FOR MEDICAL ITEMS'";
 $show = 100;
}

else {
echo" this shop dont exsist
";
die();
}
$res = mysql_query("SELECT * FROM $from WHERE $type ORDER BY itmbuyprice ASC") or die(mysql_error());
echo "$shopname";
echo "
Img
Item
Price
Buy";
while ($row = mysql_fetch_array($res)) {
 if ($row[itmbuyable] == 0)
   continue;
 $rfc = mt_rand(0, 100);
 if ($show < $rfc)
   continue;
 if (!$i) {
   $bg = "#ffffff";
   $i = 1;
 }
 elseif ($i) {
   $bg = "#ececec";
   $i = 0;
 }
 $imageuri = $row[itempic];
 if (!$imageuri)
   $imageuri = "images/items/default.jpg";
 echo "
   if ($from == "items")
   echo "item";
 else
   echo "weapon";
 echo "info.php?ID=$row[itmid]\">$row[itmname]
 $". number_format($row[itmbuyprice]) ."
   if ($from == "items")
   echo "buy";
 else
   echo "buy";
 echo ".php?id=$row[itmid]\">Buy";
}
echo "
";
$h->endpage();
?>

 

For your shops to display your need to match the GET


so your link in explore.php would be shops.php?page=Weapons

if you were to put shops.php?page=barry and you dont have a shop called barry then you get the THIS SHOP DONT EXSIST message

if ($_GET


== "Weapons")

if ($_GET


== "Armour")

if ($_GET


== "Medical")

if ($_GET


== "KEEPGOING")

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.   Paste as plain text instead

  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...