![]() |
|
PHP MySQL WHERE Clause. Free online PHP and MySQL Web Database Programming Tutorial... |
| Lessons | MySQL WHERE Clause |
|
|
SELECT column_name(s) FROM table_name WHERE column_name operator value We use the mysql_query() function in PHP to execute the above statements. Let's see an example: Example The following example selects all rows from the "Students" table where "Name='Ibrahim': <?php $con = mysql_connect("localhost", "adam" ,"ada"); if (!$con) { die('Error connecting database'); } mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM Students WHERE name='Ibrahim'"); while($row = mysql_fetch_array($result)) { echo $row['name'] ; echo "<br />"; } ?> |