A sample code snippet that I wrote to help a friend in her thesis to generate ID numbering using PHP and MySQL.
I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.
My mobile number here in the Philippines is 09173084360.
I am currently accepting programming work kindly contact me in the following email address for further details. Thank you.
My email address are the following jakerpomperada@gmail.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 is (034) 4335675.
Sample Program Output
Program Listing
display.php
<html>
<body>
<style type="text/css">
th,td{
border-width:0px 1px 1px 0px;
}
</style>
<?php
$counter=1;
mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('profile') or die(mysql_error());
$query=mysql_query("select * from user_table ") or die(mysql_error());
echo'<table border="1" ><th >ID</th><th>Name</th><th>Work</th>';
while($res=mysql_fetch_array($query))
{
echo'<tr><td>'.$counter.'</td><td>'.$res['name'].'</td><td>'.$res['work'].'</td></tr>';
$counter++;
}
echo'</table>';
?>
</body>
</html>
id_user.sql
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 30, 2017 at 08:55 AM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 5.6.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `profile`
--
-- --------------------------------------------------------
--
-- Table structure for table `user_table`
--
CREATE TABLE `user_table` (
`id` int(11) NOT NULL,
`name` varchar(200) NOT NULL,
`work` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_table`
--
INSERT INTO `user_table` (`id`, `name`, `work`) VALUES
(1, 'ANA', 'JANITOR'),
(2, 'LANDO', 'DATA ENCODER'),
(4, 'ZANDRO', 'SECURITY GUARD'),
(5, 'MARK', 'PROGRAMMER'),
(6, 'LESLIE', 'SOFTWARE ENGINEER'),
(8, 'WARREN', 'FINANCIAL INVESTOR'),
(9, 'ALMA', 'SECONDARY TEACHER'),
(10, 'LORNA', 'MEDICAL TECHNOLOGIST'),
(13, 'AURORA', 'HAIR DRESSER'),
(14, 'RICKY', 'POLICEMAN');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `user_table`
--
ALTER TABLE `user_table`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `user_table`
--
ALTER TABLE `user_table`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
/*!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 */;
No comments:
Post a Comment