|
The functions are all very similar:
mysql_fetch_array(), mysql_fetch_assoc(), mysql_fetch_object()
I have recently started using mysql_fetch_object as I am doing alot more OOP with PHP.
But what are peoples opinions on which one is best to use and why...
Started by Lizard on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
mysql_fetch_array will get you an array that can have as keys :
both numbers and names of columns, if using MYSQL_BOTH columns names, using MYSQL_ASSOC -- in this case, you'll get the same thing you get when using mysql_fetch....
|
|
It's written in PHP,
and sometimes when I restart mysql,
will report:
Debug Warning:line 24 - mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Is there any way to detect if $result is a valid MySQL result resource?
Started by Shore on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
mysql_error(); }
Or you could just do:
if ($result) { $row = mysql_fetch_array.
If ($result) { $row = mysql_fetch_array($result); } else { echo "MySQL error: " .
It'll be false if there's an error.
|
|
I'm setting up an app server that will run django. The MySQL database is in a different server.
When I try to install MySQL-python I'm getting the following error:
EnvironmentError: mysql_config not found
Do I need to install MySQL in my app server in...
Started by Catalina on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at serverfault):
Yes, you will need to install the client portion of mysql:
For Redhat/Centos:
# yum install mysql
For Ubuntu/Debian:
# apt-get install mysql-client
In most cases you will need at least mysql-client.
|
Ask your Facebook Friends
|
I'm trying to write a simple script for C to get values from a MySQL database, but it's throwing this error 'undefined reference to `_mysql_init@4''
Don't know if I'm not linking to something I should be? My C knowledge is limited...
I'm using Code Blocks...
Started by logic-unit on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
The function mysql....
Undefined reference refers to a problem with the linker.
Make sure building on Windows (see that same page in the MySQL Manual).
That's a linker error, indicating that the linker can't find the function mysql_init .
|
|
Is there a performance difference between using mysql_result and mysql_array_assoc to loop through a large SQL select result?
Started by Brian on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
As these functions return the contents of multiple cells in one function ... .
Yes (fetching an entire row is faster than mysql_result), and it's mentioned clearly in the mysql of the functions that fetch an entire row (mysql_fetch_*).
|
|
I'm using MySQL on CentOS and I want it to run at startup under the mysql user. I tried /sbin/chkconfig --level 35 mysqld on from my cool-RR user, but it seems like this makes mysql try to run as cool-RR. How do I make it run on startup as user mysql ...
Started by cool-RR on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at serverfault):
It should start as mysql user.
In /etc/mysql/my.cnf, set "user" to "mysql" in the [mysqld] section.
|
|
How to Change Default Port used by MySQL via MySQL Admin? I want to use other ports, such as 3307, instead of the default one, 3306.
How to do it via MySQL Administrator GUI program? If it's not possible then it will be helpful if have the instruction...
Started by Ngu Soon Hui on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at serverfault):
If you need to change it, you can add mysql server to pickup the change
service ....
The default port for MySQL is 3306.
Here's a post that explains how to do it via conf file in *nix .
I don't think you can change it via MySQL Admin.
|
|
$dml = "insert into table ..."; mysql_query($dml,$con);
The above insert something into a table.then you can check if it succeeded by either
if('' == mysql_error($con))...
or
if($id = mysql_insert_id($con))...
What's your choice and reason?
BTW,will the...
Answer Snippets (Read the full thread at stackoverflow):
Note: Because mysql_insert_id() acts on the last performed query, be sure to call mysql_insert_id() immediately after the query that....
mysql_error() will always throw an error if the insert operation fails, so fetching the insert_id.
|
|
For whatever reason, the "mysql" database on my windows mysql installation has been deleted. I now have a mysql install that cannot start because the system database is missing, but I cannot find any documentation on recreating this database.
How do I...
Started by Chris on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at serverfault):
Unfortunately, according to the....
On Unix, you would move your existing database data directory out of the way and run mysql_install_db.
Here's an sql dump from my mysql table: http://www.box.net/shared/js92gum4gh .
Reinstall MySQL.
|
|
It´s really a hard job figuring out how to get MySQL and mysql gem up and running on Snow Leopard 10.6.2. I followed the instructions of various posts but was not successful yet:
I build MySQL Version 5.1.39 from source and it installed successfully. ...
Started by auralbee on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
And MySQL into shape, in my experience it's easier to work entirely within the MacPorts realm (/opt port install mysql5 sudo port install mysql5-server sudo port install rb-mysql
Follow this link please, http://hivelogic.com/articles/compiling....
|