viernes, 21 de noviembre de 2014

Como reparar una tabla MYSQL

En este caso vamos a reparar la tabla  kvstore en la base de datos asterisk.
mysqlcheck asterisk kvstore --auto-repair -p

 mysqlcheck -u root -p --auto-repair -c -o --all-databases
http://www.thegeekstuff.com/2011/12/mysqlcheck/

miércoles, 19 de noviembre de 2014

Script para extraer cantidad de tiempo transcurrido

<?php
require ("./library/conect.php");

$result = mysql_query("SELECT timediff(now(),date) AS time,date,phone,advnumber FROM `leads` where `campaign` ='o65' order by date asc");
echo "Total de records ".mysql_num_rows($result );
echo "<table border='1'>
<tr>
<th>ID</th>
<th>STATE</th>
<th>TIME</th>
<th>TIME</th>
<th>ELIMINAR</th>
</tr>";
   while($row = mysql_fetch_array($result))
    {
  echo "<tr>";
 echo "<td>" . $row['phone']."</td>";
  echo "<td>" . $row['advnumber'] . "</td>";
  echo "<td>" .  $row['time'] . "</td>";
  echo "<td>" .  substr($row['time'],-5,2). "</td>";  //extrayendo solo los minutos transcurridos
echo "<td><a href=?ID=$row[recordid]>" ."ELIMINAR" . "</td></a>";
  echo "</tr>";
$GLOBALS['b']= $row['time'];     // declaramos la Variable global para tener acceso en todo el script
}

echo "</table>";
echo $b;
mysqli_close($con);
?>

sábado, 15 de noviembre de 2014

Backup and Restore MySQL Database Using mysqldump

 
mysqldump -d -h localhost -u root -p1233 insurance > insurance.sql
mysqldump -d -h localhost -u root -p1233 asterisk> asterisk.sql



How To Restore MySQL database


1. Restore a database

In this example, to restore the sugarcrm database, execute mysql with < as shown below. When you are restoring the dumpfilename.sql on a remote database, make sure to create the sugarcrm database before you can perform the restore.
# mysql -u root -ptmppassword

mysql> create database sugarcrm;
Query OK, 1 row affected (0.02 sec)

# mysql -u root -ptmppassword sugarcrm < /tmp/sugarcrm.sql

# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
 
 


http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

viernes, 7 de noviembre de 2014

Activando el short_open_tag = On

Si queremos que nuestros script sean reconocidos  <? ?> y no tener que escribirlo de la siguiente manera <?php ?>


Editar los arhicos php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
activar el short_open_tag
short_open_tag = On
/etc/init.d/apache2 restart