Mysql to mysqli php?

Full list of result methods is here: php.net/manual/en/class.mysqli-result.php.

I agree; this is a better way to do things. – user470714 Sep 26 at 7:03.

They give some possible alternatives, however.

There is no equivalent to mysql_result, but you can fetch a single row and use the first element of this row (because your query returns a table of one row and one column): $sql = "SELECT COUNT(*) FROM users WHERE username='$username'"; $result = $mysqli->query($sql); $arr = $result->fetch_row(); if ($arr0 > 0) { $errors = 'The username is already taken. '; }.

I usually use the object-y interface to MySQLi.

Based on this thread, there is no such equivalent.

I was running into some random issues using the myqli extension with MySQL 5 on Mac OS X. I discovered that when I compiled php 5 with the --with-mysqli flag, it was building php with the pre-installed MySQL 4 client libraries. Heres how it fixed it to build php with the correct MySQL client libraries.

----------------I had installed the binary version of MySQL 5 from MySQL AB. It installs everything in the default location /usr/local/mysql, which is fine. The MySQL version that comes with OS X ( v.4.

X, depends on your OS X version ) installs the mysql_config help utility at /usr/bin/mysql_config. When php configs, it uses that one by default, inheritently using the wrong MySQL client libs.No problem I thought, I just changed the --with-mysqli flag to --with-mysqli=/usr/local/mysql/bin/mysql_config ( or sudo find / -name mysql_config to find yours ). Nope, php throws a build error because it can't find the matching libraries.

Hmmm...So I tested /usr/local/mysql/bin/mysql_config --version, and I am shown my most current MySQL install. The problem is that the binary editions for OS X DO NOT include the shared libs ( libmysqlclient. Oh no, I did not want to compile MySQL myself, not because I don't know how, but because MySQL AB does not recommend it, and for good reasons.

Trust me, I've found out the hard way.So what do you do? Download the source version of MySQL 5 that matches my binary version. /configure --enable-shared ( it's listed as ON as default, but I want to be sure )Build MySQL:make ( requires Developer Tools, but you knew that )DO NOT make install!

I repeat, DO NOT make install unless you really wish to overwrite your binary verions, which is not a good idea. ( You can configure MySQL with the --without-server flag, but I want to be certain I don't mess up )Ok, almost done. Go to the lib directory in your MySQL build location and go to the invisible directory, .

There you will find your shared libraries, namely libmysqlclient.15.0.0.dylib. Copy this to your /usr/local/mysql/lib directory. Now do the following from the lib directory:ln -s libmysqlclient.15.0.0.

Dylib ln -s libmysqlclient.15.0.0. Dylib mkdir mysqlcd mysqlln -s ../libmysqlclient.15.0.0. Dylib ln -s ../libmysqlclient.15.0.0.

Dylib ln -s ../libmysqlclient.15.0.0. Dylib Now you can build your php with the correct library. After you build, check your phpinfo(); to validate the client version under the mysqli section.

When I restarted Apache, it originally couldn't find my libraries, thus the /usr/local/mysql/lib/mysql directory. Hope this helped.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions