Posts

Contact us

Loading…
Image
Hacking Tutorials How to hack Comedy Video

PHP Language Full Courses In Hindi English

Home PHP Language PHP Notes PHP Tutorial Hin PHP Tutorial Eng

PHP Notes 8

PHPNotes 8  Lakshman Gupta 9:48 AM 10/8/2019 PHP Notes 8 Lakshman Gupta PHP Tutorial reset($user); // Rewind for the next foreach foreach ($fields as $field) { print " <th>$field</th>\n"; } print " </tr>\n"; $header_printed = true; } // end of print header. // Output data in the record retrieved. print "\t<tr>\n"; foreach ($user as $col_value) { print "\t\t<td>$col_value</td>\n"; } print "\t</tr>\n"; } print "</table>\n"; mysql_free_result($qno); // Free resultset. mysql_close($dblink); // Close connection. ?> Communication with Other Databases Unlike other scripting languages for Web page development, PHP is open-source, cross-platform, and offers excellent connectivity to most of today's common databases including Oracle, Sybase, MySQL, ODBC (and others). PHP also offers integration with various external libraries which enable the developer ...

PHP Notes 7

PHP Notes 7 Lakshman Gupta 9:47 AM 10/8/2019 PHP Tutorial Regular Expressions Regular expressions, a powerful tool for manipulating text and data, are found in scripting languages, editors, programming environments, and specialized tools. Special characters: "/" "-" "^" "." "\" "^" "$" "*" "+" "(" ")" Equivalent Description or Meaning Examples /abc/ search for substring "abc" /[akt]/ search for one of "a", "k" or "t". /[^akt]/ true if string do not have any one of "a", "k" or "t". /[0-4]/ /[01234]/ search for one of "0", "1", "2", "3" or "4" /.../i Case insensitive * Zero or more /abck*pqr/ + One or more /abck+pqr/ \d [0-9] Any decimal digit [0123456789] \D Any character that is not a decimal digit \w [0-9A-Za-z_] Alphanumerics and underscore...

PHP Notes 6

PHP Notes 6 Lakshman Gupta  9:33 AM 10/8/2019 PHP Tutorial <html> .... _A_; .... ?> The following example displays all the cookies releated with the visited site: <?php if (!$_COOKIE) { $_COOKIE = $HTTP_COOKIE_VARS; } foreach ($_COOKIE as $ck => $val) { print "<dd>Cookie name: $ck; value: $val<br />\n"; } ?> Examples: · Webmail: store and use username. · Weather Site: store the selected city in a cookie, and next time the site is visited, the weather of the stored city is automatically displayed. Built-in Variables PHP has a number of built-in variables that give you access to your Web server's CGI environment, form/cookie data and PHP internals. Here are some of the most useful variables: PHP internal variables The $GLOBALS and $PHP_SELF variables shown in the table below are specific to PHP: Variable Name Description $GLOBALS An associative array of all global variables. This is the only variable in PHP that is av...

PHP Notes 5

PHP Notes 5 Lakshman Gupta 9:24 AM 10/8/2019 Calling the function: my_func(); Calling the function: $x = count_a ($name); Calling the function: salary_increase ($salary, 0.1); Calling the function: $xarr = get_values ($k, $m); // Here, $xarr becomes an array PHP Tutorial File System Functions: Open File $fp = fopen(“filename”, “mode”); Open a file, where mode is either “r”, “w” or “a” Close File fclose ($fp); Read a line from file $line = fgets($fp, 4096); Write a string to a file fwrite ($fp, $string); Read all the lines of a file $line = fgets($fp, 4096); while(!feof($fp)) { print "$line<br />\n"; $line = fgets($fp, 4096); } Reads line by line while NOT end-offile. Read all the lines of a file $lines = file ('filename'); foreach ($lines as $line) { print $line; } Reads all the lines of the file in an array; then print the lines. Delete a file unlink ('filename'); See http://www.php.net/manual/en/ref.filesystem.php for m...