Código PHP:
[12-Feb-2016 06:45:04 America/Chicago] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on 'localHost' (111) in /home/xxxx/public_html/adodb/drivers/adodb-mysql.inc.php on line 358
[12-Feb-2016 06:45:04 America/Chicago] PHP Warning: mt_rand() [<a href='function.mt-rand'>function.mt-rand</a>]: max(0) is smaller than min(1) in /home/frasescr/public_html/frasediaria.php on line 27
[12-Feb-2016 06:45:04 America/Chicago] PHP Warning: mt_rand() [<a href='function.mt-rand>function.mt-rand</a>]: max(0) is smaller than min(1) in /home/frasescr/public_html/frasediaria.php on line 27
la linea 27 que alude es esta:
Código PHP:
$phr_random = mt_rand(1,$total);
Código PHP:
if(!isset($position_phr_today)){
$sql="Select position From active_frase";
$record=$conn->SelectLimit($sql);
$position_yesterday=$record->Fields("position");
$record->Close();
//Borro la frase de la DB.
//Escojo una nueva frase y actualizo la DB.
$sql = "Delete From active_frase";
$conn -> Execute($sql);
$sql=" Select Count(*) as Total From mfcG_posts where post_status='publish'";
$record = $conn->SelectLimit($sql);
$total = $record->Fields("Total");
$record->Close();
//Genero un numero random entre 1 y total.
$phr_random = mt_rand(1,$total);
while($phr_random==$position_yesterday){
$phr_random = mt_rand(1,$total);
}
$position_phr_today=$phr_random;
$sql="Insert Into active_frase(position,date_active) Values ($position_phr_today,'$today')";
$conn->Execute($sql);
}
//
Saludos