Saturday, April 4, 2009

Learn PHP--database connection

Today I review my PHP work which is about database connection using php.

the code is :
session_start();
function conncetdatabase(){
$user="potiro";
$pass="pcXZb(kL";
$db="poti";
$connection=mysql_connect("sally.it.uts.edu.au",$user,$pass);

if (!$connection)
die("Unable to connect to host.");

if (!mysql_select_db($db, $connection)) {
echo "Error Description: ".mysql_error()."
";
die("Database unavailable, exiting program.");
}

return $connection;
}

function disconnect($connection) {
mysql_close($connection);
}
\?>

This is code for connecting to the database.

And today I download the user manual for PHP and MySql. I think that is quite easy

and important for me to look for some information about PHP or MySql on a user book.

I use to search the info on Internet, such as google , yahoo.

Thursday, April 2, 2009

Free host dont support SMTP server

Today I want to use mail function in 000webhost.com.

But it does not works even the code works in my computer.

So when I do some research, I find that the 000webhost.com dont have free SMTP

server for free host. If you want to use it, you need to paid.

That means if you want to use mail function in php file, it will not works.

So my website can not send the email with clients information to me for this problem.

I need to figure out it. Maybe I just store client's info into the database or just

pay for the website to give me SMTP server.

Wednesday, April 1, 2009

Leanr PHP--mail()

Today I set up a PHP programming platform in my laptop.

But when I want to use mail() function to send mail using php, it does not work.

But when I upload the php file to uts server. It works. I search this on internet,

And I found the reason. Even though I already set up the apache http server. But I

still need to set up a mail server into my laptop. In this case, I install imail.

Then it works.