<?

// mysql_connect('localhost','abu-jeib','iyad911');
@$d = mysql_connect('localhost','database_username','database_password') or die("Can't connect");
#require_once("/home/abu-jeib/php/connect.php");
//exit("Can't connect"); // OK

@mysql_select_db('Iyad1') OR die ("Can't select the database");

/*$s = mysql_select_db('Iyad1');
if ($s)
	echo "DB selected successfully.<BR>";
else
	die("Can't select DB.<BR>"); // y can use: exit("Can't select DB.<BR>");
*/

$q = "insert into t1(grade,name,id) values (75,'C. West',12)";
@mysql_query($q) OR die ("Can't perorm the query");

/*
$r = mysql_query($q);
if ($r)
        echo "Query Successful<BR>";
else
        die("Query Failed<BR>");
*/

$q = "select * from t1 where name like '%s%'";
#$q = "select * from t1;
$r = mysql_query($q) or die("<p>Can't perform query.</p>");

//$r = @mysql_query($q);

@$number_of_rows = mysql_num_rows($r);
echo "Number of Rows = $number_of_rows<br>";

for ($i = 0; $i < mysql_num_fields($r);$i++)
        echo mysql_field_name($r,$i), " ";
echo "<BR>";

while (@$row = mysql_fetch_row($r))
{
	for ($i = 0; $i < mysql_num_fields($r);$i++)
	        echo $row[$i], " ";
	echo "<BR>";
}

@mysql_close($d) or die(); 
?>
