Sunday, February 9, 2014

HOW determine PRIMA numbers in PHP


HOW determine PRIMA numbers in PHP

PRIMA NUMBERS THAT CAN ONLY NUMBERS ARE SHARED
1 AND FIGURES WITH ITSELF
$ n = ... / / please insert here the value of N
$ status = " PRIMA " ;
for ( $ i = 2 ; $ i < = $ n - 1 ; $ i + + )
{
if ( $ n % $ i == 0 )
{
$ status = " NO PRIMA " ;
break;
}
}
echo " Numbers " . $ n . " is : " . $ status ;
? >
The result will be like this :
when we enter the number 2 in $ n it would appear
" number 2 is : prima "


HOW TO DETERMINE IN PHP Fibonacci Numbers

FIBONANCI NUMBERS NUMBERS ARE THE NUMBERS PRIOR DITAMBAHAKAN MIS :
SETERUSNYAINI 1,1,2,3,5,8,13 AND HOW TO DISPLAY NUMBERS AS MUCH N FRUIT FIBONANCI

 $ ne = ..... ; / / please enter the number or value of $ s1st HERE N = 1 ;
 $ s2nd = 1 ;
   echo " $ s1st $ s2nd " ;
 for ( $ i = 3 ; $ i < = $ ne , $ i + + ) {
  $ s1st + Snow = $ $ s2nd ;
    echo " $ Snow " ;
 $ s1st = $ s2nd ;
 $ s2nd = $ snow ;
 }
The result will be like this :
If we input the numbers in $ ne = 8
it will display 8 digit Fibonacci numbers
ie 1,1,2,3,5,8,13,21
Posted by myori ( widiyanti ) at 20:27 No comments :
reaction :

FRIDAY , 02 OCTOBER 2009



understanding HTML
HTML ( HyperText Mark -up Language) is a method to implement the concept of hypertext in a manuscript or document . HTML itself is not classified in a programming language because it is just marking ( marking up ) on a manuscript text and not as a program .

Based on its constituent words can be interpreted HTML deeper into :

hypertext
Hypertext link is a word or phrase that can show the relationship of a text document with other manuscripts . If we click on a word or phrase to follow this link then the web browser will move the display to the other parts of the manuscript or document which we are headed .

markup
In understanding here the markup indicates that the HTML file contains a specific instruction that can provide a format in which the document will be displayed on the World Wide Web .

Language
Although HTML itself is not a programming language , HTML is a collection of some of the instructions that can be used to vary the format a manuscript or document

Set of HTML tags
1 ( ---- ) Make comments or captions . Sentence which is located on the kontiner tag will not be visible in browser
2 (a href ) Creates a link to another page or to another part of the page
3 (a name ) Create a section name defined on the link on the same page
4 ( applet ) In the beginning of Java applets
5 ( area ) Defines a clickable area ( link ) to image map
6 ( b ) Make a bold text
7 ( BASEFONT ) Make the default text attributes such as type , size and color of the font
8 ( bgsound ) Giving ( background noise ) background sound on a web page
9 ( big ) Increase text size by one point from the default
10 ( blink ) Creating blinking text
11 (body ) start tag to perform various settings of the text , link color and visited link
12 ( br ) Move the line
13 ( caption ) Create a caption on the table
14 ( center ) to the middle of the alignment of text or images
15 ( comment) Leaving a comment on a web page not will not appear on the browser
16 ( dd) Indents text
17 ( div ) Represents different sections of text .
18 ( embed ) Adding sound to a avi file or web page
19 ( fn ) As the tag (a name)
20 ( font ) Changing the type , size , font color that will be used for text
21 ( form) Defines input form
22 ( frame ) Defines the frame
23 ( frameset ) Defining attributes that the page will use the frame
24 ( h1 ... h6 ) Font Size
25 ( head ) Defines the document head .
26 ( hr ) Make a horizontal line
27 ( html ) html document bararti
28 ( i ) Making italic text
29 ( img ) image , imagemap or an animation
30 ( input ) Defines input fields on the form
31 ( li ) Make bullet points or a new line in the list ( paired with the tag ( dir ) , ( menu ) ( ol ) and ( ul )
32 ( map ) Defines the client-side map
33 ( marquee ) Creating scrolling text ( text runs ) - only in MS IE
34 ( nobr ) Preventing line breaks in the text or images
35 ( noframes ) If the user 's browser does not support frames
36 ( ol ) Defining the beginning and end of the list
37 ( p ) Replace paragraph
38 ( pre ) Create a text with the same font size
39 ( script ) Defines the initial script
40 ( table ) A table
41 ( td ) column in the table
42 ( title ) Defining title
43 ( tr ) row in the table
44 ( u ) Make underlined text

How do you connect to the mysql database to connect to MySQL phpUntuk there are two functions that can be used . The first is to use the mysql_connect function . Function syntax is as follows .
resource mysql_connect ( [ string server [ , string username [ , string password [ , bool new_link [ , int client_flags ] ] ] ] ] )
Examples of its use are as follows. $ Conn = mysql_connect ( ' localhost ' , ' root ' , ' passwordku ' ) ;
if ( $ conn ) {
die ( ' Connection to MySQL failed : ' . mysql_error ( ) ) ;
}
echo ' Connecting to MySQL with the mysql_connect success ! ! ' ;
mysql_close ( $ conn ) ;
? >

We see above there mysql_connect command whose primary function is to connect to the MySQL database . For the above example the MySQL server on the localhost with the username root and password is passwordku . There is an important note to remember here . Since version 4.1 , MySQL has been using the new system authentication protocol based on a hashing algorithm . This makes the connection using the old client will fail and will generate an error message like the following.
Client does not support authentication protocol requested by server ; Consider upgrading MySQL client
Do not be afraid . The author personally experienced the same when tested with PHP 4.3.11 and MySQL 4.1.11 this . The solution is easy and there are several ways . According to the manual MySQL 4.1.11 , it can be overcome by resetting the password of the user that can be accessed by the client version of the old one. This is done using the SET PASSWORD command and also functions OLD_PASSWORD ( ) . An example of doing this is as follows .
mysql > SET PASSWORD FOR
- > ' Some_user ' @ ' some_host ' = OLD_PASSWORD ( ' newpwd ' ) ; You can replace ' some_user ' with the user that you use and the ' some_host ' with your host ( usually localhost ) . Then in the newpwd fill in your password .
Persistent connection
In addition to using the mysql_connect function , it could also use mysql_pconnect functions . What's the difference ? It is the function of connecting to MySQL with persistent manner . Once we have a persistent connection to the database server then this connection continues to establish connection to the database server . In principle, the same as the function mysql_pconnect mysql_connect only two differences are:
1 . During the connection holding this function will look for a persistent link that is connected to another host, user and password are the same . If the link is found then the identifier of the connection or the link will be given to the client and the client will not hold a new connection to the server dataase .
2 . Connection to the database will not be closed when the execution of a SQL script is completed. In the mysql_connect function , the connection will automatically be disconnected shortly after a SQL script is executed . In mysql_pconnect function , the connection to the database will continue to happen and will not be disconnected although you use mysql_close function .
The basic syntax of the use of mysql_pconnect function is as follows .
resource mysql_pconnect ( [ string server [ , string username [ , string password [ , int client_flags ] ] ] ] )
Examples of his PHP code mysql_pconnect function can be seen in the following code . $ Conn = mysql_pconnect ( ' localhost ' , ' root ' , ' ariesa2001 ' ) ;
if ( $ conn ) {
die ( ' Connection to MySQL failed : ' . mysql_error ( ) ) ;
}
echo ' Connecting to MySQL successfully with mysql_pconnect ! ! ' ;
? >

which obviously must create a database connection script For example koneksi.php
Scr outline code themselves like this:


$ host = " localhost " ;
$ username = " root " ;
$ password =

$ database = " database name " ;

/ / create the connection
$ conn = mysql_connect ( $ host , $ username , $ password )

/ / create the connection check

if ( $ conn )
{

echo ( " Connection Failed " ) ;

}

$ result = mysql_select_db ( $ database ) ;
if ( $ result )
{

echo ( " Database Failed " ) ;

}


? >

0 comments:

Post a Comment