diplo obama
Pattern Matching Engineer
LEVEL 1
300 XP
In this tutorial we will create a Marquee Scrolling Link With MySQLi. PHP is a server-side scripting language designed primarily for web development. Using PHP, you can let your user directly interact with the script and easily to learned its syntax. It is mostly used by a newly coders for its user friendly environment. So Let's do the coding...
Before we get started:
First you have to download & install XAMPP or any local server that run PHP scripts. Here's the link for XAMPP server https://www.apachefriends.org/index.html.
And this is the link for the jquery that i used in this tutorial https://jquery.com/.
Lastly, this is the link for the bootstrap that i used for the layout design https://getbootstrap.com/.
Creating Database
Open your database web server then create a database name in it db_marquee, after that click Import then locate the database file inside the folder of the application then click ok.
Creating the database connection
Open your any kind of text editor(notepad++, etc..). Then just copy/paste the code below then name it conn.php.
Creating The Interface
This is where we will create a simple form for our application. To create the forms simply copy and write it into your text editor, then save it as shown below.
Creating PHP Query
This code contains the php query of the application. This code will store the url links to the database server and later will be retrieve as a marquee data To do that just copy and write this block of codes inside the text editor, then save it as save_query.php.
There you have it we successfully created Marquee Scrolling Link With MySQLi. I hope that this simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!
Download
Before we get started:
First you have to download & install XAMPP or any local server that run PHP scripts. Here's the link for XAMPP server https://www.apachefriends.org/index.html.
And this is the link for the jquery that i used in this tutorial https://jquery.com/.
Lastly, this is the link for the bootstrap that i used for the layout design https://getbootstrap.com/.
Creating Database
Open your database web server then create a database name in it db_marquee, after that click Import then locate the database file inside the folder of the application then click ok.

Creating the database connection
Open your any kind of text editor(notepad++, etc..). Then just copy/paste the code below then name it conn.php.
- <?php
- $conn
=
new
mysqli(
'localhost'
,
'root'
,
''
,
'db_marquee'
)
;
- if
(
!
$conn
)
{
- die
(
"Error: Failed to connect to database!"
)
;
- }
- ?>
Creating The Interface
This is where we will create a simple form for our application. To create the forms simply copy and write it into your text editor, then save it as shown below.
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
- </head>
- <body>
- <nav class="navbar navbar-default">
- <div class="container-fluid">
- <a class="navbar-brand" href="https://sourcecodester.com">Sourcecodester</a>
- </div>
- </nav>
- <div class="col-md-3"></div>
- <div class="col-md-6 well">
- <h3 class="text-primary">PHP - Marquee Scrolling Link With MySQLi</h3>
- <hr style="border-top:1px dotted #ccc;"/>
- <button class="btn btn-primary" data-toggle="modal" data-target="#form_modal">Add Link Source</button>
- <br /><br />
- <div class="alert alert-warning">Link List</div>
- <div style="margin-top:30px;">
- <marquee direction="down" scrolldelay="150" onmouseout="this.start()" onmouseover="this.stop()">
- <?php
- require
'conn.php'
;
- $query
=
$conn
->
query
(
"SELECT * FROM `link`"
)
;
- while
(
$fetch
=
$query
->
fetch_array
(
)
)
{
- ?>
- <a href="<?php
echo
$fetch
[
'link_url'
]
?>
" style="font-size:20px; padding:10px;" scrolldelay=""><?php
echo
$fetch
[
'link_title'
]
?>
</a><br /><br />
- <?php
- }
- ?>
- </marquee>
- </div>
- </div>
- <div class="modal fade" id="form_modal" tabindex="-1" role="dialog" aria-hidden="true">
- <div class="modal-dialog" role="document">
- <form action="save_query.php" method="POST" enctype="multipart/form-data">
- <div class="modal-content">
- <div class="modal-body">
- <div class="col-md-2"></div>
- <div class="col-md-8">
- <div class="form-group">
- <label>Link Title</label>
- <input class="form-control" type="text" name="link" required="required" />
- </div>
- <div class="form-group">
- <label>Link URL</label>
- <input class="form-control" type="url" name="url" required="required"/>
- </div>
- </div>
- </div>
- <div style="clear:both;"></div>
- <div class="modal-footer">
- <button type="button" class="btn btn-danger" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Close</button>
- <button name="save" class="btn btn-primary"><span class="glyphicon glyphicon-save"></span> Save</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </body>
- <script src="js/jquery-3.2.1.min.js"></script>
- <script src="js/bootstrap.js"></script>
- </html>
Creating PHP Query
This code contains the php query of the application. This code will store the url links to the database server and later will be retrieve as a marquee data To do that just copy and write this block of codes inside the text editor, then save it as save_query.php.
- <?php
- require_once
'conn.php'
;
- if
(
ISSET
(
$_POST
[
'save'
]
)
)
{
- $link
=
$_POST
[
'link'
]
;
- $url
=
$_POST
[
'url'
]
;
- $conn
->
query
(
"INSERT INTO `link` VALUES('', '$link
', '$url
')"
)
;
- header
(
'location: index.php'
)
;
- }
- ?>
There you have it we successfully created Marquee Scrolling Link With MySQLi. I hope that this simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!
Download
You must upgrade your account or reply in the thread to view hidden text.