Download - Eden Hackathon Benilde (Mysql & SMTP)
The most Powerful tool in
Eden
What are the thingsyou can doin Mysql?
• Insert
• Select
• Update
• Delete
<?php
//Create connection$connection = mysql_connect(‘localhost’, ‘root’, ‘’);mysql_select_db(‘eden’, $connection);
//Inserting Data$query = “INSERT INTO user (
user_name,user_email, user_password)
VALUES (‘dan’, ‘[email protected]’, ‘1234abcd’)”;
//Selecting Data$query = “SELECT * FROM userWHERE
user_email = ‘[email protected]’”;
//Updating Data$query = “UPDATE user SET
user_name = ‘dan michael’WHERE
user_email = ‘[email protected]’”;
//Deleting Data$query = “DELETE FROM user WHERE
user_email = ‘[email protected]’”;
//Execute your querymysql_query($query);
//Close your connectionmysql_close($connection);
//Get the result and output
Are You Tired ofdoing that?
Guest What?
How Mysql in Eden Works!
<?php//1. Include eden.php single fileInclude(‘eden.php’);
//2. Create a DB connection$database = eden(
‘mysql’, ‘host’,‘db_name’, ‘user’,
‘password’);
//Set all fields you need//Then save$database->model()
->setColumnName(‘[Value]’)->setColumnName(‘[Value]’)->save(‘[Table]’)
Inserting Data Using Model
//Set all fields you need//Then save$database->model()
->setUserName(‘Dan’)->setUserPassword(‘123abc’)->save(‘user’)
//Select data, update and save.$database->search(‘user’)
->innerJoinOn(‘school’, ‘school_id = user_school’)->leftJoinOn(‘address’, ‘address_user = user_id’) ->getCollection()->setAddressCreated(time())
->setSchoolYear(‘2010 - 2012’)->setAddressCity(‘Makati’)->copy(‘user_id’, ‘address_user’)->save(‘school’)->save(‘address’);
Select, Update & Deleting Data
SMTP
//Setup connection$smtp = eden('mail')->smtp(
‘[smtp server]’, ‘[email account]’, ‘[password]’, ‘[port]’, Boolean);
//Setup connection$smtp = eden('mail')->smtp(
‘smtp.gmail.com’, ‘[email protected]’, ‘password’, 465, true);
//Complete your email$smtp->setSubject(‘[Subject]’)
->setBody(‘[Body]’, Boolean)->addTo(‘[Email Account]’)->addCC(‘[Email Account]’)->addBCC(‘[Email Account]’)->addAttachment(
‘[Filename]’, ‘[File Path]’,‘[Image Mime]’)
->send();
//Complete your email$smtp->setSubject(‘Hello SMTP’)
->setBody(‘<b>This is the body</b>’, true)->addTo(‘[email protected]’)->addCC(‘dummy@gmail’)->addBCC(‘[email protected]’)->addAttachment(
‘file.jpg’, ‘/path/file.jpg’,‘mime-type’)
->send();
$smtp->disconnect();
Thank You!