The functions in this section communicate with mSQL, a database that implements a subset of SQL.
There are a handful of mSQL functions that exist simply for backward compatibility. I have chosen to leave them out. Only some of them are documented in the official PHP 3 manual. Their use is described in the PHP 2 documentation. For reference they are msql,msql_createdb, msql_dbname, msql_dropdb, msql_freeresult, msql_listdbs, msql_list-fields, msql_listtables, msql_numfields, msql_numrows, msql_selectdb, msql_tablename.
Two mSQL extensions exist, one for mSQL version 1 and one for version 2. You must load the appropriate extension to enable the functions in this section. Zeev Suraski wrote both mSQL extensions.
integer msql_affected_rows(integer link)
The msql_affected_rows function returns the number of rows involved in the previous query made on the given link. The link argument must be an integer returned by msql_connect or msql_pconnect. For an example of use, see msql_db_query, below.
boolean msql_close(integer link)
The msql_close function closes the link to a database. If the link argument is left out, the last-opened link is closed. Only links opened by msql_connect may be closed. Using this function is not strictly necessary, since all nonpersistent links are automatically closed when a script ends. For an example of use, see msql_db_query, below.
integer msql_connect(string host, string username, string password)
The msql_connect function attempts to connect to the mSQL server at the specified host. If the host argument is left out, the local host will be assumed. A link identifier is returned. In the case where an open link exists, it will be returned rather than establishing a second link. The connection is automatically closed at the end of the script. You may add a colon and a port number to the host argument.
boolean msql_create_db(string database, integer link)
The msql_create_db function attempts to create a database. The link argument is optional. If left out, the last-opened link will be used.
boolean msql_data_seek(integer result, integer row)
Use msql_data_seek to move the internal row pointer to the specified row in a result set. The result argument is as returned by msql_query.
integer msql_db_query(string database, string query, integer link)
The msql_db_query function is identical to msql_query except that it specifies a database rather than using the database selected with msql_ select_db. The query is executed in the specified database and a result identifier is returned.
boolean msql_drop_db(string database, integer link)
The msql_drop_db function removes an entire database from the server. The link argument is optional and, if omitted, the last connection opened will be used.
Use msql_error to retrieve the last error message returned by an mSQL function. See msql_drop_db, above, for an example of use.
array msql_fetch_array(integer result, integer type)
The msql_fetch_array function returns an array of the data for the current row. The result argument is as returned by msql_query. By default, result columns are returned in two elements each: one referenced by number and one referenced by field name. The optional type argument controls which elements are created. MSQL_NUM signals that only numbered elements be created. MSQL_ASSOC signals that only named elements be created. If you want both, you can explicitly request it with MSQL_BOTH. Compare this function to msql_fetch_row and msql_fetch_object.
object msql_fetch_field(integer result, integer field)
The msql_fetch_field function returns an object with properties that describe the specified field. The field argument may be left out, and the next unfetched field will be returned. The properties of the object are listed.
object msql_fetch_object(integer result)
The msql_fetch_object function returns an object with a property for each column of the resulting row. Each call to msql_fetch_object gets the next row from the results, or returns FALSE when there are none left.
array msql_fetch_row(integer result)
The msql_fetch_row function returns an array with one element for each resulting column. FALSE is returned when no results are left. Columns arereferenced by integers starting at zero. Compare this function to msql_fetch_array and msql_fetch_object.
boolean msql_field_seek(integer result, integer field)
Use msql_field_seek to move the internal field pointer to the specified field.
string msql_fieldflags(integer result, integer field)
The msql_fieldflags function returns all the flags turned on for the specified field. These may be primary key, unique, and not null.
integer msql_fieldlen(integer result, integer field)
The msql_fieldlen function returns the length of the specified field.
string msql_fieldname(integer result, integer field)
The msql_fieldname function returns the name of the specified field.
string msql_fieldtable(integer result, integer field)
The msql_fieldtable function returns the name of the table for the specified field.
string msql_fieldtype(integer result, integer field)
The msql_fieldtype function returns the type of the specified field.
boolean msql_free_result(integer result)
When a script ends, all results are freed. If memory is a concern while your script is running, use msql_free_result.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
An Introduction To Php
Variables, Operators, And Expressions
Classes And Objects
I/o And Disk Access
Time, Date, And Configuration Functions
Parsing And String Evaluation
Sorting Searching And Random Numbers
Integration With Html
Efficiency And Debugging
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.