Application Details
A phone book in which we can add, edit, search for, and delete entities.
Database
One table:
(id, first_name, last_name, number, created_at)
MVC stands for Model View Controller
What's wrong with this code?

<?php
$username = "root";
$password = "";
$hostname = "localhost";
$ip = $_GET['ip'];

$dbh = mysql_connect($hostname, $username, $password) ;
$selected = mysql_select_db("mysql",$dbh) ;

$result = mysql_query("SELECT * FROM user WHERE `ip`=$ip;");
echo "<table><tr> <td>User</td> <td>host</td> <td>ip</td> </tr>";

while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<td>".$row['user'].'</td><td>'.$row['host'].'</td><td>'.$row['ip'].'</td></tr>';;
} echo "</table>";

mysql_close($dbh);
?>
Problems
Result

function db_connect(){
$username = "root";
$password = "";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password) ;
$selected = mysql_select_db("mysql",$dbh) ;
}

function getUsersByIp($ip){
return mysql_query("SELECT * FROM user WHERE `ip`=$ip;");
}

function closeDB(){
mysql_close($dbh);
}
 
function getPresentation($result){
echo "<table><tr> <td>User</td> <td>host</td> <td>ip</td> </tr>";

while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<=<td>".$row['user'].'</td><td>'.$row['host'].'</td><td>'.$row['ip'].'</td></tr>';;
} echo "</table>";
}
 

$ip = $_GET['ip'];

$result = getUsersByIp($ip);

getPresentation($result)

closeDB();
Question
How to implement this?
In a table of fruits, show apples in red.
Symfony in some words
MVC in Symfony
Topics
Learn Symfony






symfony generate:project test

symfony generate:app frontend

symfony generate:module frontend test

symfony propel:build-schema
symfony propel:build-model
symfony propel:build-forms
symfony propel:build-filters


symfony propel:generate-admin frontend Phones --module=phones

symfony plugin:publish-assets

 
Installation

pear channel-discover pear.symfony-project.com
 

> pear install symfony/symfony

downloading symfony-1.2.0.tgz ...
Starting to download symfony-1.2.0.tgz (1,283,270 bytes)
.................................................................
.................................................................
.............done: 1,283,270 bytes
install ok: channel://pear.symfony-project.com/symfony-1.2.0
 

> symfony -V

symfony version 1.2.0 (/path/to/the/pear/symfony/lib/dir)
 
Admin Generator
symfony propel:generate-crud frontend phc Phones
or
symfony propel:generate-admin frontend phc Phones
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16