PHP mysql_fetch_row() Function
Complete PHP MySQL Reference
Definition and Usage
The mysql_fetch_row() function returns a row from a recordset as a numeric array.
This function gets a row from the mysql_query() function and returns an array on success, or FALSE on failure or
when there are no more
rows.
Syntax
Parameter |
Description |
data |
Required. Specifies which data pointer to use. The data
pointer is the result from the mysql_query() function |
Tips and Notes
Note: After the data is retrieved, this function moves to the next row
in the recordset. Each subsequent call to mysql_fetch_assoc() returns the next
row in the recordset.
Example
<?php
$con = mysql_connect("localhost", "peter", "abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("test_db",$con);
$sql = "SELECT * from Person WHERE Lastname='Refsnes'";
$result = mysql_query($sql,$con);
print_r(mysql_fetch_row($result));
mysql_close($con);
?>
|
The output of the code above could be:
Array
(
[0] => Refsnes
[1] => Kai Jim
[2] => Taugata 2
[3] => 22
)
|
Complete PHP MySQL Reference
The Altova MissionKit is a suite of intelligent XML tools, including:
XMLSpy® – industry-leading XML editor
- Support for all XML-based technologies
- Graphical editing views, powerful debuggers, code generation, & more
MapForce® – graphical data mapping tool
- Drag-and-drop data conversion with code generation
- Support for XML, DBs, EDI, Excel® 2007, text, Web services
StyleVision® – visual stylesheet designer
- Drag-and-drop stylesheet design for XML & databases
- Output to HTML, PDF, RTF, Word 2007, & more
And more…
Try before you buy with a free fully functional 30-day trial
Download today
|