"51" questions available for PHP.

Q. How can we increase the uploading limit of a file in PHP ?

We can increase the uploading limit of a file in following ways:

  1. By making changes in php.ini
       upload_max_filesize=40M // this will limit the uploading size upto 40M
  2. By overriding the php ini function in your php file.
  3. By placing script in .htaccess file of server.
       php_value upload_max_filesize 40M
       php_value post_max_size 42M

Q. How can we submit a form without using a submit button?

JavaScript submit() function can be used to submit a form without using submit button. You can use this function in onClick() event on a button click.

<form name="form1" action="result.php" method="POST">
<input type="text" name="name" value="Enter Name">
<button onClick="document.form1.submit();">Submit</button>

Q. What is the difference between mysql_fetch_array() & mysql_fetch_object()?

Both mysql_fetch_array() & mysql_fetch_object() are used to fetch data from a MySql table, difference is one return object and one return array. Simply means with mysql_fetch_object() you can access the data by the field names and with mysql_fetch_array() you can access data by their offsets.

$data = mysql_fetch_object($data);
$Result = mysql_fetch_array($data);

Q. Can we include same file two times in a PHP page “home.php” ?

Yes, we can include the same file i.e include("abc.php") two times in a php file, But this may generate error if the file contains some class declaration or function/method declaration, otherwise you can include same file as many times as per the requirement.

Q. How can u retrive the unique values from an array with duplicate data ?

You can use the PHP array_unique() function, which will return the unique values from an array containing duplicate data.

$data = array('A','B','C','D','A','D','D','E','F','Z');
$Result = array_unique($data);


Start a discussion...or just leave a comment.