Just curious,

I'ved used the mysql statements from a procedural perspective and am now trying to use the mysqli object oriented functionality.

However I cannot seem to get it right.

I've checked input my Mysql PhpAdmin; my queries work; I've even tried my queries in the old mysql_query statements--they work.

I'll start from the top with a practice entry.

This select function works.

$mysqli=new mysqli("192.168.1.4","","","mediatv");

if(mysqli_connect_errno())
{
	printf("Connection failed: %s\n",mysqli_connect_error());
	exit();
}

printf("Host information:%s\n", $mysqli->host_info);
$query="SELECT * from tv_shows where title='NightCrawlers'";
$stmt=$mysqli->query($query);

$record=$stmt->fetch_array(MYSQLI_ASSOC);

echo "<br>" . $record[series];

$mysqli->close;

This update function does not seem to work.

$mysqli=new mysqli("192.168.1.4","","","mediatv");

$stmt=$mysqli->query('Update tv_shows set genre=\'chick flick\' where title=\'NightCrawlers\'');

$mysqli->commit();

echo "<br>" . $mysqli->affected_rows;

$mysqli->close;

'Update tv_shows set genre=\'chick flick\' where title=\'NightCrawlers\''

the query you see directly above was output from a phpadmin console. Removing the backslashes, etc does not seem to help result.

The output from a query that takes place after the update query is here.
Host information:192.168.1.4 via TCP/IP
Pete and Pete

teen comedy

I sincerely appreciate any input or comments.

Regards
Jason

    I have installed mysqli CLASS support at my personal server
    but not used it yet.
    It has some advantage over regular mysql functions:

    Why Switch?

    Beyond gaining access to the new features of MySQL 4.1+, why would anyone want to switch to using ext/mysqli?

    In addition to the functionality mentioned above, ext/mysqli also has some other serious benefits:

    * Greater speed. Enhancements in both the extension and in MySQL have made most operations faster, with certain operations becoming up to 40 times faster as compared to ext/mysql.
    * Better security. In older versions of the MySQL RDBMS, the possibility existed for an attacker to extract weak password hashes from the network and then recreate a user's password. The new authentication procedure is much more robust and mirrors the attack-resistant authentication procedure of tools like SSH. [/QUOTE]

    Here is a very good article at http://www.zend.com/
    Using ext/mysqli: Part I - Overview and Prepared Statements
    By Zak Greant and Georg Richter

    http://www.zend.com/php5/articles/php5-mysqli.php
    ... and here is Part II
    http://www.zend.com/php5/articles/php5-mysqli2.php
    🙂

      I have it installed as well. Maybe there's a bug to the version I have?

      mysqli
      MysqlI Support enabled
      Client API version 5.0.20
      MYSQLI_SOCKET /tmp/mysql.sock

      Directive Local Value Master Value
      mysqli.default_host no value no value
      mysqli.default_port 3306 3306
      mysqli.default_pw no value no value
      mysqli.default_socket no value no value
      mysqli.default_user no value no value
      mysqli.max_links Unlimited Unlimited
      mysqli.reconnect Off Off

      Thoughts anyone?

      Jason

        Thoughts?

        Warning: mysqli::mysqli() [function.mysqli]: (28000/1045): Access denied for user 'blastvoc'@'mediatv' (using password: YES) in C:\Program Files\xampp\htdocs\mediatv\testmodule.php on line 21

        Warning: mysqli::query() [function.query]: Couldn't fetch mysqli in C:\Program Files\xampp\htdocs\mediatv\testmodule.php on line 23

        Mysql
        blastvoc % Yes ALL PRIVILEGES Yes

          Write a Reply...