Tuesday, May 14, 2019

Student Information System Using Ruby and MySQL

In this article, I would like to share with you guys a CRUD application that I wrote using Ruby and MySQL. The application can add, edit, delete, view student records.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com








Sample Program Output

Program Listing

menu.rb

###################################################
# Author    : Mr. Jake Rodriguez Pomperada,MAED-IT
# Tools     : Ruby Version 2.6.3 and Notepad++
# Date      : May 14, 2019   Tuesday
# Location  : Bacolod City,Negros Occidental
# Website   : http://www,jakerpomperada.com
# Email     : jakerpomperada@gmail.com
###################################################

require 'mysql'

class MysqlDatabase
  def initialize(server,database,username,password)
    @svr = server
    @db = database
    @usr = username
    @pwd = password
  end

  def connect
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
    mysql.close()
  end

  def create_data(fname,lname,course,email)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
stmt = mysql.prepare('INSERT INTO students(firstname,lastname,course,email) VALUES (?,?,?,?)')
    stmt.execute fname,lname,course,email
print "\n\n"
print "\tRecord has been saved in the database."
print "\n\n"
    mysql.close()
  end

  def read_data
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
    print("\n\n")
print("\t----------------------------------------")   
print("\n")
    print("\t\tVIEW ALL STUDENTS RECORDS")
print("\n")
    print("\t----------------------------------------")
print("\n\n")
print("\tID \tLASTNAME \tFIRSTNAME \tCOURSE \t\tEMAIL")
    print("\n\n")
    results = mysql.query('SELECT id,lastname,firstname,course,email FROM students ORDER BY lastname ASC')
    results.each do | id,lastname,firstname,course,email|
      print("\t#{id}\t#{lastname}\t#{firstname} \t#{course}\t#{email}\n")
    end
    mysql.close()
  end

  def update_data(id,fname,lname,course,email)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
print("\n")
    print("\tUpdationg Student Record ID No. #{id}")
    stmt = mysql.prepare('UPDATE students SET firstname=?,lastname=?,course=?,email=? WHERE id=?')
    stmt.execute fname,lname,course,email,id
    print "\n\n"
print "\tRecord has been updated in the database."
print "\n\n"
    mysql.close()
  end

  def delete_data(id)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
print("\n")
    print("\tDeleting Student Record ID No.#{id}")
    stmt = mysql.prepare('DELETE FROM students  WHERE id=?')
    stmt.execute id
    print "\n\n"
print "\tRecord has been deleted in the database."
print "\n\n"
    mysql.close()
  end
    
  
end

def menu

loop do

print "\n\n"
print "\t===== STUDENT INFORMATION SYSTEM IN RUBY AND MYSQL =====\n"
print "\t\t  AUTHOR: JAKE RODRIGUEZ POMPERADA"
print "\n\n"
print "\t[1] ADD    STUDENT RECORD\n"
print "\t[2] UPDATE STUDENT RECORD\n"
print "\t[3] VIEW   STUDENT RECORD\n"
print "\t[4] DELETE STUDENT RECORD\n"
print "\t[5] QUIT PROGRAM"
print "\n\n"
print "\tSELECT YOUR CHOICE :=> "
input = gets.strip

    case input
    when "1"
     print "\n\n"
         print "\tADD STUDENT RECORD"
print "\n\n"
print "\tGive Student First Name     : "
         fname = gets.chomp
print "\tGive Student Last Name      : "
         lname = gets.chomp
print "\tGive Student Course         : "
         course = gets.chomp
print "\tGive Student Email Address  : "
         email = gets.chomp
db = MysqlDatabase.new('127.0.0.1','school','root','')
db.create_data(fname.upcase,lname.upcase,course.upcase,email.downcase)
    when "2"
         print "\n\n"
         print "\tUPDATE STUDENT RECORD"
print "\n\n"
print "\tGive Student ID Number     : "
         id = gets;
id = id.to_i;
print "\tGive Student First Name     : "
         fname = gets.chomp
print "\tGive Student Last Name      : "
         lname = gets.chomp
print "\tGive Student Course         : "
         course = gets.chomp
print "\tGive Student Email Address  : "
         email = gets.chomp
db = MysqlDatabase.new('127.0.0.1','school','root','')
db.update_data(id,fname.upcase,lname.upcase,course.upcase,email.downcase)
    when "3"
    db = MysqlDatabase.new('127.0.0.1','school','root','')
        db.read_data()
    when "4"
         print "\n\n"
         print "\tDELETE STUDENT RECORD"
print "\n\n"
print "\tGive Student ID Number     : "
         id = gets;
id = id.to_i;
db = MysqlDatabase.new('127.0.0.1','school','root','')
         db.delete_data(id)
 
    when "5"
     print("\n\n")
print("\tTHANK YOU FOR USING THIS PROGRAM")
     print("\n\n")
         return
      else
    print("\n")
        print("\tInvalid option: #{input}. Try Again.")
print("\n")
    end
 end
end

menu

# End of Code

students.sql

-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 14, 2019 at 09:53 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.1.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `school`
--

-- --------------------------------------------------------

--
-- Table structure for table `students`
--

CREATE TABLE `students` (
  `id` int(11) NOT NULL,
  `firstname` varchar(200) NOT NULL,
  `lastname` varchar(200) NOT NULL,
  `course` varchar(200) NOT NULL,
  `email` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `students`
--

INSERT INTO `students` (`id`, `firstname`, `lastname`, `course`, `email`) VALUES
(1, 'JAKE', 'POMPERADA', 'BS INFORMATION TECHNOLOGY', 'jakerpomperada@aol.com'),
(2, 'ALLIE ', 'POMPERADA', 'BS CHEMCIAL ENGINEERING', 'allie_pomperada@yahoo.com.ph'),
(4, 'JACOB SAMUEL', 'POMPERADA', 'BS COMPUTER ENGINEERING', 'jacobsamuel_pomperada@hotmail.com'),
(5, 'JULIANNA RAE', 'POMPERADA', 'BS BUSINESS MANAGEMENT', 'iya_pomperada@gmail.com');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;









Friday, May 10, 2019

Addition of Three Numbers in Ruby

A simple program that will ask the user to give three numbers and the program will compute the sum of the three numbers using Ruby programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing

# addition.rb
# Written By Mr. Jake R. Pomperada,MAED-IT
# May 10, 2019
puts "\n\n"
print "\tAddition of Three Numbers";
puts "\n\n"
print "\tGive First Value  : ";
val1 = gets;
print "\tGive Second Value : ";
val2 = gets;
print "\tGive Third Value  : ";
val3 = gets;

val1 = val1.to_i;
val2 = val2.to_i;
val3 =  val3.to_i;
sum = sum.to_i;

sum = (val1+val2+val3);
print "\n";
print "\tThe sum of ",val1,",",val2," and ",val3," is ",sum,".";
puts "\n\n"
print "\tEnd of Program";
puts "\n"



Greeter Program in Ruby

A simple program that I wrote using Ruby programming language to greet a person by ask the persons first and last name.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

# greet.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 10, 2019     Friday
# Address  : Bacolod City, Negros Occidental
# Tools    : Sublime Text and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com

print "\n\n";
print "\tGreetings Program";
print "\n\n";
print "\tGive your First Name : "
fname = gets.chomp
print "\n";
print "\tGive your Last Name  : "
lname = gets.chomp
print "\n\n";
print "\tHello #{fname.upcase} #{lname.upcase}.";
print "\n\n";
print "\tWelcome to Ruby Programming.";
print "\n\n";
print "\tEnd of Program";
print "\n";



Parameter and Area of the Circle Solver Using Ruby

A program that I wrote using Ruby programming language to solve the parameter and area of the circle.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

# area_circle.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 10, 2019     Friday
# Address  : Bacolod City, Negros Occidental
# Tools    : Sublime Text and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com
radius = 5.00;
perimeter = 0.00;
area = 0.00;

print "\n\n";
print "\tParameter and Area of the Circle Solver";
print "\n\n";
print "\tRadius of the circle: ";

radius = gets.to_f
perimeter = 2 * 3.141592653 * radius;
area = 3.141592653 * radius * radius;

print "\n";
print "\tDISPLAY RESULTS"
print "\n\n";
puts "\tThe perimeter is %.2f of the circle." % perimeter
print "\n";
puts "\tThe area is %.2f of the circle." % area
print "\n";
print "\tEnd of Program";
print "\n";



Saturday, May 4, 2019

Temperature Converter in PhoneGap

This will be my first time to create a hybrid mobile application for android using PhoneGap. I called this program temperature converter. Which has a menu for celsius to fahnrenheit, fahrenheit to celsius and about the software developer. I am using jquery ui, html5,css3 and javascript to write this application.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com






Sample Program Output











Tuesday, April 30, 2019

Display All The Records From MySQL Using JQuery and PHP

A program that I wrote using PHP as my server language, MySQL as my backend database and JQuery for my frontend to retrieve all the records in the database.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

index.php

<html>  
    <head>  
        <title>Display All The Record From MySQL Using JQuery</title>  
<link rel="stylesheet" href="bootstrap.min.css" />
<script src="jquery-3.4.0.min.js"></script>  
    </head>  
    <body>  
        <div class="container">
<br />
<h3 align="center">Display All The Records From MySQL Using JQuery</a></h3><br />
<br />
<div class="table-responsive" id="show_records">
</div>
</div>
<script type="text/javascript">
/* Written By Mr. Jake R. Pomperada,MAED-IT
   April 30, 2019  Tuesday    
   Bacolod City, Negros Occidental  */
load_data();
    
function load_data()
{
$.ajax({
url:"fetch.php",
method:"POST",
success:function(data)
{
$('#show_records').html(data);
}
});
}

</script>
</body>
</html>

fetch.php

<?php

//fetch.php
/* Written By Mr. Jake R. Pomperada,MAED-IT
   April 30, 2019  Tuesday    
   Bacolod City, Negros Occidental  */

include("database_connection.php");
$query = "SELECT * FROM tbl_students";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$total_row = $statement->rowCount();
$output = '
<table class="table table-striped table-bordered">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Course</th>
</tr>
';
if($total_row > 0)
{
foreach($result as $row)
{
$output .= '
<tr>
<td width="10%">'.$row["first_name"].'</td>
<td width="10%">'.$row["last_name"].'</td>
<td width="15%">'.$row["course"].'</td>
</tr>
';
}
}
else
{
$output .= '
<tr>
<td colspan="5" align="center">Data not found</td>
</tr>
';
}
$output .= '</table>';
echo $output;
?>

tbl_students.sql

-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 30, 2019 at 08:49 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.1.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `students`
--

-- --------------------------------------------------------

--
-- Table structure for table `tbl_students`
--

CREATE TABLE `tbl_students` (
  `id` int(11) NOT NULL,
  `first_name` varchar(200) NOT NULL,
  `last_name` varchar(200) NOT NULL,
  `course` varchar(300) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tbl_students`
--

INSERT INTO `tbl_students` (`id`, `first_name`, `last_name`, `course`) VALUES
(3, 'Jake', 'Pomperada', 'Bachelor of Science in Computer Science'),
(4, 'Ma. Junallie', 'Pomperada', 'Bachelor of Science in Chemical Engineering'),
(5, 'Jacob Samuel', 'Pomperada', 'Bachelor of Science in Business Management'),
(6, 'Julianna Rae', 'Pomperada', 'Bachelor of Science in Accountancy'),
(7, 'Lydia', 'Pomperada', 'Bachelor of Science in Social Studies'),
(8, 'Virgilio', 'Pomperada', 'Bachelor of Science in Agriculture'),
(9, 'Leslie Vinky', 'Pomperada', 'Bachelor of Science in Electronics Engineering'),
(11, 'Kobe', 'Bryant', 'Master in Information Technology');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `tbl_students`
--
ALTER TABLE `tbl_students`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `tbl_students`
--
ALTER TABLE `tbl_students`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;





CRUD using PHP,Ajax,MySQL using JQuery UI Dialog

A student information system that I wrote using PHP, Ajax, MySQL using JQuery UI Dialog box that uses CRUD file management.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com






Sample Program Output