Re: PHP Command line script

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

 



On Tue, May 1, 2007 3:13 pm, Nathaniel Hall wrote:
> <?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();
>                 }

//ALWAYS do your error-checking!!!
                  else{
                    die(mysqli_error());
                  }

//You may want to put the query in $query so you can print that
//as part of the 'die' output

>         }
>         $mysqli->close();
> ?>

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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