mysql_fetch_array - Fetch a result row as an associative array, a numeric array, or both
mysql_fetch_assoc - Fetch a result row as an associative array
mysql_fetch_object - Fetch a result row as an object
mysql_fetch_row —- Get a result row as an enumerated ar...
Monday, June 23, 2008
Sunday, June 22, 2008
How do you define a constant?
6:41 PM
No comments
Via define() directive, like define ("MYCONSTANT", 10...
How can you access a COM object from a PHP page?
6:39 PM
No comments
By utilizing the com_load and the dotnet_load respectively
you can incorporate COM objects and .NET libraries into your
PHP code, thus anytime you see "library code" in a question,
make sure you remember these two functions.
com_load — Creates a new reference to a COM component [deprecated]
Deprecated, use the OO syntax instead.
<?php
// do this
$obj = new COM($module);
// instead of this:
$obj = com_load($module);
?&...
How can we know the count/number of elements of an array?
6:37 PM
No comments
2 ways:
a) sizeof($array_name) - This function is an alias of count()
b) count($array_name) - This function returns the number of elements in an array.
Interestingly if you just pass a simple var instead of an array, count() will return...
How can we get the properties (size, type, width, height) of an image using php image functions?
6:32 PM
No comments
To know the image size use getimagesize() function
To know the image width use imagesx() function
To know the image height use imagesy() funct...
Wednesday, June 18, 2008
Friday, June 13, 2008
How many ways can we get the value of current session id?
6:47 PM
No comments
Using session_id() function, the current value of the session can be found.
Syntax:
String session_id(string $i...
How can we increase the execution time of a php script?
6:34 PM
No comments
By the use of void set_time_limit(int seconds)
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini. If seconds is set to zero, no time limit is imposed.
When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a...
How can we find the number of rows in a result set using PHP?
6:30 PM
No comments
Here is how can you find the number of rows in a result set in PHP:
$result = mysql_query($any_valid_sql, $database_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows foun...
Sunday, June 8, 2008
What are the various methods to pass data from one web page to another web page?
Different methods to pass data from one web page to another:
1. Store the data in a session variable. By storing the data, the data can be passed from one page to another.
2. Store data in a cookie: By storing data in a persistent cookie, data can be passed from one form to another.
3. Set the data in a hidden field and post the data using a submit butt...
Thursday, June 5, 2008
How many ways can we get the value of current session id?
Using session_id() function, the current value of the session can be found.
Syntax:
String session_id(string $...
Tuesday, June 3, 2008
How to set cookies?
setcookie('variable','value','time');
variable - name of the cookie variable
value - value of the cookie variable
time - expiry time
Example: setcookie('Test',$i,time()+3600);
Test - cookie variable name
$i - value of the variable 'Test'
time()+3600 - denotes that the cookie will expire after an one hour
Syntax:
bool setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]]...
How can we know that a session is started or not?
6:35 PM
No comments
A session starts by session_start() function.
This session_start() is always declared in header portion. it always declares first. then we write session_register...
Subscribe to:
Posts (Atom)