附上我的php(跑不出)
<?php
//not on Saturday and Sunday
if(date("w",time())==0)exit;
if(date("w",time())==6)exit;
//chdir('/home/gurufocu/public_html/Vera');
//include "../include/config.php";
//include "../include/financial_functions.php";
//include_once ("../db_functions.php");
//$db_stock = connect_stockdb();
//$db_data = connect_datadb();
//echo "\ntest\n";
$db_stock_dev = connect_stockdb();
$db_data_dev = connect_datadb_dev();
$date_today=date("Y-m-d");
echo "\n$date_today\n";
$date=date_create($date_today);
date_add($date,date_interval_create_from_date_string("+30 days"));
$date_new=date_format($date,"Y-m-d");
echo "\n$date_new\n";
//exit;
$sql="SELECT * FROM gurufocu_main.`inst_holdings` where filling_type in ('13D', 'SC 13D/A', 'SC 13D', '13D/A') and symbol!='' and portdate<'$date_new' and verified=1 order by portdate desc limit 0,1";
$result=mysql_query($sql, $db_stock_dev);
$nrows = mysql_num_rows($result);
echo "\n$nrows\n";
//loop one-to-one
if($nrows!= 0){
for($j1=0;$j1<$nrows;$j1++){
$row = mysql_fetch_assoc($result);
$symbol=$row['symbol'];
$exchange=$row['exchange'];
$guru_id=$row['guru_id'];
$portdate=$row['portdate'];
//secr_id
$sql_sec="SELECT a.morn_secr_id FROM gurufocu_main.stock_list as a where a.exchange='$exchange' and symbol='$symbol'";
echo $sql_price;
$result_sec=mysql_query($sql_sec,$db_stock_dev);
$nrows_sec = mysql_num_rows($result_sec);
if($nrows_sec != 0){
$row_sec = mysql_fetch_assoc($result_sec);
$morn_secr_id=$row_sec['morn_secr_id'];
}
echo "\n$morn_secr_id\n";
$date_1=date_create($portdate);
date_add($date_1,date_interval_create_from_date_string("31 days"));
$date_30d=date_format($date_1,"Y-m-d");
$sql_sec="SELECT b.close FROM gurufocu_data.price_all as b and gurufocu_main.stock_list as a where b.sec=a.morn_secr_id'";
echo $sql_price;
$result_sec=mysql_query($sql_sec,$db_stock_dev);
$nrows_sec = mysql_num_rows($result_sec);
if($nrows_sec != 0){
$row_sec = mysql_fetch_assoc($result_sec);
$close=$row_sec['close'];
}
echo "\n$close\n";
}
}
?>