Describe how to create a simple AD rotator script without using database in PHP.
Correct Answer
Following are the steps to create a simple AD rotator script without using database in PHP: - All the ad?s can be collected in one place and be displayed randomlyrand() function can be used for this purpose - In order to NOT use any database, a flat file can be used to store the ad?s - In order to store the Ad?s information (HTML code), a flat file say ?adtxt? can be created - The random number can be stored in a variable $result_random=rand(1, 100); - Conditions can be checked to display the ad?s if($result_random<=70) { echo "Display ad1"; }
Technology problems
Search Results
1. How to use HTTP Headers inside PHP? Write the statement through which it can be added?
Correct Answer: HTTP headers can be used in PHP by redirection which is written as: The headers can be added to HTTP response in PHP using the header() The response headers are sent before any actual response being sent The HTTP headers have to be sent before taking the output of any data The statement above gets included at the top of the script
2. How can I retrieve values from one database server and store them in other database server using PHP?
Correct Answer: we can always fetch from one database and rewrite to another Here is a nice solution of it$db1 = mysql_connect("host","user","pwd") mysql_select_db("db1", $db1); $res1 = mysql_query("query",$db1);$db2 = mysql_connect("host","user","pwd") mysql_select_db("db2", $db2); $res2 = mysql_query("query",$db2);At this point you can only fetch records from you previous ResultSet, ie $res1 â?? But you cannot execute new query in $db1, even if you supply the link as because the link was overwritten by the new dbso at this point the following script will fail $res3 = mysql_query("query",$db1); //this will failSo how to solve that? take a look below $db1 = mysql_connect("host","user","pwd") mysql_select_db("db1", $db1); $res1 = mysql_query("query",$db1); $db2 = mysql_connect("host","user","pwd", true) mysql_select_db("db2", $db2); $res2 = mysql_query("query",$db2); So mysql_connect has another optional boolean parameter which indicates whether a link will be created or not, as we connect to the $db2 with this optional parameter set to 'true', so both link will remain live Now the following query will execute successfully $res3 = mysql_query("query",$db1);
3. Will comparison of string "10" and integer 11 work in PHP?
Correct Answer: ActiveX DLL: It is an in process server It runs within the application time ActiveX Exe: It is an out of process server MS-Excel is an activex exe when u call the excel from the vb application u can in the task manager an excel exe will run, whereas for dll u can't see like that
6. What is the difference between the functions unlink and unset in PHP?
Correct Answer: These two methods are bulid-in methods in php with construct() we can overwride the parent class method The inverse of the __construct() PHP capacity while making another class, is the __destruct() technique The __destruct() technique will consequently keep running, after you've completed with the PHP class
8. What's the difference between GET() and POST() method?
Correct Answer: We can send 1024 bytes utilizing GET() yet POST() can exchange extensive measure of information and POST is the protected strategy than GET technique
Correct Answer: The PHP default variable $_PHP_SELF is utilized for the PHP script name and when you click "submit" catch then same PHP script will be called
10. What's the difference between Session and Cookie?
Correct Answer: The principle distinction amongst sessions and cookies is that sessions are put away on the server, and cookies are put away on the client's PCs in the content record position Cookies can not hold various variables,But Session can hold numerous variablesWe can set expiry for a cookie,The session just stays dynamic the length of the program is openUsers don't have admittance to the information you put away in Session,Since it is put away in the server Session is mostly utilized for login/logout reason while cookies utilizing for client movement following