- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1466 Articles for PHP
182 Views
The chgroup() function updates the file group. Remember that only the superuser has the authority to change the group of a file arbitrarily,Syntaxchgroup($file_path, group)Parametersfile_path − Set the path of file or directory to be checked. Required.group − Set the new user group name or number.ReturnThe chgroup() function returns.True, on success,False, on failureExampleThe following is an example that checks for file “one.txt” and changes its file group.OutputTRUE TRUE
302 Views
The basename() function gets the the filename component of a path. The file path is set as a parameter.Syntaxbasename(file_path, suffix)Parametersfile_path − Set the path of file or directory to be checked. Required.suffix − Set the extension of the file. Optional.ReturnThe basename() function returns the basename of the file.ExampleThe following is an example that checks for file “new.php” and returns the basename with the extension since we added the suffix parameter. Live DemoOutputnew.phpExampleLet us see another example that checks the file and display the basename without the extension. Live DemoOutputnew
450 Views
The file_exists method check whether a file or directory exists or not. It accepts the path of the file or directory to be checked as the parameter. The following are its uses −It is useful when you need to know whether a file exists or not before processing.With that, use this function while creating a new file to know whether the file already exists or not.Syntaxfile_exists($file_path)Parametersfile_path − Set the path of file or directory to be checked for existence.Required.ReturnThe file_exists() method returns.True, if the file or directory existsFalse, if the file or directory does not existExampleLet us see an example ... Read More
151 Views
To use Server-Sent Events in a web application, you would need to add an element to the document.The src attribute of the element should point to an URL that should provide a persistent HTTP connection that sends a data stream containing the events.The URL would point to a PHP, PERL or any Python script that would take care of sending event data consistently.ExampleHere is an example showing application that would expect server time. /* Define event handling logic here */
154 Views
PHP uses mysql_affected_rows( ) function to find out how many rows a query changed. This function basically returns the number of affected rows in the previous SELECT, INSERT, UPDATE, REPLACE, or DELETE query. Return of an integer > 0 indicates the number of rows affected, 0 indicates that no records were affected and -1 indicates that the query returned an error. Its syntax is as follows −Syntaxmysql_affected_rows( connection );Followings are the parameters used in this function −S. No.Parameter & Description1.ConnectionRequired – Specifies the MySQL connection to use
1K+ Views
As we know that PHP provides us the function named mysql_query() to create a MySQL table. Similarly, we can use mysql_query() function to create MySQL temporary table. To illustrate this, we are using the following example −ExampleIn this example, we are creating a temporary table named ‘SalesSummary’ with the help of PHP script in the following example − Creating MySQL Temporary Tables
270 Views
We can use the if...else condition in PHP script to prepare a query based on the NULL value. To illustrate it we are having the following example −ExampleIn this example, we are using the table named ‘tcount_tbl’ having the following data −mysql> SELECT * from tcount_tbl; +-----------------+----------------+ | tutorial_author | tutorial_count | +-----------------+----------------+ | mahran | 20 | | mahnaz | NULL | | Jen | NULL | | Gill | 20 | +-----------------+----------------+ 4 rows in set (0.00 sec)Now, the following is a PHP script that takes the value of ‘tutorial_count’ from outside and compares it with the value available in the field.
To Continue Learning Please Login
Login with Google