PHP Date and Time

Using the sources provided you are to add functionality to search for all blogs written before a specific date. The framework for the assignment is set for you

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

      user.html                       Contains the HTML to prompt for a date

      blog_user.php     

         PHP code to parse the html form and call the function to search by date

     blog_db_interface.php

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

  PHP code to perform the search

You will need to

      blog_user.php     

               Convert the date to a unix time stamp using strtotime()                         10 points

               Verify the strtotime return value. On error throw an exception              10 points

               Convert the unix time stamp to a date and time string using date()       10 points

               Verify the date functionality. On error throw an exception                      10points

               If all is OK then call the function to peform the search

     blog_db_interface.php

               Implement the SQL query to perform the search and display the results    

               Process errors from calling  “prepare”,  “execute” and “bind_results”

                            All errors should result in an exception thrown                                 10 points

               Search result should display “Blogger’s name”  “Blog Summary”                  10 points

What to turn in (as a single ZIP)

        Submit your modified source files: blog_user.php and  blog_db_interface.php       

blog_db_interface.php
« Go back

‘;

}

function __destruct(){
}

public function blogPostsSummary()
{
$db = @new mysqli(‘localhost’, ‘blogdb_user’, ‘blogdb_userPW’, ‘blogdbx’);
if (mysqli_connect_errno()) {
throw new MySQLI_Exception(” Unable to connect to MYSQL server “, mysqli_connect_errno());
}

// Create a join to pull information from the database

$query = “SELECT blogdb.users.Blogger_Name,”.
” blogdb.post.Post_Summary”.
” from blogdb.users”.
” inner join blogdb.post”.
” on blogdb.users.idUser = blogdb.post.User_idUser1″;

$stmt = $db->prepare($query);
$stmt->execute();
$stmt->bind_result($bname, $summary);

//echo “
Blogs Summary

“;
while($stmt->fetch()) {
echo $bname.” “.$summary.”

“;
}
$stmt->free_result();
$db->close();
}

public function allBloggers()
{
$db = @new mysqli(‘localhost’, ‘blogdb_user’, ‘blogdb_userPW’, ‘blogdb’);
if (mysqli_connect_errno()) {
throw new MySQLI_Exception();
}

// Create a simple query to pull all blogger names from the DB

return;

}
public function blogPostsByBlogger($bname)
{
$db = @new mysqli(‘localhost’, ‘blogdb_user’, ‘blogdb_userPW’, ‘blogdb’);
if (mysqli_connect_errno()) {
throw new MySQLI_Exception();
}
$query = “SELECT blogdb.users.Blogger_Name,”.
” blogdb.post.Post_Summary”.
” from blogdb.users”.
” inner join blogdb.post”.
” on blogdb.users.idUser = blogdb.post.User_idUser1″.
” and blogdb.users.Blogger_Name = ?”;

$stmt = $db->prepare($query);
$stmt->bind_param(‘s’, $bname);

$stmt->execute();
$stmt->bind_result($blogger_name, $bsummary);
// Pull the result into the PHP runtime. copies result data allowing memory to be freed in the
// MYSQL runtime environment
$stmt->store_result(); // Note: $STMT::num_rows is zero without first calling this API
$numBlogs = 0;
echo “
Blogs for : “.$bname.”

“;
while($stmt->fetch()) {
echo $bsummary.”

“;
$numBlogs++;
}

$stmt->free_result();
$db->close();
}

public function insertBlog($bloggerName, $blogSummary, $blogContent)
{
$db = @new mysqli(‘localhost’, ‘blogdb_user’, ‘blogdb_userPW’, ‘blogdb’);
if (mysqli_connect_errno()) {
throw new MySQLI_Exception();
}

// Create a query to get the user ID

// Now add a row to the post table; have to use the ID obtained from the previous query

}
public function searchByDate($dt_stamp)
{
$db = @new mysqli(‘localhost’, ‘blogdb_user’, ‘blogdb_userPW’, ‘blogdb’);
if (mysqli_connect_errno()) {
throw new MySQLI_Exception();
}

// Create a query to search for blogs that were created before the date passed in by $dt_stamp

}

};

?>

blog_exceptions.php
getCode().
“: “.
$this->getMessage().

“.
” in “.
$this->getFile().
” on line “.
$this->getLine().

“;
}
}
?>

blog_user.php

searchByDate($datetime);
}
else
{
// error handling
}
}
catch( Exception $ge)
{
echo $ge;
}
?>

user.html
Display Bloggers and Blogs

Search for Blogs

Search for Blogs created after this date:

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP