-1)*$page_size;
$query = "select tid,truename,school,study,city,logo,year,month,x1,x2 from ask_member where $t order by logo desc, logintime desc limit $a,$page_size ";
$result = mysql_db_query($DataBase, $query);
while($r2[] = mysql_fetch_array($result))
{
}
foreach($r2 as $rr2)
{
$query = "select name,tid from ask_school where tid='$rr2[x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[] = mysql_fetch_array($result2);
}
$n=count($r2)-1;
?>
<?php
for($i=0;$i<$n;$i++)
{
?>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#57ACF2">
<tr>
<td align="center" bgcolor="#FFFFFF">
<table width="690" border="0" cellspacing="0" cellpadding="0">
<tr valign="middle">
<td width="80"><img
src="../ask/center/memberlogo/<?php if($r2[$i][logo]!=''){echo $r2[$i][logo];}else if ($r2[$i][sex]=='female'){echo "";}else{echo "";}else{echo "";} ?>" border=0 width="100" height="127" onload="javascript:DrawImage(this,100,127)"></td>
<td width="430"><strong><?php echo $r2[$i][truename]; ?> - <font color="#85B000">Information :)</font></strong><br>
Field 1: <a href="#" class="blue"><?php echo $r5[$i][name]==''?'Content':$r5[$i][name]; ?></a> <br>
Field 2: <a href="#" class="blue"><?php echo $r2[$i][study]; ?></a><br>
Field 3: <a href="#" class="blue"><?php echo $r2[$i][year]; ?><?php echo $r2[$i][month]; ?></a><br>
Views: <a href="#" class="blue">1</a> <font color="#0E6FBE">|</font>
<a href="#" class="blue">2</a> <font color="#0E6FBE">|</font>
<a href="#" class="blue">Three</a> </td>
<td width="180" align="right"><table width="110" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" align="center" bgcolor="#eeeeee"><a href="?tid=<?php echo $r2[$i][tid]; ?>"> Say hello</a></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
<table width="110" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" align="center" bgcolor="#eeeeeeee"><a href="?tid=<?php echo $r2[$i][tid]; ?>">Other operations</a></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
<table width="110" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" align="center" bgcolor="#eeeeee"><a href="?tid=<?php echo $r2[$i][tid]; ?>">Operation 2</a></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table>
<?php
}
?> [/code]
Question 1: Why use it
Instead of:
Answer: Because there is only one real reason for the speed of the PHP website during operation, that is, the reading of MYSQL. As for the program running one or two more copies and copies, it is difficult to affect the speed. Therefore, when reading MYSQL, I would rather have an in-memory operation once or twice, than any operation affects the reading of MYSQL.
Question 2: Why don’t you use templates to write programs?
Answer: Because PHP is already the best template engine, why do you need to use other templates?
Question 3: Why put a large amount of PHP code above <HTML> instead of below HTML?
Answer: There is a big difference in this. First, the code is placed above <HTML>. If you modify the code, you will not feel slow when you use DREARWEAVER to look at the following view.
Second: Most of the code is placed above <HTML> instead of below <HTML>, which is beneficial to the parsing and running of PHP scripts, which can reduce the burden on PHP server to parse scripts, and conform to the template and cache design ideas.
Question 3: Why use it
view plaincopy to clipboardprint?
<?php
$query = "select count(*) from ask_member where $t ";
$result2 = mysql_db_query($DataBase, $query);
$r3 = mysql_fetch_array($result2);
$amount=$r3[0];
?>
<?php
$query = "select count(*) from ask_member where $t ";
$result2 = mysql_db_query($DataBase, $query);
$r3 = mysql_fetch_array($result2);
$amount=$r3[0];
?>
Instead of using:
view plaincopy to clipboardprint?
<?php
$query = "select * from ask_member ";
$result2 = mysql_db_query($DataBase, $query);
$amount=mysql_num_rows($result2);
?>
<?php
$query = "select * from ask_member ";
$result2 = mysql_db_query($DataBase, $query);
$amount=mysql_num_rows($result2);
?>
Answer: The first type is a query for a record, and the second type is a query for all records. The speeds of the two are very different.
Question 4: Why do you need one more line?
view plaincopy to clipboardprint?
<?php
$n=count($r2)-1;
?>
<?php
$n=count($r2)-1;
?>
Instead of using it directly below:
view plaincopy to clipboardprint?
<?php
for($i=0;$i<count($r2)-1;$i++)
{
?>
<?php
for($i=0;$i<count($r2)-1;$i++)
{
?>
Answer: PHP operations should be performed below <HTML> as much as possible. If you perform too much calculation under <HTML>, it will become a mixed compilation.
Question 5: Why is the above code said to be the core code?
Answer: Any programmer knows that reading data is the most commonly used to read pages. I think most PHP programmers spend 30% of their time posting this.
The above is the fastest experience I have summarized in writing PHP. Please correct me. If you think it is possible, I hope everyone can write programs in this way. In that case, I will arrange a group of PHP programmers to divide the work and coordinate in the future.
$query = "select tid,truename,school,study,city,logo,year,month,x1,x2 from ask_member where $t order by logo desc, logintime desc limit $a,$page_size ";
$result = mysql_db_query($DataBase, $query);
while($r2[] = mysql_fetch_array($result))
{
}
foreach($r2 as $rr2)
{
$query = "select name,tid from ask_school where tid='$rr2[x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[] = mysql_fetch_array($result2);
}
$n=count($r2)-1;
?>
<?php
for($i=0;$i<$n;$i++)
{
?>
<table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#57ACF2">
<tr>
<td align="center" bgcolor="#FFFFFF">
<table width="690" border="0" cellspacing="0" cellpadding="0">
<tr valign="middle">
<td width="80"><img
src="../ask/center/memberlogo/<?php if($r2[$i][logo]!=''){echo $r2[$i][logo];}else if ($r2[$i][sex]=='female'){echo "";}else{echo "";}else{echo "";} ?>" border=0 width="100" height="127" onload="javascript:DrawImage(this,100,127)"></td>
<td width="430"><strong><?php echo $r2[$i][truename]; ?> - <font color="#85B000">Information :)</font></strong><br>
Field 1: <a href="#" class="blue"><?php echo $r5[$i][name]==''?'Content':$r5[$i][name]; ?></a> <br>
Field 2: <a href="#" class="blue"><?php echo $r2[$i][study]; ?></a><br>
Field 3: <a href="#" class="blue"><?php echo $r2[$i][year]; ?><?php echo $r2[$i][month]; ?></a><br>
Views: <a href="#" class="blue">1</a> <font color="#0E6FBE">|</font>
<a href="#" class="blue">2</a> <font color="#0E6FBE">|</font>
<a href="#" class="blue">Three</a> </td>
<td width="180" align="right"><table width="110" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" align="center" bgcolor="#eeeeee"><a href="?tid=<?php echo $r2[$i][tid]; ?>"> Say hello</a></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
<table width="110" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" align="center" bgcolor="#eeeeeeee"><a href="?tid=<?php echo $r2[$i][tid]; ?>">Other operations</a></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
<table width="110" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td height="20" align="center" bgcolor="#eeeeee"><a href="?tid=<?php echo $r2[$i][tid]; ?>">Operation 2</a></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
<table width="110" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="3"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>
</table>
<?php
}
?> [/code]
Question 1: Why use it
Copy the codeThe code is as follows:
<?php
while($r2[] = mysql_fetch_array($result))
{
}
foreach($r2 as $rr2)
{
$query = "select name,tid from ask_school where tid='$rr2[x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[] = mysql_fetch_array($result2);
}
?>
while($r2[] = mysql_fetch_array($result))
{
}
foreach($r2 as $rr2)
{
$query = "select name,tid from ask_school where tid='$rr2[x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[] = mysql_fetch_array($result2);
}
?>
Copy the codeThe code is as follows:
<?php
while($r2[] = mysql_fetch_array($result))
{
}
foreach($r2 as $rr2)
{
$query = "select name,tid from ask_school where tid='$rr2[x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[] = mysql_fetch_array($result2);
}
?>
while($r2[] = mysql_fetch_array($result))
{
}
foreach($r2 as $rr2)
{
$query = "select name,tid from ask_school where tid='$rr2[x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[] = mysql_fetch_array($result2);
}
?>
Instead of:
Copy the codeThe code is as follows:
<?php
$j=0;
while($r2[$j] = mysql_fetch_array($result))
{
$query = "select name,tid from ask_school where tid='$r2[$j][x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[$j] = mysql_fetch_array($result2);
$j++;
}
?>
$j=0;
while($r2[$j] = mysql_fetch_array($result))
{
$query = "select name,tid from ask_school where tid='$r2[$j][x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[$j] = mysql_fetch_array($result2);
$j++;
}
?>
Copy the codeThe code is as follows:
<?php
$j=0;
while($r2[$j] = mysql_fetch_array($result))
{
$query = "select name,tid from ask_school where tid='$r2[$j][x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[$j] = mysql_fetch_array($result2);
$j++;
}
?>
$j=0;
while($r2[$j] = mysql_fetch_array($result))
{
$query = "select name,tid from ask_school where tid='$r2[$j][x2]' ";
$result2 = mysql_db_query($DataBase, $query);
$r5[$j] = mysql_fetch_array($result2);
$j++;
}
?>
Answer: Because there is only one real reason for the speed of the PHP website during operation, that is, the reading of MYSQL. As for the program running one or two more copies and copies, it is difficult to affect the speed. Therefore, when reading MYSQL, I would rather have an in-memory operation once or twice, than any operation affects the reading of MYSQL.
Question 2: Why don’t you use templates to write programs?
Answer: Because PHP is already the best template engine, why do you need to use other templates?
Question 3: Why put a large amount of PHP code above <HTML> instead of below HTML?
Answer: There is a big difference in this. First, the code is placed above <HTML>. If you modify the code, you will not feel slow when you use DREARWEAVER to look at the following view.
Second: Most of the code is placed above <HTML> instead of below <HTML>, which is beneficial to the parsing and running of PHP scripts, which can reduce the burden on PHP server to parse scripts, and conform to the template and cache design ideas.
Question 3: Why use it
view plaincopy to clipboardprint?
<?php
$query = "select count(*) from ask_member where $t ";
$result2 = mysql_db_query($DataBase, $query);
$r3 = mysql_fetch_array($result2);
$amount=$r3[0];
?>
<?php
$query = "select count(*) from ask_member where $t ";
$result2 = mysql_db_query($DataBase, $query);
$r3 = mysql_fetch_array($result2);
$amount=$r3[0];
?>
Instead of using:
view plaincopy to clipboardprint?
<?php
$query = "select * from ask_member ";
$result2 = mysql_db_query($DataBase, $query);
$amount=mysql_num_rows($result2);
?>
<?php
$query = "select * from ask_member ";
$result2 = mysql_db_query($DataBase, $query);
$amount=mysql_num_rows($result2);
?>
Answer: The first type is a query for a record, and the second type is a query for all records. The speeds of the two are very different.
Question 4: Why do you need one more line?
view plaincopy to clipboardprint?
<?php
$n=count($r2)-1;
?>
<?php
$n=count($r2)-1;
?>
Instead of using it directly below:
view plaincopy to clipboardprint?
<?php
for($i=0;$i<count($r2)-1;$i++)
{
?>
<?php
for($i=0;$i<count($r2)-1;$i++)
{
?>
Answer: PHP operations should be performed below <HTML> as much as possible. If you perform too much calculation under <HTML>, it will become a mixed compilation.
Question 5: Why is the above code said to be the core code?
Answer: Any programmer knows that reading data is the most commonly used to read pages. I think most PHP programmers spend 30% of their time posting this.
The above is the fastest experience I have summarized in writing PHP. Please correct me. If you think it is possible, I hope everyone can write programs in this way. In that case, I will arrange a group of PHP programmers to divide the work and coordinate in the future.