PHP Programming

Questions about the PHP programming language; How and when to use it, implementing techniques, debugging and handling errors, and general questions about PHP itself. For questions about software made with PHP, that do not deal with the manipulating, reading, or learning about the actual code, see the Computer Software category.

2,316 Questions
Internet
PHP Programming

What does php mean at the end of an url?

Websites are servers that present pages as they are requested. Pages, in this context, are merely different kinds of files -- much like images and word documents.

The "php" appended at the end of a URL indicates you are requesting a PHP type file, which is composed with the PHP language.

PHP is a programming language that stands for "PHP: Hypertext Preprocessor." It is used to develop websites that present dynamic content and allow page-to-page interaction, such as forums and wikis.

353354355
PHP Programming

Is PHP platform independent?

Yes. PHP scripts are able to be interpreted on most machinery, especially Windows, Mac OS, and many Linux distributions.

265266267
PHP Programming
Microsoft Excel

Document created in Excel is referred to as a?

An Excel Book or Excel Workbook with the files extension of .xlsx

251252253
PHP Programming

How can you use frames in PHP?

In website development, frames are an HTML concept. There are no frames in PHP.

231232233
Database Programming
PHP Programming
MySQL

How can you get the line breaks to work when you retrieve data from MySQL to PHP?

In most raw (not formatted) text, such as the text in a simple HTML input element, new lines are denoted by a special "newline" character (commonly referred to as \n). When the text reaches this character, it pulls the text following it to the next line.

For example, the string "hello\nworld" would actually appear as:

hello

world

When you submit and retrieve text data in MySQL, it preserves these newline characters as they were originally entered. When you print them onto an HTML page, you may notice that newline characters do not seem to "work" as you could expect them to. The previous string would actually appear as "helloworld", instead of being broken up into two lines.

This is because the string is printed into the HTML source code as "hello\nworld". Browsers are supposed to ignore most whitespace and newlines, which would give us the resulting "helloworld".

In HTML, new lines are created with the
element. When pulling raw text data from MySQL, you will probably want to replace any occurrences of newline characters (which is the raw text's way of creating new lines) with the
element (which is HTML's).

A function exists which easily makes the replacements. It is the nl2br() function, which (simply put) accepts one string as an argument (the text data to replace newline characters) and returns a string (the text data with \n replaced as
).

Example:

$string_taken_from_mysql = 'hello \n\n hello';

echo nl2br($string_taken_from_mysql);

?>

Outputs:

hello

hello

213214215
Web Design and Publishing
PHP Programming
HTML

Using FrontPage how do you get a form to submit to email and reset to the original values via one button?

* First of all, you have to inset a new form, Insert>Form. Then, add all the information you need to the form (inputs, text box, check box, etc.) see the HTML code and where it says POST you ofcourse have to direct it to the process page, it can be php or asp as the most known. don't ever try if you don't know what i mean by the process page. actually all this staff with forms requiered an extra programming language which can be php or asp. If you do know, then just add all the items text box etc.. between* I would definitely agree with the answer of PHP and ASP process pages. You must make a process page that will do both at the same time (or in order that you wish) it was easy to just post "mailto:email@email.com" back before security came out hard. I still use perl scripts as a form handler on all my customers pages. it works and you can apply CSS styles to them...

Please note that FrontPage is an obsolete product and was discontinued in 2003. A common complaint regarding it is that it generates bloated and incomprehensible HTML code. You should use a better editor.

208209210
PHP Programming

How do you validate empty fields in PHP?

PHP provides a function called empty($var), which tests if $var is "empty." Empty has an odd definition, since the function returns true if the variable loosely equates to False. Although a zero-length string would be considered empty, so would the string "0" (among other irrelevant values).

To accept the value "0" from a field, use strlen($var). It tests the length of any variable, after casting it to a string. If this function truly equals integer zero (compared with triple-equals), the variable must be empty.

191192193
PHP Programming

What is coercion in php?

Coercion, type coercion or type conversion is the process of altering the data type of a variable into another data type. PHP uses implicit type conversion (aka. Weak/Loose Typing) so it is not necessary to declare the type of a variable. For instance, the following will not produce any errors:

<?php

$foo = "A string";

$foo = 1;

$foo = array();

?>

You can however explicitly cast variables to a certain type:

<?php

$int = (int)4.5/2;

?>

In contrast, strongly typed languages such as C/C++/Java force you to declare the type of value a variable will hold and explicitly state the new type to perform a conversion; not doing so will result in a compiler error.

171172173
PHP Programming

What types of inheritance exist in PHP?

There are three types of inheritance in java: 1. single 2. multilevel 3. hierarchical. In java programming, multiple and hybrid inheritance is through interface only.

Know more at javatpoint

123124125
PHP Programming

Who provides php technology?

Hmmm, if i got your question right you want company name..

As far as i know it's a group not corporation.

163164165
PHP Programming
JavaScript

How does form validation differ in JavaScript and PHP?

In JavaScript the validation is done client side, which means it can be easily bypassed by turning JavaScript off in your browser. But with PHP it is server side, which means you can't switch it off, so you can't bypass the validation.

153154155
PHP Programming

What is the difference between php and cake php?

PHP is a programming language which is used to create server side pages which are process by server and CakePHP is a framework which is written using php which helps developers to create web pages or we can say web application easily and quickly. CakePHP is a tool to create web application.

149150151
PHP Programming

How you can connect two webpage in php?

You can use: require('filename.extension');

Or: include('filename.extension');

145146147
PHP Programming

What is the correct way to end a PHP statement?

Each statement is ended with a semicolon. PHP is derived from C, so a lot of the components are very similar, including this.

Google doesn't seem to care about these but for user's sake, for the sake of community and as a good practice, it is best to redirect and redirection should be 301.

121314
Database Programming
PHP Programming
MySQL

How do you connect db2 and mysql?

Take a shot at adoDB - find it here: adodb.sourceforge.net

135136137
Computers
Computer Programming
PHP Programming
Linux

How can you tell whether a given file is a directory and how can you list all files in a directory including subfolders?

== == In a programming context, one usually determines whether a file is a directory using functions that access file metadata. These are dependent on the system you are programming and what language you are programming in. You should consult a reliable reference for the programming language, such as the manpages for C and C++ (in Unix-like systems) or Java's Javadocs (available on the web).

To list all files in a directory, a programmer will usually iterate across all members of the directory and print some form of information found in the file metadata, such as the filename. ---- A parent directory is the directory containing the current directory. A child directory is a directory inside of the current directory. A subdirectory is a directory inside of the current directory or any its child directories.

----

In Windows, the most common way to determine if a file is a directory is using the GUI. To do this, right-click the file icon and click "Properites". If it is a directory, then the type of the file should be listed as "File Folder". Alternately, you can use the Command Prompt, which by default (Windows XP) can be accessed via the Start menu, in the Applications folder. Alternately, type "cmd" into the Run prompt (or the search field in Vista). You will be presented with a command line interface. Use the command "CD" followed by a file path to change to the desired directory, then type "DIR /A:D". This will list all files in the current directory with the attribute "directory". Alternately, you can include a path to the DIR command, such as "DIR /A:D C:\WINDOWS", to display the contents of the directory in the path.

To list all files in subfolders, use the command "DIR /S". The /S flag will cause subdirectories to be printed as well. Usage of "ls" is explained in full in the manpages, try invoking "man ls" on your system for more information. In Windows systems using the NTFS filesystem, drives are mounted as separate entities and the root folder of a drive is the drive letter, followed by a colon and a backslash (i.e. "C:").

----

In Unix-like systems, the most common utility is the command "ls". Remember that such systems are case-sensitive, so capitalization matters.

To use it, open up a shell emulator, such as bash or csh, and type "cd" followed by a path to change to that directory (or include a desired path to the subsequent commands). Type "ls" to see a listing of all files in the current directory, or "ls /bin" to see a listing of all files in the directory "/bin". By adding in the arguments "l" and "a", as in the command "ls -la", you can additionally see the file permissions (starting with a 'd' if they are a directory), and the "." and ".." directories, respectively.

To display the files in all subdirectories, add the argument 'R' to your list of arguments (or just do "ls -R" if you don't require more extensive information).

Usage of "ls" is explained in full in the manpages, try invoking "man ls" on your system for more information.

If you are using the bash shell, you can use pipes ('|') to chain together several programs to do such things as search or sort your results from the previous program. For example, "ls -l | grep foo" would first list the contents of the current directory (ls), then search through them and print out only those containing the string "foo" (grep).

In most of these systems, storage devices are mounted to mountpoints, which are treated as directories within the system's directory tree. The root directory is "/". Every directory has a link to itself (".") and a link to the parent directory (".."). The root directory is special in that ".." also links back to the root directory.

140141142
PHP Programming
Periods Exclamation Points and Question Marks
Declarative and Interrogative Sentences

What is the use of a question mark in php?

It is used to tell the sever to use the PHP parser. To begin php you must use <?php, and to end it, it is ?>.

135136137
Web Programming
PHP Programming

What are tokens in drupal?

The tokens available depends on what modules you have enabled on your Drupal site. To view a list of the currently available tokens on your site, you can navigate to the Help > Token (admin/help/token) page.

If the above path is not available on your system be sure that the core help.module is enabled.

133134135
Database Programming
PHP Programming

What are implication of not validating data?

If data is not validated, your script/application can result in errors, produce unexpected results, or potentially provide a way for someone to hack into your web and/or database server.

131132133
PHP Programming
Companies
Web Servers

PHP is product of which company?

PHP is open-source software, i.e. not strictly a product of any company. However, it depends greatly upon the open-source Zend Engine II. Development of both is largely driven by Zend Technologies Ltd., the enterprise of Andi Gutmans and Zeev Suraski who produced the original Zend Engine while overhauling PHP in 1999.

129130131
Internet
PHP Programming
HTML5

How do you add HTML5 Geolocation results to a PHP form?

There is no such thing as a PHP form. Forms are written in HTML or other client side scripting languages.

119120121
PHP Programming
Yahoo

How do you read NT registry info with PHP?

<?php

// Example to read the subkeys of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft (tested on PHP 5)

// See http://msdn2.microsoft.com/en-us/library/aa392722.aspx for methods

// See http://www.php.net/manual/en/ref.com.php

define('HKEY_LOCAL_MACHINE', 0x80000002);

$computer = '.';

$reg = new COM("winmgmts:{impersonationLevel=impersonate}!\\\\$computer\\root\\default:StdRegProv");

$key_path = 'SOFTWARE\Microsoft';

$sub_keys = new VARIANT();

$reg->EnumKey(HKEY_LOCAL_MACHINE, $key_path, $sub_keys);

foreach($sub_keys as $sub_key){

echo "$sub_key\n";

}

?>

117118119
Database Programming
PHP Programming
Java Programming

What are the disadvantages of manual systems?

  • Training problems - the problems associated with training and advising people to be disciplined enough to maintain the maintenance system, i.e. to write the data into the system
  • Report acquisition problems - the effort associated with finding meaningful data and statistics in the system.
  • Registers and logs with good design are difficult.
  • Summarizing data and writing reports take lot of time.
  • cost- time is money and employees
  • data duplication: the same data gets repeated over and over since the workers find it hard to keep track of the documents, information and transactions
  • lack of security:since data is stored in filing cabinets it is freely available to anyone.if information falls into the wrong hands it can be used against the company and customers and can blackmail them.
  • common errors:when entering data customers might have accidentally switched details and data since it is hand written.
  • inconsistency of data: there will be an unavailabilty for future use, since data might get misplaced during manual filing.so data wont be preserved properly for future use.
  • repetition of work:if there are any changes to be made, the data will have to be entered again.at times the worker would forget to make the changes or forget that they had already altered it and might redo it again, its again time consuming.
  • too much paper work: since eveything and every details is written down manualy in paper there will be too much paper work!
  • space consuming: since the data and paper is stored in filing cabinets it consumes too much place, as the amount of work done on paper increases the filing cabinets too increases.
  • slow retrieval of data: the information of customers and details are stored in different parts of the site and so takes a long time to retrieve the data.it takes a long time to find the information about a relevant person.in case of a Delivery, th e delivery will be held back.this results in a shrp drop in sales, unhappy customers and a bad impression on the company.
515253
PHP Programming

What is zend engine 1 in php?

Zend Engine 1 is the internal engine used by PHP for the entire version 4 release line. It is no longer considered active, but PHP 4 is still in widespread use.

101102103
PHP Programming
.NET Programming
The Difference Between

Does brave-net support PHP?

Bravenet seems to support PHP 5.2 in fastcgi mode on Premium Plans.

I've included the link to their plans page as a reference.

979899

Copyright © 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.