Newbie Needs A simple Database Created

I am a newbie when it comes to html, php and MySQL.

I would like to know if someone can make a small sample program that will do the following:

1 Able to manually add a reference number
2 Able to add a name

Then I will have the option to do the following:

1 Display the file (Scan) [which I’m able to press any key (or a Next Button) to display the next file, have the ability to print that file, have the ability to edit that file or press ESC (or a Back button) to go back to the main menu.
2 Search for a file via reference number or name (have the ability to print that file data, have the ability to edit that data or press ESC (or back button) to go back to the main menu.

Calling and modify a file in the following:

1 Reference Number
2 Name

Once I have the database open, I’m able to print the database info in landscape.

The main Menu will only consist:

Add to Datbase

Edit Database

Search by Reference Number

Search by Name

I only need the two of the following: reference number and name. Once I see how it’s put together, I can resume with the rest of the codes by implementing it as I go along including updating the database in MySQL.

Any help will be greatly appreciated.

Thank you in advance


Well, we can do this for you, but, are you willing to learn? There are a lot of steps inside this post.
Each part is a different type of code. Let’s start by asking you what server you are using? Are you doing this on your own computer or a live server? If on your own computer, are you using Wamp or Xamp or do you have a server set up? You mentioned MySQL. Are you planing on using MySQLi or PDO. We would suggest PDO as it is safer and more secure than MySQLi.

Basically you are asking for a CRUD system. Create-Retrieve-Update-Delete system. MySQL can handle that with ease, but, you need to program it all to get it to work. Also, there is the HTML section which would be the front-end that the user would use to control the searching and updating sections.

Lots to talk about to create this project. Have you started it yet? If you are using Wamp or Xamp, you can use the MySQL admin panel to create the database and tables with your two fields in it. I guess we need a little more info on what you are using.

Hello Ernie

Thanks for your response.

This is something that I will be using personally.
I have a computer setup as a local server.
Here are my system specs:
Windows 10 Enterprise
Intel I9 9900K
Z370 GAMING PRO CARBON Motherboard
NVIDIA GeForce GTX 1060 3GB
Corsair Vengeance RGB PRO 32GB
x2 Samsung 980 PRO SSD 2TB - M.2 in RAID 1
x2 Seagate BarraCuda 5TB Internal Hard (None-RAID)

The system is setup using Xamp and it’s setup with my GMail account and tested that I can receive email however my main purpose is that I’m able to print the database info to my local printer in portrait format (not to send to email).

I’m willing to take the time and learn as much as I can for I am a retired and would like to take up some form of a hobby at home. I want to Learn different ways of making web base programs using the same codes.

CRUD system is what I am looking for.

If it can be simply made just using two inputs such as:
Reference Number

I can then study the code and continue adding the rest of the information to the code and to MySQL, MySQLi or PDO (Which ever you recommend)

Your help is greatly appreciated.

Thank you very much

We can help. But, what you are asking is a total site system and this will take some time to learn.
There are many many examples of each section you requested on the internet. Some are better than others. The experienced programmers here can help as you progress through your learning process.
Glad you can join us here! Now, lets break down your requests into some sort of list that will cover the various aspects of the entire system. You will need to learn, and worst of all, understand each step.
Here is a partial list…

Database, Xamp. This system is already in place on your system. To create the database, you start the Xamp system so that it is running. Next, open a browser and go to localhost which will be your Xamp system. This system should show you the parts of your system. It should show you the MySQL admin page named phpMyAdmin. If you click on that you can see your database system. You can create a database name. You can pick any name. This is only used when you create a connection to the database inside your PHP program. If this is for a sales site or info site, you can name the database anything that corresponds to that field of interest. Normally, you do NOT use caps in this name.

Next, still inside the phpMyAdmin, now you have a database. (Using default settings of course.) Select the database on the left side. Then, you can enter a database TABLE on the right side. Since you are using just reference numbers and names, you could call it something like “references” or something else to do with your data that will be saved in it. Normally you would have many tables inside your database. Each table would correspond to one type of data separated by use. For example, you would have one called users that would be where all your user’s data would be saved. Their email addresses, phone numbers names and other user-only info.

Once you have created a table inside your database, you click on the left the name of the table.
Then, on the right side you create three fields. The first would be named " id " and would be set to INT. This field will be used for all indexing of the data inside this table. The next would be your reference and the last your name fields. You need to decide what type of data goes into the ref and name fields. If the reference number is a code number, set it to INT, if it is alphanumeric set it the VARCHAR and put 255 in it for the size. This will let you enter from 1 to 255 characters in it. Designing a database, table and field structure is a study in itself. Most of these can be found on the internet or you can ask here.

Now, that covers just the database creation and does not give a lot of details on what you are really doing there. But, it gives you the basics.

Here are other areas you will need to learn… Without a lot of notes!

HTML - Basic webpage code, a language of it’s own. This lets you put things on a webpage.

CSS - This is styling code, another language of it’s own. This lets you paint the HTML code nicely.
( Note, this also lets you resize items on the screen, place borders around things, change fonts, etc )

PHP - The guts of the program. This language let’s you connect to the database, read data, display data, write data back to the database, insert, delete and update data. It also handles all of the real commands you give to your site, such as how to handle buttons that are pressed by your users.

*** There are many more, but, you need to learn so much first. This gives you an idea where to start ***

Oh, for the programming on the database sections, I suggest PDO. That is what all professional programmers are using these days. There is a great document that walks you thru the correct way to use PDO inside your programs and website. Here it is… PDO Tutorial

The PDO might be over your head at this point. But, I suggest you review it and note some of the examples as they will help later on.

Another question or two… What are you using for your editor? In my Windows laptop, I use Wamp which is similar to Xampp. (You have a Mac I see…) And, I use Netbeans as an editor. But, some use Notepad++ and others use more complex editors. You need to select one to use. Some will show your errors and that makes it easier to debug once you get a site working. You site will be inside a folder under the Xampp folder. Not sure, but htdocs or www. That would be where you save your actual website. You website will contain HTML, CSS and PHP files. You can put them all into just one file for testing. We will cover that later on once you get your database set up and have read up on all of these…

Good luck! ( PS: Sorry for so much to read, but, you are walking into a large amount of studying! Ha! )

One further thing, since you are a newbie, you might want to look at this site. They cover just about anything you will need. But, their code is not always the best. You can select a language to check out and then on the left select the area you want to study. Much info on this site with lots of tutorials to read.
It might help you with your studies…

Wow, lots of cods to explore and learn. Thank you so much Ernie. Your help are greatly appreciated.

On my younger days, I used to make programs in QBasic and there is a database that I want to recreate to be used as a web app or from what I read that with a specific compiler, I can create an Executable App but I will go in that road in the future. I first want to learn this and make it into a home hobby in programming web based applications.

I did tried Visual Basic for Windows but that was way over my head.

I will go though this site tonight while the old lady sleeps cause the constant nagging will not let me focus. I would treat you to a shot of Tequila but then, we both would be too drunk to concentrate…heh.

Once again, thank you for this info.


Well, glad to help! That is why we are here actually… Post back here or start a new post if you need further help. Good luck !

Hello Ernie,

Sorry to bother you again.

I finally found a tutorial in a CRUD database, it’s simple enough for me to modify it the way I want however, I would like to have an option to print but it has to be in landscape, not in portrait.

Attached is the code when I read the data. (If you need the whole thing, just let me know)

I need a button and the codes to have the ability to print the info to printer.

Your help is greatly appreciated.


No problem… But…

If you want to post code here use the backward tick mark. It should be on your keyboard in the upper left of the keyboard. Place three backward-tick-marks before and three after you code. In this way, we can copy and paste it into our editors to test your code and create fixes.

Now, first of all, you are using MySQL which is soooo outdated that nobody but teachers use it.
MySQLi is a better alternative, but, ALL professional programmers use PDO since it is much more safe and secure than MySQL code. Now, I feel it is important that you change to PDO. That is why I gave you the link to read how to use it. Also, in that tutorial I posted, it shows all of the C R U D sections that you need for any website you would ever create.

Now, to insert a button, you can do this by using < input > tags. You just do it like this:

<input type="submit" name="button1" value="button-value>

Or, something like this. One thing is that this is a FORM field. Which means you need to create a form for user input to make it work. something loosely like this:

<form name="myform" action="action.php" method="post">
<input fields go here...>

The action parm is where the form goes to when a SUBMIT button is pressed. Normally, you would just have it go to the current page with action="" or action="#" which means send the user’s inputs to this page we are on. So, normally, you would create the page similar to what you showed in your image but, add the PHP code at that top , something vary loosely like this:

//  Check if user pressed a SUBMIT button
    //  User pressed the SUBMIT button, check if we need to deal with the main button
    if(isset($_POST["main-submit"]) {
        //  The main-submit button was pressed, handle data for just this button...
        ...   Here you would read all of the input field values and save in the database or handle as needed
    } elseif (isset($_POST["some-other-button"]) {
        //  Handle other possible button that the user pressed...
*****  Here place your full webpage...
<form action="#" method="post" name="my-form">
    //  add any other inputs to be processed inside the < form > tags...
    <input type="submit" name="main-submit" value="main-submit">

Just the basics to get you started… Remember, PHP is run server-side before the HTML is created. Therefore, if a user presses a SUBMIT button, on the SERVER, the page is processed. Any PHP before the line is processed and then the PHP can create data for the page to be displayed in. In this example, it basically just handles the input form page and then shows the page again once the user presses the SUBMIT button. It uses the input from the value of the submit button. Normally , you would have others such as a username or password or whatever you want to let the user to input…
Hope this helps…

OMG… I can Celebrate now. I Offer you a Cyber Beer. :slight_smile:

Thank you so much. I finally got the database to do the following:
Add New Data
View the Data
Edit the Data
Print the data
Delete the Data

All I need now to make everything complete is to add a “Search a User” option to find a specific name on the data. A little more research will do the trick. Once this simple database is done, then I’m able to customize it the way that I really want it.

Once again, thank you for all your help in this project and yes, there were allot of typing, hair pulling when things goes wrong (typos on the codes) and fingers cramping but patience is the essence.


It’s always a nice thing to here someone solved their programming puzzle. Good for you ! ! !

Oh, you can search using the LIKE function. This will return values that are close-to the needed field value.
Loosely like this:

$query = "SELECT * FROM users WHERE first_name LIKE '%Ernie% ";

Of course that is just an example. It would return names that are LIKE the one your user enters.
It works well but, sometimes gets too many results. But, that is what a search engine is all about.

Good luck with the rest of your project…

Thank you Ernie,

I finally got the database finished to do the following:

Add New Data
View the Data
Edit the Data
Print the data
Delete the Data
Able to Search by: Account Number, Owner Name, Breeder, or Shelter Name in Database and when that particular data is displayed, I can then either Print, Edit, Delete or Exit the database.
Print Birth Certificate with Pet info
Search and print Vaccination History Per say pet
Print a blank Vaccination Record

Right now the database is plain, nothing fancy because now I need to learn what those CSS and JS codes means and do. (My next project to learn) Would be nice if they made a cheat-sheet on this.

Reason I was using MySQLI is, that was the only thing that I could find in Youtube Tutorials. Not allot of tutorials in PDO format and was a bit more confusing or it may have worked for them but it did not worked for me with all kinds of errors on my end (this included downloading their script to my server and running it the same way they did).

However, what I am creating is not for a website to be published. It’s a Pet-Degree Database with Birth Certificate and Vaccination Records. After that’s done. I will use a php/mysqli compiler (unless you have something better that you recommend) to make it a stand-alone executable file that I can pass on as a program.

I know there’s a better way to do this but Visual Basic for Windows is way over my head. I once in my younger days used to program in QBasic4.5 (DOS) programs for schools. Yes, those were the heydays but now, everything is made for windows using either Visual Basic for Windows, C# or some odd coding that I do not understand…

Once again, thank you for your help and ideas which really helped me in doing this coding. Without your help, I would not know where to start.


CSS just makes thing more pretty and it is not really hard to learn. You will do fine with it. I posted a PDF file on PDO tutorial which explains the way to handle this. You should look at that page.

PHP is not a compiled system, it is a script system. You can use Visual Studio to access your database and make a program. Glad I could help and good luck with your future plans…


I just want to give you an update on my project. I have completed my project using HTML. PHP, CSS, JS and MySQL on my virtual PC windows 10 using xampp. The Database worked out perfect for the way i configured it. I want to personally thank you for your help in this matter for I’ve learned so much per your advice and tutorial.

However, I wanted to learn more. So with that, I created a new VM Windows 10 and installed Windows SQL Server and Visual Studio and started creating a real working database that I can compile to be used as an Application. Programming wise is way different but very interesting and it’s a whole new learning experience.

All I have to say for these young folks out there that if this burned-out minded old man can do this, just think of the possibilities that can be done with fresh young minds and put it to good use.

Once again, thank you, for without your simple guidance in the right direction, I would be stuck back in square one.

Yours truly,


No problem at all my friend! Glad to help!

See you in your next programming-puzzle post… Ha!

Sponsor our Newsletter | Privacy Policy | Terms of Service