|
|
How To Use MySQL, PHP And Recordsets ? - Using info retrieved from MySQL via PHP | ||
Discussion by hellonull with 9 Replies.
Last Update: October 27, 2005, 9:58 pm | |||
Thu Oct 14, 2004 Reply New Discussion
Thu Oct 14, 2004 Reply New Discussion
Thu Oct 14, 2004 Reply New Discussion
There are lots of stuff that can make your life easier. I remember when I started using PHP & MySQL combo, I stubbornly programmed lots of stuff myself, when I didn't know of all things that were just function call away.
So it is a good idea to check the manual to know roughly what kind of features are available. When you program something, instead of implementing it yourself, it might come to your mind that there could be a ready function for this.
Fri Oct 15, 2004 Reply New Discussion
Fri Oct 15, 2004 Reply New Discussion
Thu Oct 27, 2005 Reply New Discussion
QUOTE (ruben)
I'm not exactly sure what you want to do. But what I know is, that PHP does not really have that many functions to use MySQL directly. They like you better to use mysql_query() and then the MySQL code in it. Makes it easier for you since you already know mysql. If you don't know that command, try finding out what the ASP-function actually does! Look on the bright side you don't have to learn it new completely.. :-)QUOTE
mysql_affected_rows (get the number of affected rows in the pervious MySQL operation),mysql_close (close a MySQL connection),
mysql_connect (open a connection to MySQL server),
mysql_create_db ( create a MySQL database),
mysql_data_seek (mover the internal result pointer),
mysql_db_query (Send an SQ: query to MySQL),
mysql_drop_db (Drop a MySQL database),
mysql_return_errno (Returns the error number of the pervious MySQL operation),
mysql_error (Returns the text of the error message from the previous MySql operation),
mysql_fetch_array (Fetches a result row as an associative array),
mysql_fetch_field (Get column information from a result and return it as an object),
mysql_fetch_length (Gets the maximum data size of each column in a result),
mysql_fetch_object (Fetches a result row ans an object),
mysql_fetch_row (Get a result row as an enumerated array),
mysql_field_flags (Gets the flags associate with the specified field in a result),
mysql_field_len (Returns the length of a specified field),
mysql_field_name (Get the name of the specified field in a result),
mysql_field_seek (Set the pointer to a specific field offset),
mysql_field_table (Get the name of the table the specified field is in),
mysql_field_type (Get the type of the specified field in a result),
mysql_free_result (free result memory),
mysql_insert_id (Get the ID generated from the previous INSERT operation),
mysql_list_dbs (Lists the databases available on a MySQL server),
mysql_list_fields (List MySQL result fields),
mysql_list_tables (Lists the tables in a MySQL database),
mysql_num_fields (Get the number of fields in a result),
mysql_num_rows (Get the number of rows in a result),
mysql_pconnect (Open a persistent connection to a MySQL database server),
mysql_query (Send anSQL query to MySQL),
mysql_result (Get result data)and of course
mysql_select_db (Select a MySQL database)
Plus for mSQL there are 28, for Oracle there are 40, forPostgreSQL there are 32, and there is Sybase, InterBase with 11, and several with Informix and Hyperwave... I could have made un unordered list but I used that format to save space in the post and not have a long list of PHP functions.
Thu Oct 27, 2005 Reply New Discussion
Thu Oct 27, 2005 Reply New Discussion
If you are new to MySQL then you are better off using MySQL code in mysql_query, that's what I was trying to say.
Thu Oct 27, 2005 Reply New Discussion
CODE
$q = mysql_query("SELECT $columns FROM $table")$q will be a MySQL query result. To get the data from it use something like this:
CODE
$qRow = mysql_fetch_array($q);$qRow will contain one row of the MySQL query. It will be in the form of an associative array. For example, if you have a table like this:
NAME | ADDRESS
John | MyStreetRox 89
Pete | MyStreetRoxMore 12
then your $qRow will contain the array with as key: [Name] and as value "John". And as key [Address] and as value "MyStreetRox89"
Good Luck
( echo $qRow["Name"]; will give you John )
Thu Oct 14, 2004 Reply New Discussion
Data Warehouse (0)
|
(2) Access To MySQL Remotely
|
Index




