我使用此查询从数据库中获取数据
我如何优化和使用此连接的最佳代码?
connect();
$games_sql = mysql_query("SELECT gameid,mizbanid,mihmanid,score1,score2,gamedavar,gamestadium,now FROM games WHERE gameweek='$site_week' ORDER BY now ASC LIMIT 9");
for( $i = 0; $i < mysql_num_rows( $games_sql ); $i++ ) {
$gameid = @mysql_result( $games_sql, $i, 0);
$mizbanid = @mysql_result( $games_sql, $i, 1 );
$mihmanid = @mysql_result( $games_sql, $i, 2);
$score1 = @mysql_result( $games_sql, $i, 3);
$score2 = @mysql_result( $games_sql, $i, 4);
$gamedavar = @mysql_result( $games_sql, $i, 5);
$gamestadium = @mysql_result( $games_sql, $i, 6);
$now = @mysql_result( $games_sql, $i, 7);
$gametimeanddate = jdate("l d M y ساعت G:i", $now);
$gamedate = jdate("l d M y", $now);
$gametime = jdate("G:i", $now);
`connect()` function include `mysql_connect` & `mysql_select_db`
我如何优化此代码以实现低user_connection
到数据库和高速?