Programming methodology and web rapid prototyping session 5
1 / 22

Programming Methodology and Web Rapid Prototyping (Session 5) - PowerPoint PPT Presentation

  • Uploaded on

Programming Methodology and Web Rapid Prototyping (Session 5). TC101 , 5 Sessions course, Conducted by Solvith Lesson Objectives. Session 5 [24 Aug] String Basics (30 mins ) Database (Brief) (30 mins ) Agile Development (1 Hour) Test (1 Hour)

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' Programming Methodology and Web Rapid Prototyping (Session 5)' - lamya

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Programming methodology and web rapid prototyping session 5

Programming Methodology and Web Rapid Prototyping (Session 5)

TC101 , 5 Sessions course, Conducted by Solvith

Solvith PHP Course- James Song (81273798)

Lesson objectives
Lesson Objectives

Session 5 [24 Aug]

  • String Basics (30 mins)

  • Database (Brief) (30 mins)

  • Agile Development (1 Hour)

  • Test (1 Hour)

  • Project Presentation(1 Hour)

  • Break And Closing

Solvith PHP Course- James Song (81273798)

Php strings
PHP Strings

A string is series of characters. In PHP, a character is the same as a byte, which is exactly 256 different characters possible.


$s=“I am a string”;

$s2=‘I am also a string”;

print $s.”---”.$s2;


Php strings1
PHP Strings

Another Example


$beer = 'Heineken';

echo "<br>$beer's taste is great."; // works, "'" is an invalid character for varnames

echo "<br>He drank some $beers."; // won't work, 's' is a valid character for varnames

echo "<br>He drank some ${beer}s."; // works

echo "<br>He drank some {$beer}s."; // works


Important string functions
Important String Functions

  • explode (string $delimiter, string $string)

  • nl2br ( string $string )

  • strcmp ( string $str1, string $str2 )

  • strlen ( string $string )

  • strtolower ( string $str )

  • substr ( string $string, int $start [, int $length] )

  • trim ( string $str)

Php and databases
PHP and Databases

  • PHP supports about 20 RDBM servers

    • Including MySQL, Oracle, MS SQL, DB2, Firebird and Paradox

    • Supports connection over ODBC driver

    • Provided different sets of functions for accessing the different RDBMS

      • Each function starts with prefix – the DB server typeExample: mysql_connect, mssql_query, etc

Connecting mysql
Connecting MySQL

  • mysql_connect – function to connect to MySQL server

    • Parameters: $server, $username, $password, $new_link, $client_flags

    • Returns resource result, identifying the new link (link identifier)

      • The result is used as parameter to other mysql_ functions

mysql_connect("localhost", "root", "rootpass");

Connecting mysql 2
Connecting MySQL (2)

  • Once connected a database must be selected to perform queries upon

    • In some cases it is not required – show databases query for instance

    • mysql_select_db ($dbname, $link) – selects database from the server

      • Returns true if successful

$dblink = mysql_connect("local host", "root", "rootpass");

mysql_select_db("mydb", $dblink);

Executing query
Executing Query

  • mysql_query ($query, $link) – execute query on database

    • $query is string – the query to be executed

    • $link is database link identifier

    • The returned result depends on the query

      • If query is select, show, describe, explain – returns resource or false on error

      • Otherwise true if successful, false on error

    • The link parameter can be omitted in all mysql_ functions if working with only one database

      • Only one call to msql_connect in the script

mysql_query("select * from users", $dblink);

Select query results
Select Query Results

  • PHP provides several functions for working with MySQL select query results

    • mysql_query returns resource when performing select query that holds the data

    • The result is accessed row-per-row from first towards last with internal pointer

  • Additional functions to get number of affected rows on update/delete or auto-generated id of inserted row

Fetch row from result
Fetch Row From Result

  • mysql_fetch_row – returns numerical array, containing the current row from the result and moves the pointer to the next row

    • Returns false if there are no more rows

$res = mysql_query ("select id, name from people");

$row = mysql_fetch_row($res);

if ($row)

print_r($row); // 0->id, 1->name


echo "No results!";

Fetching row from result 2
Fetching Row From Result (2)

  • mysql_fetch_assoc – returns associative array containing the current row in result and moved the pointer to the next one

    • The field names are keys in the array

    • Returns false if no more rows

$res = mysql_query ("select id, name from people");

$row = mysql_fetch_assoc($res);

if ($row)

echo "Name: ".$row['name'];

Fetching single value
Fetching Single Value

  • mysql_result ($result, $row, $field) – return the value or single cell In MySQL query result

    • $field is either field index or name

    • Returns false on failure

    • Must NOT be mixed with other functions for reading query result

    • Much slower than fetching data row-per-row

$res = mysql_query ("select count(*) from people");

echo mysql_result($res, 0, 0);

Number of rows
Number of Rows

  • mysql_num_rows ($result) – returns the number of rows in the result set

    • Does not work with unbuffered queries (mysql_unbuffered_query)

$res = mysql_query ("select id, name from people");

$count = mysql_num_rows($res);

echo $count;

What is agile
What Is Agile

  • Agile --readiness for motion, nimbleness, activity, dexterity in motion

  • Agility

    The ability to both create and respond to change in order to profit in a turbulent business environment

    • Companies need to determine the amount of agility they need to be competitive

  • Chaordic

    • Exhibiting properties of both chaos and order

      • The blend of chaos and order inherent in the external environment and in people themselves, argues against the prevailing wisdom about predictability and planning

      • Things get done because people adapt, not because they slavishly follow processes

  • Agile software development
    Agile Software Development

    • Agile software development is a conceptual framework for software engineering that promotes development iterations throughout the life-cycle of the project.

    • Software developed during one unit of time is referred to as an iteration, which may last from one to four weeks.

    • Agile methods also emphasize working software as the primary measure of progress

    Agile software development intro
    Agile Software Development: Intro

    • Characteristics of Agile Software Development

      -- Light Weighted methodology

      -- Small to medium sized teams

      -- vague and/or changing requirements

      -- vague and/or changing techniques

      -- Simple design

      -- Minimal system into production

    Agile software development intro1
    Agile Software Development: Intro

    • Do not reinvent the wheel

      • Use open-source if possible

    • Prototype first. Optimize Later

    • Change if need to during development