Jump to content

DJTim666

Members
  • Posts

    212
  • Joined

  • Last visited

    Never

About DJTim666

  • Birthday 08/03/1991

Contact Methods

Profile Information

  • Gender
    Male
  • Location
    Canada

DJTim666's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. So lets say we have a large inventory of items(5000+) held in a database. Now lets say 2000 of these items do something different than the last. Which of the following ways is more efficient? Or maybe you have your own suggestion . Store individual code bits in the DB, then pull and run <?php $item_id = $_GET['item_id']; $findItem = $db->query("select `code` from `items` where `item_id` = '{$item_id}'"); if ($findItem) { $itemCode = $db->fetch($findItem); eval ($itemCode['code']); } ?> Store all item codes in an inventory script <?php $item_id = $_GET['item_id']; switch ($item_id){ case 123: //do this break; case 124: //do this break; //continuing on for my 2000 item list } ?> I know the first one looks more efficient, but I've heard its not good to use eval :S
  2. Try this inside your <form>; <input type='hidden' name='id' value='someValue /'> Obviously change someValue to whatever value you want passed to your script.
×
×
  • 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.