RE: PHP Command line script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check the error from mysqli:

http://fi.php.net/manual/en/function.mysqli-error.php

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

> -----Original Message-----
> From: Nathaniel Hall [mailto:lists@xxxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, May 01, 2007 10:13 PM
> To: php-general@xxxxxxxxxxxxx
> Subject:  PHP Command line script
> 
> I am attempting to run a script that will run from the command line
> nightly to update a field in a database.  I already created a script
> that would access the database and insert most of the information when a
> webpage is visited and I had no problems with it.  The command line
> script appears to fail on the prepare.  I have echo'ed the SQL statement
> to the screen, copied it, and run it on the MySQL server with no
> problems.  Any ideas?
> 
> <?php
>         $mysqli = new mysqli('localhost', 'root', 'abc123', 'mydb');
>         if (mysqli_connect_errno()) {
>                 echo "Unable to connect to database.\n";
>                 exit;
>         } else {
>                 $login = date('m\-d\-Y');
>                 if ($logout = $mysqli->prepare("UPDATE `mydb`.`authlog`
> SET `logout`  = ? WHERE `login` LIKE '$login%'")) { // <--- Will not go
> any further than here, even when hard coding the information.
>                         $logout->bind_param("s", date('m\-d\-
> Y\TH\:i\:s'));
>                         $logout->execute();
>                         $logout->close();
>                 }
>         }
>         $mysqli->close();
> ?>
> 
> --
> Nathaniel Hall, GSEC GCFW GCIA GCIH GCFA
> Spider Security
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux