$link = mysql_pconnect("172.30.254.189:3306","in-code-rw","EDhdfjh58ayjioG"); echo "\nRan at: " . date("YmdHis") . "\n"; if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('inrevampdb') or die(mysql_error()); $sql_cnt='SELECT count(*) AS cnt FROM video_content v LEFT JOIN video_data vd ON (v.id = vd.videoId) WHERE status!=-1 AND publishDate > "2012-09-16 00:00:00"'; $result_cnt= mysql_query($sql_cnt); $row_cnt = mysql_fetch_assoc($result_cnt); $cnt=$row_cnt['cnt']; echo $cnt."\n"; ###################Video Category List. $queryforcategory="SELECT id,name,parentId FROM category WHERE status!=-1 AND contentTypeId=2"; $result_cat = mysql_query($queryforcategory); while($row_cat = mysql_fetch_assoc($result_cat)){ $categoryArr[$row_cat['id']] = $row_cat['name']; $parent_categoryArr[$row_cat['id']] = $row_cat['parentId']; } //echo "
"; //print_r($categoryArr); //print_r($sub_categoryArr); ################################################# //for($i=0;$i<2;$i+=500){ $sql_qr = 'SELECT v.id, v.title, v.summary, v.docId,v.embedCode, v.categoryId, v.image, v.source AS source, v.editorId, v.videoLength, v.insertDate, DATE_FORMAT(v.publishDate,"%Y%m%d%k%i%S") AS publishDate,v.isEdited, v.likeCount, v.disLikeCount, v.commentCount, v.videoLength, v.viewCount, v.flag, v.badget, v.isMobile, v.countryId, v.status, vd.desc FROM video_content v LEFT JOIN video_data vd ON (v.id = vd.videoId) WHERE v.status!=-1 AND publishDate > "2012-09-16 00:00:00" LIMIT 1,200'; $result= mysql_query($sql_qr) or die(mysql_error()); if(!$result) echo mysql_error(); else { while($row = mysql_fetch_assoc($result)) { $cat_id = $row['categoryId']; $category_main = $categoryArr[$cat_id]; $parient_id = $parent_categoryArr[$cat_id]; if($parient_id==0){ $category = $category_main; $sub_category =''; }else{ $category = $categoryArr[$parient_id]; $sub_category =$category_main; } echo "Main=".$category."--".$cat_id."--Sub cat=".$sub_category."\n"; } } //} ?>