http___programlama.venus.gen.tr_kategori_asp_1.xml
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 16.2 17.1 18.1 19.1 20.1 21.1 23.1 24.1 25.1 26.1 28.1 29.1 29.2 30.1 30.2 31.1 32.1 33.1 34.1 35.1 36.1 37.1 38.1 39.1 40.1 41.1 42.1 43.1 44.1 45.1 46.1 47.1 48.1 49.1 49.2 50.1 51.1 52.1 53.1 54.1 55.1 56.1 57.1 58.1 59.1 59.2 60.1 61.1 62.1 63.1 64.1 65.1 66.1 67.1 68.1 69.1 70.1 71.1 72.1 73.1 74.1 74.2 75.1 75.2 76.1 77.1 78.1 79.1 80.1 80.2 81.1 82.1 83.1 84.1 85.1 86.1 87.1 88.1 89.1 90.1 91.1 92.1 93.1 94.1 95.1 96.1 96.2 97.1 98.1 99.1 100.1 101.1 102.1 103.1 104.1 105.1 106.1 107.1 108.1 109.1 110.1 111.1 112.1 113.1 114.1 115.1 116.1 117.1 118.1 119.1 120.1 121.1 122.1 123.1 124.1 125.1 126.1 126.2 127.1 128.1 129.1 130.1 131.1 132.1 133.1 134.1 135.1 136.1 137.1 138.1 139.1 140.1 141.1 142.1 142.2 143.1 144.1 145.1 146.1 147.1 148.1 149.1 149.2 150.1 150.2 151.1 151.2 152.1 153.1 153.2 154.1 155.1 156.1 156.2 157.1 157.2 158.1 158.2 159.1 159.2 160.1 161.1 162.1 163.1 164.1 165.1 166.1 167.1 168.1 169.1 170.1 171.1 172.1 173.1 174.1 175.1 176.1 177.1 178.1 179.1 180.1 181.1 182.1 182.2 183.1 184.1 185.1 186.1 187.1
What is PHP? PHP is a server side scripting language used for web development applications. Php is the powerful tool for making dynamic website. Many open source, free and commercial scripts and Stuff made by php What is a data type? A Data type is the classification of data into a category according to its attributes; • Alphanumericcharacters are classified as strings • Whole numbersare classified integers • Numberswith decimal pointsare classified as floating points. • True or falsevalues are classified as Boolean. PHP is a loosely typed language;it does not have explicit defined data types. What is a variable? A variable is a name given to a memory location that stores data at runtime. The scope of a variable determines its visibility. A global variable is accessible to all the scripts in an application. A local variable is only accessible to the script that it was defined in. How to retrieve a secure URL? To retrieve secure URLs, the cURL extension needs access to an SSL library, such as OpenSSL. $c = curl_init('https://secure.example.com/accountbalance.php'); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $page = curl_exec($c); curl_close($c); Why you should use variables? Variables help separate data from the program algorithms. The same algorithm can be used for different input data values. For example, suppose that you are developing a calculator program that adds up two numbers, you can create two variables that accept the numbers then you use the variables names in the expression that does the addition. How to show all PHP runtime errors? Add error_reporting function set 1 . What is htaccess? .htaccess files are configuration files of Apache Server which provide a way to make configuration changes on a per-directory basis. How to redirect a user to a page? header('Location: http://www.example.com/'); The redirect URL must include the protocol and hostname. What is echo in php? It is a keyword. It is used to print data on the webpage, like that   , How to include a file to a php page? Add include a file using include() or require() function with the path. What's the difference between include and require? PHP provides two constructs to load code and HTML from another module: require and include. They both load a file as the PHP script runs, work in conditionals and loops, and complain if the file being loaded can't be found. The main difference is that attempting to require a nonexistent file is a fatal error, while attempting to include such a file produces a warning but does not stop script execution. If the file is not found by require(), it will gives a fatal error and stop the execution of the script. If the file is not found by include(), it will gives a warning , but execution will continue. will not get the "function re-declared" error. Differences between GET and POST methods ? A GET request encodes the form parameters in the URL, in what is called a query string: /path/to/chunkify.php?word=despicable&length=3 A POST request passes the form parameters in the body of the HTTP request, leaving the URL untouched. POST requests are not idempotent. This means that they cannot be cached, and the server is recontacted every time the page is displayed. How to declare an array php? Example : var $arr = array('ie', 'firefox', 'safari'); What is the use of 'print' in php? This is not actually a real function, It is a language construct. So you can use with out parentheses with its argument list. What is in_array() function? The in_array( ) function returns true or false, depending on whether the first argument is an element in the array given as the second argument. in_array used to checks if a value exists in an array that Searching for Values of array. What is count() function in php ? The count( ) and sizeof( ) functions are identical in use and effect. They return the number of elements in the array. What’s the difference between include and require? It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue. What is the difference between Session and Cookie? sessions are stored on the server, and cookies are stored on the client’s computers in the text file format. A cookie is a bit of information that the server can give to a client. Every session has a data store associated with it. You can register variables to be loaded from the data store when each page starts and saved back to the data store when the page ends. How to set cookies in PHP? Setcookie("test", "sem", time()+3600); How to Retrieve a Cookie Value? echo $_COOKIE["test"]; How to create a session? Create session by session_start(); How to set a value in session ? Set value into session by $_SESSION['test_ID']=1987654; How to Remove data from a session? Remove data from session -> session_unset($_SESSION['test_ID']; How to create a mysql connection? call mysql_connect(servername,username,password); How to select a database? call mysql_select_db($db_name); How to execute an sql query? How to fetch its result ? $my_qry = mysql_query("SELECT * FROM `test` WHERE `test_id`='16'; "); $result = mysql_fetch_array($my_qry); echo $result['First_test_name']; How to get the resultset of MySQL using PHP? mysql_fetch_row mysql_fetch_array mysql_fetch_object mysql_fetch_assoc How to strip whitespace or other characters from the beginning and end of a string ? The trim() function removes whitespaces or other predefined characters from both sides of a string. What is the use of header() function in php ? The header() function sends a raw HTTP header to a client browser. Remember that this function must be called before sending the actual out put. For example, You do not print any HTML element before using this function. How to redirect a page in php? The following code can be add for it, header("Location:test.php"); How stop the execution of a php scrip ? exit() function stop the execution of a page. How to get the length of a string? strlen() function gives the length of a string How to generate random numbers in php? Add rand function to generate random numbers. How to varify a variable in php? This is_set function is used to determine if a variable is set and is not . What is mean by an associative array? Associative arrays are arrays that indexed by string keys is called associative arrays. How do you define a constant? Using define() directive, like that define ("MYCONSTANT",765754); How send email using php? To send email using PHP, you use the mail() function. This mail() function accepts 5 parameters How to find current date and time? The date() function gives the current date and time . What is the use of ksort in php? Its sort an array by key in reverse order. Who is the father of PHP ? Rasmus Lerdorf is known as the father of PHP. How to delete a file from the system? Unlink() deletes the file from the file system. How to get the value of current session id? session_id() function gives the session id for the current session. What is the difference between $name and $$name? $name is variable where as $$name is reference variable like $name=sonia and $$name=singh so $sonia value is singh. mysql_fetch_object vs mysql_fetch_array? mysql_fetch_object() is similar tomysql_fetch_array(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets numbers are illegal property names In PHP for pdf which library used?. The PDF functions in PHP can create PDF files using the PDFlib library With version 6, PDFlib offers an object-oriented API for PHP 5 in addition to the function-oriented API for PHP 4. There is also the » Panda module. FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression and GD for GIF support) and works with PHP4 and PHP5. How to Connecting two Strings? a useful concept—concatenation. It refers to the process of linking items together. Specifically in programming, you concatenate strings. The period . is the operator for performing this action, and it's used like so: $tString = $String1 . $bString2; echo $tString; Why we use strstr? strstr returns all of string after the first occurrence of substring . If substring doesn't exist in string , the function returns FALSE. How to capitalize only the first character of a string? $txt = "welcome to the this site"; echo $ucfirst($txt); What three components need to create a dynamic web page? A web server, a server-side programming language, and a database. What does Apache use to load extensions? Modules. What does the PHP Interpreter do? It processes the HTML and PHP files. What's a more secure function than md5() for encoding passwords? The sh1() function creates a 160-bit key instead of md5()'s 128-bit string. It also uses a superior algorithm for making it difficult to determine the values that generate a particular encoding. What are the advantages of using PEAR? The PEAR functions are more compact, and they automate some of the manual work of connecting to and selecting from the database. Because PEAR code is used by many developers, it is less likely to have an error than to have code that's written from scratch. Learn Php Code
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 20.1
Bu yazımızda MySQL veritabanına ASP ve PHP’de nasıl bağlantı sağlanacağımızı ve veri çekebileceğimizi öğreneceğiz. Öncelikle ASP ile başlayalım. ASP’de bir MySQL bağlantısı için ADODB objesinden yararlanırız. Set Baglanti = Server.CreateObject("ADODB.Connection") Baglanti.Open "Driver={MySQL ODBC 3.51 Driver};Server=sunucu_adres;Database=db_adi;Port=3306;Uid=kullanici;Password=sifre;" Set Kayitlar = Baglanti.Execute( "SELECT * FROM tablo_adi ORDER BY id DESC LIMIT 0, 10;" ) Do While Not Kayitlar.Eof Response.Write Kayitlar("alinacak_veri") + " " Kayitlar.MoveNext Loop Baglanti.Close Yukarıda geçen “Baglanti” ve “Kayitlar” birer değişken olup. Biri bize bağlantımız hakkında bilgi verir, diğeri ise Baglanti.Execute() ile istediğimiz kayıtları barındırır. Bağlantıyı Baglanti.Close() ile kapatmayı unutmayın. Yukarıda yer alan Kayitlar.EOF bir mantıksal değer olup ancak kayıt listelemeleri bittikten sonra true (doğru) karşılığını verir. Kayitlar.MoveNext ise bir sonraki kaydı istemek için kullanacağımız koddur. Yukarıda bağlantıyı sağlarken kullanılan sunucu_adresi, db_adi, kullanıcı, şifre bilgilerini doğru yazmazsanız bağlantı sağlanamaz. Bunlar MySQL’e bağlantı için gereklidir. Peki PHP’de MySQL’e nasıl bağlanırız? Yukarıda yazdığımız ASP kodunu birebir PHP’ye dönüştürecek olursak aşağıdaki gibi bir kodlamaya gideriz. mysql_connect('sunucu_adresi','kullanici','sifre'); mysql_select_db('db_adi'); $sorgu = mysql_query( "SELECT * FROM tablo_adi ORDER BY id DESC LIMIT 0, 10;" ); while( $kayitlar = mysql_fetch_array( $sorgu ) ) echo $kayitlar['alinacak_veri'] . ' '; mysql_close(); Yukarıda göreceğimiz gibi bağlantımızı mysql_connect() ile sağlıyoruz. Parantez içine sırasıyla sunucu adresi, kullanıcı adı ve şifresi yazılır. mysql_select_db() ile hangi veritabanını kullanacağımızı seçtikten sonra bağlantıyı sağlamış oluruz. Eğer birden fazla veritabanı ile işlem yapacaksanız mysql_select_db’den sonra bir de bağlantı için atayacağınız bir değişken kullanmalısınız. Sorgu cümlemizi mysql_query() komutuyla yazdıktan sonra kayıtları mysql_fetch_array ya da mysql_fetch_assoc ile alırız. Sıralama için kolaylık olması açısından while() döngüsü kullandık. Burada başka bir değişken olarak kayıtların depolanacağı arraylist (dize) yi belirttik ($kayitlar) ve finalde mysql_close() ile veritabanı bağlantısını kapattık. (NOT: Bir PHP belgesi mutlaka “ ” ile biterken, ASP belgesi “ ” ile biter. Kodlar ile ilgili alıştırma yaparken bunu dikkate almayı unutmayın.