php - combining two While & sql statments -
i need combine 2 queries if possible or make them process 1 after other. i'm assuming $record_count = $record_count + 1;
doesn't need there twice since that's pagination script. (thanks in advance)
$results = mysql_query("select * load_test language = '".$lang."' order id desc, creationdate desc limit $start, 5"); while ($data = mysql_fetch_array($results)) { $record_count = $record_count + 1; $rec_res = mysql_query("select * names com_id = '".$data[id]."'"); while ($recdata = mysql_fetch_array($rec_res)) { $record_count = $record_count + 1;
if $record_count
counting number of returned rows use mysql_num_rows()
$results = mysql_query("select * load_test language = '".$lang."' order id desc, creationdate desc limit $start, 5"); $rec_res = mysql_query("select * names com_id = '".$data[id]."'"); $record_count += mysql_num_rows($result) + mysql_num_rows($rec_res);
Comments
Post a Comment