Module of the week Webform 7.x-4.0-alpha9 – admin/config/content/webform Add content types, choose allowed fields, default values and advanced options.

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

Aqua Data Studio. Find the application We are using Aqua Data Studio v11.
Accessing Your Data Using Reports, Grids and Queries.
PHP and MySQL Database. Connecting to MySQL Note: you need to make sure that you have MySQL software properly installed on your computer before you attempt.
1.  Understanding about How to Working with Server Side Scripting using PHP Framework (CodeIgniter) 2.
DIMES Planner The DIMES Project Tel Aviv University October-2010.
Publishing your Events with Views & CCK SandCamp 2011 January 8-9, 2011 John Romine (jromine) publishing-your-events-views-cck.
Manipulating MySQL Databases with PHP. PHP and mySQL2 Objectives Connect to MySQL from PHP Learn how to handle MySQL errors Execute SQL statements with.
Objectives Connect to MySQL from PHP
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
This presentation will guide you though the initial stages of installation, through to producing your first report Click your mouse to advance the presentation.
Installing CiviCRM onto Wordpress. How does it work?
Session 5: Working with MySQL iNET Academy Open Source Web Development.
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
INFS 752 Summer Juan Salazar Please right click the symbol in the lower right corner, and then press preview, to hear the presentation for each page.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Introduction to MySQL Lab no. 10 Advance Database Management System.
Installing and Using MySQL and phpMyAdmin. Last Time... Installing Apache server Installing PHP Running basic PHP scripts on the server Not necessary.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
PHP+MySQL Integration. Connecting to databases One of the most common tasks when working with dynamic webpages is connecting to a database which holds.
Present :Arezoo Mollahasani. Step 1  Define your server connection Open MySQL WorkBench and click New Server Instance on the right of the window.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Session 7: Getting PHP to Talk to MySQL. Objectives Connecting to the Database Building & Executing the SQL SELECT Query Fetching & Displaying the data.
A Brief Documentation.  Provides basic information about connection, server, and client.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
PHP Database Processing CIS 1715 Web Technologies.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
Introduction to Views Stanford Drupal Camp April 6, 2013.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
Oracle Data Integrator User Functions, Variables and Advanced Mappings
>> PHP: MySQL & CRUD. R ecall Database Tables Records is composed of Operations (CRUD) Create Retrieve Update Delete DBMS Access Control MySQL phpMyAdmin.
© 2012 LogiGear Corporation. All Rights Reserved FitNesseFitNesse Authors: Nghia Pham 1.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
Working With Database Library And Helpers. Connecting to your Database First you need to set parameters in you database.php file residing in config folder.
Integrating Crystal Reports with SIGNZ (V3.59, July 2008) Integrating Crystal Reports with SIGNZ (V3.59, July 2008)
MYSQL AND MYSQL WORKBENCH MIS2502 Data Analytics.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
Joomla Awdhesh Kumar Singsys Pte Ltd. What is Joomla? Joomla is an award-winning content management system (CMS), which enables you to build Web sites.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
Portfolio Analyzer Extender v. 1240
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
WEB APPLICATION TESTING
CS320 Web and Internet Programming SQL and MySQL
What your client has: Server(s) running WordPress Zend Framework
Data Virtualization Demoette… ADO.NET Client
mysql and mysql workbench
Dynamic Input with SQL Queries
Easy Way to Reset WordPress Admin Password on Localhost? Guided By: WPGLOBALSUPPORTWPGLOBALSUPPORT.
Chapter 7 Working with Databases and MySQL
Chapter 8 Working with Databases and MySQL
Lecturer: Yong Liu Contact me at:
CIS16 Application Programming with Visual Basic
Developing a Model-View-Controller Component for Joomla Part 3
Taverna Tutorial exercise 2: REST services from BioCatalogue
PHP: Database Basic Selection FdSc Module 109
PHP: Database connection
CS3220 Web and Internet Programming SQL and MySQL
CS3220 Web and Internet Programming SQL and MySQL
Presentation transcript:

Module of the week Webform 7.x-4.0-alpha9 – admin/config/content/webform Add content types, choose allowed fields, default values and advanced options – Create node as normal – Click webform – Add fields as needed to form. – Add conditionals and validation after fields

Accessing External Databases Outline settings.php db_set_active Queries – db_query – db_select Accessing Results – foreach – ->fetchAssoc()

settings.php Manual – Use your favorite text editor – File found in sites/sitename/settings.php – Sample in sites/default/settings.php – Each entry is an array in the array $databases – Main database is $databases[‘default’][‘default’]=array(…

settings.php Manual (continued) – Other databases are generally $databases[‘handle’][‘default’]=array(… – Slave databases are $databases[‘handle’][‘slave’][]=array(… – Prefix arrays are mainly used for multiple sites sharing a database.

settings.php Manual (continued) – Required Fields ‘driver’ => ‘mysql’ | ‘pgsql ‘| ‘sqlite’ – Normal Fields (for mySQL, pgSQL, MariaDB) ‘username’ = ‘Username’, ‘password’ => ‘Password’, ‘host’ => ‘hostname of server’ | ‘localhost’, ‘database’ => ‘name in server’, ‘port’ => ‘portnumber’, (often 3306)

settings.php Manual (continued) – Normal Fields (for sqlite) ‘database’ => ‘path on local server’, – Optional Fields ‘prefix’ => array( ‘default’ => ‘prefix1’, ‘tablename1’ => ‘prefix2’, ‘tablename2’ => ‘prefix3’, … ), ‘prefix’ => ‘prefix’,

settings.php AED – Attach External Databases drupal.org/sandbox/kwfinken/ Install as normal Adding a database to settings.php – Configuration|Development|aed: – Type in database connection info. – Click [Save Settings and Add this Database] – Click on the name of the Database – Click [Add to settings.php]

AED Remove a Database from settings.php (only works if installed by AED) – Click the name of the database – Click [Remove from settings.php] Edit Database connection info – Remove from settings.php as above – Click the name – Make the changes – Click Update – Add to settings.php as above

db_set_active Tells drupal which database to access Syntax: db_set_active(‘database_handle’); /* database related code */ db_set_active(); Always minimize the code between setting the database and returning to default. Normal Drupal functions won’t work between these.

Queries Between db_set_active()s db_query($query,$args,$options) – $query = ‘some sql query’ $result = db_query($query); – optional arguments $args() – array of parameters to substitute into query Use a named array of format ‘:name’=>value, to substitue for :name in query $options() – list of options to control how the query executes

Queries Between db_set_active()s db_select($table,$alias,$options) – Use a string of methods to add details: ->fields(‘alias’,[array(‘fields’, …)]) ->condition(‘field’, comparison, ‘operator’) – Comparison is a value or an array of values ->join(‘table2’, ‘alias’, ‘join’) ->groupBy(‘alias.field’) etc. ->execute()

Queries Between db_set_active()s db_select($table,$alias,$options) – Example: $result = Db_select(‘hours’,’h’)->fields(‘h’,array(‘date’, ‘open_time’, ‘close_time’)) ->condition(‘h.date’, $today, ‘>=’) ->groupBy(‘h.date’) ->execute();

Accessing Results Comes after db_set_active() foreach – foreach($result as $row){ $row->fieldname; } $row=$result->fetchObject() – $row->fieldname;

Accessing Results Comes after db_set_active() $row=$result->fetchAssoc() – $row[‘fieldname’]; – foreach($row as $field=>$value){ $value; $field; } – foreach($row as $value){ $value; }

Where does this code go? Custom Module – Preferred Method A text area configured to “PHP code” filter. – This is generally considered unsafe! References: – 40c7d5f b73c47a56a08287c88 better for DB functions. 40c7d5f b73c47a56a08287c88 – aeb771ecac ffa536b233caf better for Module Development aeb771ecac ffa536b233caf