PHP mySQL Web Programming Interview Questions, Answers, and Explanations: PHP mySQL FAQ
By equitypress
4/5
()
About this ebook
The Ultimate Reference & Learning Guide for PHP mySQL!
100 Interview Questions, Answers, and Explanations
In order to stay competitive, today's web programmer must have a thorough understanding of PHP and MySQL. With MySQL Interview Questions, Answers, and Explanations, you will be sure to stay up to date on the newest developments. Using this guide to prepare for a job interview or to brush up on the newest trends in MySQL will aid any web programmer in acquiring new skills and knowledge. This guide will explain many common errors, standard database maintenance, performance tuning, and many other new features. More than just documentation, this guide explains PHP and MySQL from the practical perspective of the web programmer so that you can evaluate a programming candidate or land that PHP mySQL position with ease.
Key topics include:
*SQL as a multithreaded, multi-user Database Management System
*Database interactions with Windows
*Database design, performance tuning, audit and security
*Database monitoring and maintenance
*Troubleshooting in implementation with ANSI C
Read more from Equitypress
Oracle® Financials Interview Questions: Unofficial Oracle Financials Certification Review Rating: 3 out of 5 stars3/5Cisco Network Administration Interview Questions: CISCO CCNA Certification Review Rating: 5 out of 5 stars5/5SAP IS-Retail Interview Questions, Answers, and Explanations Rating: 3 out of 5 stars3/5The Programmer’s Guide to Microsoft Access Rating: 3 out of 5 stars3/5SAP FICO Company Creation Rating: 4 out of 5 stars4/5SAPCOOKBOOK Training Tutorials: SAP MM Inventory Management Rating: 4 out of 5 stars4/5Python Interview Questions Rating: 5 out of 5 stars5/5SAP Security Interview Questions, Answers, and Explanations Rating: 4 out of 5 stars4/5Oracle Ultimate DBA Interview Questions Rating: 5 out of 5 stars5/5TCP/IP Networking Interview Questions, Answers, and Explanations: TCP/IP Network Certification Review Rating: 5 out of 5 stars5/5Oracle Database Security Interview Questions, Answers, and Explanations: Oracle Database Security Certification Review Rating: 0 out of 5 stars0 ratingsSAPCOOKBOOK Training Tutorials SAP Financials: Accounts Receivable Rating: 4 out of 5 stars4/5SAP R/3 Transaction Codes Unofficial Certification and Review Guide Rating: 4 out of 5 stars4/5Unofficial SAP WebDynpro for ABAP Rating: 5 out of 5 stars5/5COBOL Programming Interview Questions: COBOL Job Interview Preparation Rating: 5 out of 5 stars5/5SAP Solution Manager Rating: 4 out of 5 stars4/5Baby Girl Names: The Most Popular Baby Girl Names in America from 1900 to Present Rating: 0 out of 5 stars0 ratingsPeopleSoft HRMS Interview Questions, Answers, and Explanations Rating: 5 out of 5 stars5/5C# Interview Questions, Answers, and Explanations: C Sharp Certification Review Rating: 5 out of 5 stars5/5DB2 Interview Questions, Answers, and Explanations: DB2 Database Certification Review Rating: 0 out of 5 stars0 ratingsPHP Interview Questions, Answers, and Explanations: PHP Certification Review: PHP FAQ Rating: 0 out of 5 stars0 ratingsLPI Linux Certification Questions: LPI Linux Interview Questions, Answers, and Explanations Rating: 4 out of 5 stars4/5SAP XI Exchange Infrastructure Rating: 1 out of 5 stars1/5EnterpriseOne Interview Questions Rating: 0 out of 5 stars0 ratingsThe Piano Pricer: A Short Guide to Buying, Owning, and Selling Rating: 2 out of 5 stars2/5Lotus Notes Interview Questions, Answers and Explanations Rating: 0 out of 5 stars0 ratings
Related to PHP mySQL Web Programming Interview Questions, Answers, and Explanations
Related ebooks
Learning PHP Data Objects Rating: 5 out of 5 stars5/5PHP Examples Part 4 Rating: 0 out of 5 stars0 ratingsPHP & MySQL Practice It Learn It Rating: 3 out of 5 stars3/5PHP Interview Questions, Answers, and Explanations: PHP Certification Review: PHP FAQ Rating: 0 out of 5 stars0 ratingsIntroduction to PHP Web Services: PHP, JavaScript, MySQL, SOAP, RESTful, JSON, XML, WSDL Rating: 0 out of 5 stars0 ratingsBuilding a Web Application with PHP and MariaDB: A Reference Guide Rating: 0 out of 5 stars0 ratingsphpMyAdmin Starter Rating: 0 out of 5 stars0 ratingsLearn PHP in 24 Hours Rating: 0 out of 5 stars0 ratingsIntroduction to PHP Rating: 3 out of 5 stars3/5PHP & MySQL: Novice to Ninja Rating: 0 out of 5 stars0 ratingsMySQL 5.1 Plugin Development Rating: 0 out of 5 stars0 ratingsLearn PHP Programming in 7Days: Ultimate PHP Crash Course For Beginners Rating: 3 out of 5 stars3/5PHP for Beginners: Your Guide to Easily Learn PHP In 7 Days Rating: 4 out of 5 stars4/5P.H.P Simple C.R.U.D Design Rating: 4 out of 5 stars4/5Rapid Application Development With CakePHP Rating: 0 out of 5 stars0 ratingsMastering phpMyAdmin 3.4 for Effective MySQL Management Rating: 0 out of 5 stars0 ratingsPHP MySQL Development of Login Modul: 3 hours Easy Guide Rating: 5 out of 5 stars5/5Mastering PostgreSQL: From Basics to Expert Proficiency Rating: 0 out of 5 stars0 ratingsLearn PHP: Learn PHP Programming in 4 hours! PHP for Beginners - Smart and Easy Ways to learn PHP & MySQL Rating: 4 out of 5 stars4/5ASP.NET 3.5 CMS Development Rating: 0 out of 5 stars0 ratingsPHP Mastery: Crafting Dynamic Web Solutions Rating: 0 out of 5 stars0 ratingsMariaDb Essentials: Quickly get up to speed with MariaDB—the leading, drop-in replacement for MySQL, through this practical tutorial Rating: 0 out of 5 stars0 ratingsPHP Programming For Beginners: The Simple Guide to Learning PHP Fast! Rating: 0 out of 5 stars0 ratingsJump Start MySQL: Master the Database That Powers the Web Rating: 0 out of 5 stars0 ratingsLinux, Apache, MySQL, PHP Performance End to End Rating: 5 out of 5 stars5/5PHP Error Reporting: How To Do It Right Rating: 0 out of 5 stars0 ratingsPHP Reactive Programming Rating: 0 out of 5 stars0 ratingsPHP Team Development Rating: 3 out of 5 stars3/5Responsive Media in HTML5 Rating: 0 out of 5 stars0 ratingsPHP Examples, Part 2 Rating: 1 out of 5 stars1/5
Certification Guides For You
Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5CompTIA A+ Complete Review Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 5 out of 5 stars5/5CompTIA Data+ Study Guide: Exam DA0-001 Rating: 0 out of 5 stars0 ratingsCompTIA Security+ Study Guide with over 500 Practice Test Questions: Exam SY0-701 Rating: 5 out of 5 stars5/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5CompTIA A+ Complete Study Guide: Exam Core 1 220-1001 and Exam Core 2 220-1002 Rating: 4 out of 5 stars4/5CCNA Certification Study Guide, Volume 2: Exam 200-301 Rating: 5 out of 5 stars5/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsCompTIA Security+ Study Guide: Exam SY0-601 Rating: 5 out of 5 stars5/5CompTIA Security+ Study Guide: Exam SY0-501 Rating: 4 out of 5 stars4/5How to Get Started as a Technical Writer Rating: 4 out of 5 stars4/5CAPM Certified Associate in Project Management Practice Exams Rating: 5 out of 5 stars5/5CompTIA Network+ Study Guide: Exam N10-009 Rating: 0 out of 5 stars0 ratingsCompTIA Network+ Review Guide: Exam N10-008 Rating: 0 out of 5 stars0 ratingsCompTIA Network+ Practice Tests: Exam N10-008 Rating: 0 out of 5 stars0 ratingsPHR and SPHR Professional in Human Resources Certification Complete Study Guide: 2018 Exams Rating: 0 out of 5 stars0 ratingsMicrosoft Certified Azure Fundamentals Study Guide: Exam AZ-900 Rating: 0 out of 5 stars0 ratingsIAPP CIPP/US Certification A Practical Study Guide to Master the Certified Information Privacy Professional Exam Rating: 0 out of 5 stars0 ratingsCompTIA A+ Certification All-in-One For Dummies Rating: 3 out of 5 stars3/5Excel Guide for Success Rating: 5 out of 5 stars5/5CompTIA A+ Complete Study Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 0 out of 5 stars0 ratingsCompTIA Security+ Practice Tests: Exam SY0-601 Rating: 0 out of 5 stars0 ratingsCompTIA Project+ Study Guide: Exam PK0-005 Rating: 0 out of 5 stars0 ratingsCompTIA CySA+ Study Guide: Exam CS0-003 Rating: 2 out of 5 stars2/5CompTIA Network+ Certification Guide (Exam N10-008): Unleash your full potential as a Network Administrator (English Edition) Rating: 0 out of 5 stars0 ratingsCompTIA Security+ SY0-701 Certification Guide: Master cybersecurity fundamentals and pass the SY0-701 exam on your first attempt Rating: 0 out of 5 stars0 ratingsCompTIA Network+ Study Guide: Exam N10-008 Rating: 0 out of 5 stars0 ratingsCISM Certified Information Security Manager Study Guide Rating: 4 out of 5 stars4/5
Related categories
Reviews for PHP mySQL Web Programming Interview Questions, Answers, and Explanations
3 ratings1 review
- Rating: 5 out of 5 stars5/5
Aug 8, 2014
Mysql
Book preview
PHP mySQL Web Programming Interview Questions, Answers, and Explanations - equitypress
Question 1: Printing a Document
Whenever I print an HTML page, the path of the page is printed together with the title. What should I do to avoid printing the path?
A: All you have to do is to make changes in the Headers and Footers setup of your browser. Go to File Page setup Headers and Footers and then make the necessary changes.
Question 2: Lostpassword.php Error
When I ran to test my script, I got the following error messages:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/hostvad/public_html/lostpassword.php on line 19
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/hostvad/public_html/lostpassword.php on line 24
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/hostvad/public_html/lostpassword.php on line 27
The script I tested runs this way:
Content-Type content=text/html; charset=iso-8859-1
>
#ffffff>
$v_sbm=$_POST['sbm'];
$v_username=$_POST['username'];
$v_email=$_POST['email'];
if ($v_sbm==Retrieve Password
) {
require_once ('admin/authconfig.php');
$connection = mysql_connect($localhost, $hostvader_signup, $....);
$SelectedDB = mysql_select_db($hostvad_plussignup);
$result0=mysql_query(select distinct uname, passwd, email from authuser where uname='$v_username' and uname<>'admin'
);
while($row0 = mysql_fetch_array($result0, MYSQL_NUM)) {
$v0=$row0[0];
$u0=base64_decode($row0[1]);
$v_email=$row0[2];
}
$count = mysql_num_rows($result0);
if ($count==0) {
$result1=mysql_query(select distinct uname, passwd from authuser where email='$v_email'
);
while($row1 = mysql_fetch_array($result1, MYSQL_NUM)) {
$v1=$row1[0];
$u1=base64_decode($row1[1]);
}
}
if(($u0=='')&&($u1=='')) {
$flag=1;
$msg1= No username or email address matches, please try again.
;
}
elseif ($u0<>'') {
$pass=$u0;
$username=$v0;
}
elseif ($u1<>'') {
$pass=$u1;
$username=$v1;
}
if ($pass<>'') {
//send email for lost password
$result=mysql_query(select subject,contents from emailtemplates where name='lostpass'
);
while($row = mysql_fetch_array($result, MYSQL_NUM)) {
$v_subject=trim($row[0]);
$v_message=nl2br(trim($row[1]));
}
$subject = $v_subject
;
$headers = From: $v_emailfrom\r\n
;
$headers .= MIME-Version: 1.0\r\n
;
$headers .= Content-Type: text/html; charset=iso-8859-1\r\n
;
$v_message = ereg_replace(\\<%username%>
,$username
,$v_message);
$v_message = ereg_replace(\\<%password%>
,$pass
,$v_message);
$v_message = ereg_replace(\\<%weburl%>
,$url_root
,$v_message);
mail($v_email, $v_subject, $v_message, $headers);
$getip=getip();
mysql_query(insert into log (uname,ctime,ip,activity) values ('$username',now(),'$getip','Send password to member($username).')
);
$flag=2;
$msg2=Please check your email for the login information.
;
}
mysql_close($connection);
}
function getip() {
if (getenv(HTTP_X_FORWARDED_FOR)) {
$ip=getenv(HTTP_X_FORWARDED_FOR);
}
else {
$ip=getenv(REMOTE_ADDR);
}
return $ip;
}
?>
center
500
0
0
#FFFFFF
#ooooff
100%>
center>2 face=Arial
color=#000080
>
Lost Password
if ($flag==1) {
echo $msg1
;
exit;
}
elseif ($flag==2) {
echo $msg2
;
exit;
}
?>
center>#000099 size=2
face=Arial
>To retrieve your password, please enter your
Login ID or Email Address
center
67%
0
0
33% height=15
>
Arial size=2
color=#800000
>Username:
67%>Arial size=2
>text name=username
size=27
value=--login ID--
style=border: 1px solid #808080; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1
>
33%>
67%>
15 colspan=2
align=left
>Arial size=2
color=#000099
>OR
left>Arial size=2
color=#800000
>Email Address:
left>Arial size=2
>
text name=email
size=27
value=--Email--
style=border: 1px solid #808080; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1
>
2 align=center
>
2 align=center
>
2 align=center
>Arial size=2
>
submit value=Retrieve Password
name=sbm
style=color: #800000
>
center>
#999999 size=1
face=Verdana
>Designed By #999999 size=1
face=Verdana
>Easebay Resources
Could someone enlighten me on these error messages?
A: To find out the exact problem that is causing these error messages, add the line echo Mysql_error();
before the mysql_fetch_array() function and above mysql_query().
Question 3: Checkbox Array
I had a problem when I tried to use the check box array to delete multiple records from a table. Do I have to explode the values first before I try deleting the records? Could someone give me instructions on what to do?
A: It depends really on how you use the check box array while displaying records. Nevertheless, you can look at the page where you declare the check box name as array by using the following script:
checkbox name=test[]
value=>
When you submit the page, you can find the checkbox array through the POST method using the script below"
foreach($test as $tempVal)
{
//Here u can perform the update or delete operation
}
?>
You will find this very easy to implement.
Question 4: Redirecting PHP Results to Calling HTML Page
I have an HTML page with hyperlinks on it with the name index.html. The page layout is shown below and the links are in TABLE 2. The Xs denote the shape layout of the table on the web page.
TABLE 1
xxxx
xxxx
xxxx
xxxx TABLE 2:
xxxx - link1
xxxx - link2
xxxx - getlist.php
TABLE 3
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xx
The hyperlinks run/trigger PHP scripts. For example: getlist.php. The PHP script queries a MySQL database. The results are produced and then viewed on a new web page.
I want to imbed the results on the calling HTML page, i.e., index.html and I want them to appear in a specific location on that page. The specific location is in the same Table 2 but below the listing of the hyperlinks. For example:
TABLE 2
Link 1
Link 2
getlist.php
I want the results to appear in the following links in TABLE 2:
Link 1
Link 2
getlist.php
RRRRRRRRRRReeeeeeeSSSSSSuuuuuLLLttttSSS.
RRRRRRRRRRReeeeeeeSSSSSSuuuuuLLLttttSSS.
RRRRRRRRRRReeeeeeeSSSSSSuuuuuLLLttttSSS.
Below is my PHP code. I got the results to appear on the calling HTML page when I put the PHP INCLUDE code in the script but I cannot anchor them to the specific location.
index.html); ?>
$db_name = firstdb
;
$table_name = table1
;
$connection = @mysql_connect(servername
, username
, password
)
or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or
die(mysql_error());
$sql = SELECT * FROM $table_name where city = 'washington' ORDER BY Name
;
$result = @mysql_query($sql, $connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)){
$Name = $row['Name'];
$Description1 = $row['Description1'];
$Address = $row['Address'];
$Telephone = $row['Telephone'];
$Email = $row['Email'];
$WebSite = $row['WebSite'];
$display_block .= "
$Name ($Address)
$Telephone ($Email) ( $WebSite )
";}
?>
ResultsList
$display_block; ?>
Right now, the results appears as follows:
TABLE 3
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx
Here is where the results now appear:
RRRRRRReeeeeeeeSSSSSSSSuuuuuuuuuLLLLLLLttttttttttS SSSSS
RRRRRRReeeeeeeeSSSSSSSSuuuuuuuuuLLLLLLLttttttttttS SSSSS
RRRRRRReeeeeeeeSSSSSSSSuuuuuuuuuLLLLLLLttttttttttS SSSSS
How do I anchor the results into TABLE 2?
A: Assuming that you do not have problems in running PHP code within an .html extension, you could try to move up the PHP code and then add the line:
$display_block; ?>
In the line below Table 2, remove the $display_block