we were discussed following ways of data display in my previous tutorials
1. mysql_fetch_array()
2. mysql_fetch_assoc()
3. mysql_numrows()
4. mysql_fetch_row()
5. mysql_data_seek()
There is an other function called mysql_fetch_object(). By using the table progress following example were created for the function mysql_fetch_object().
<?php $con = mysql_connect("localhost", "root", ""); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("my_database",$con); $sql = "SELECT * from progress"; $result = mysql_query($sql,$con); while ($row = mysql_fetch_object($result)) { echo $row->Month . ":-"; echo $row->Production . "<br />"; } mysql_close($con); ?> | January:-10 February:-20 March:-12 April:-21 May:-23 June:-21 July:-23 August:-27 September:-32 October:-14 November:-25 December:-24 |
No comments:
Post a Comment