This example illustrates how to use the 'if' statement in php when accessing the data from table in mysql database.
In this example we create a connection from database table using mysql_connect("hostName", "userName", "Password"). After the connection created we choose database by mysql_select_db("databaseName", connectionObject) and finally we execute query by mysql_query("SELECT * FROM tableName"). mysql_fetch_array() returns an array corresponding to the fetched row. Here we are using the if statement, so only one data will display here as shown in the output.
Source Code of IF_Statement.php
Posted on: January 17, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles