View Single Post
  #1  
Old 07-21-2011, 12:59 PM
EquinoxWorld EquinoxWorld is offline
 
Join Date: Nov 2009
Location: Naples
Posts: 354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How many queries is too many queries??

Hello everyone, I was wondering if someone can clarify how many queries per page is too many per script. For example my php file below. This is used to get the specific image URL for each option of the form. I know I may have been able to use some sort of array but my php knowledge is very limited still but learning fast. I wonder if this is an overkill for the server although page load time is under a second, I don't know how this many queries per file might affect when used in a live large board for example. If anyone has any input or feedback or if someone knows how I can run the same script but differently and more efficient please don't hold back. Here is the said php file;

PHP Code:
<?php 
require_once('./global.php');

define('CSRF_PROTECTION'true);

       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='1'"); 
$row mysql_fetch_row($result);
       
$id1 $row[0];
       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='2'"); 
$row mysql_fetch_row($result);
       
$id2 $row[0];
       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='3'"); 
$row mysql_fetch_row($result);
       
$id3 $row[0];
       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='4'"); 
$row mysql_fetch_row($result);
       
$id4 $row[0];
       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='5'"); 
$row mysql_fetch_row($result);
       
$id5 $row[0];
       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='6'"); 
$row mysql_fetch_row($result);
       
$id6 $row[0];
       
$result $db->query_read("SELECT imgurl FROM oftw_nominations WHERE id='7'"); 
$row mysql_fetch_row($result);
       
$id7 $row[0];
      echo 
"<div id=lightboximages class=blockbody>";
      echo 
"<form cellpadding=10 border=1 action=oftw_insert_vote.php method=post>"
      echo 
"<tr>"
      echo 
"<td><center>1.<input type=radio name=votes value=1><a href=testlightbox.php?id=1 rel=Lightbox_1 id=image1><img src =".$id1." style=vertical-align:middle;padding-bottom:5px;></a></center></td>"
      echo 
"<td><center>2.<input type=radio name=votes value=2><a href=testlightbox.php?id=2 rel=Lightbox_1 id=image2><img src =".$id2." style=vertical-align:middle;padding-bottom:5px;></a></center></td>"
      echo 
"<td><center>3.<input type=radio name=votes value=3><a href=testlightbox.php?id=3 rel=Lightbox_1 id=image3><img src =".$id3." style=vertical-align:middle;padding-bottom:5px;></a></center></td>"
      echo 
"<td><center>4.<input type=radio name=votes value=4><a href=testlightbox.php?id=4 rel=Lightbox_1 id=image4><img src =".$id4." style=vertical-align:middle;padding-bottom:5px;></a></center></td>"
      echo 
"<td><center>5.<input type=radio name=votes value=5><a href=testlightbox.php?id=5 rel=Lightbox_1 id=image5><img src =".$id5." style=vertical-align:middle;padding-bottom:5px;></a></center></td>"
      echo 
"<td><center>6.<input type=radio name=votes value=6><a href=testlightbox.php?id=6 rel=Lightbox_1 id=image6><img src =".$id6." style=vertical-align:middle;padding-bottom:5px;></a></center></td>"
      echo 
"<td><center>7.<input type=radio name=votes value=7><a href=testlightbox.php?id=7 rel=Lightbox_1 id=image7><img src =".$id7." style=vertical-align:middle;padding-bottom:5px;></a></center></td>";
      echo 
"</tr>";
      echo 
"<center><input type=submit name=submitvote style=width:70px;></center>";
      echo 
"</form>";
      echo 
"</div>";
     


?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01153 seconds
  • Memory Usage 1,812KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete