Trouble in connecting to database and editing simple inline table

#1

Forgive me if I am not good in programming. I am trying my best. I am using Charisma Bootstrap template then I used their php version. I wanted to enhance their table where it can use to edit,delete,update and add new record. Please I really need your help guys. Almost one month I cannot sleep well. I just slept for only 2 hours a day just to solve this but my brain cannot absorb all the tutorials in youtube. I am using the xampp for my database. Here’s the link of the template I am using the CHARISMA BOOTSTRAP TEMPLATE OF MR. //usman.it/free-responsive-admin-template/ Here is also my work and I just attached those php because it was not allowed to upload more than 500 KB. I cannot establish a connection. Please forgive me. :frowning: :frowning: :frowning: :frowning: :frowning: :frowning: :frowning:


myProject.zip (25.5 KB)

#2

Well, Riyuwe, first, we don’t want ALL of your code. We will help you, but, let’s go step by step.

In your code, first, you are using MySQL for your database. This is not used anymore. You must upgrade to
PDO or MySQLi . Below is a link that will show you how to do a connection using MySQLi and also PDO. You
can decide which you like better. You can also look at other parts of your code to change them to work with
the MySQLi or PDO.

Next, when you have a problem that you want help with, please place just the important code inside of the PHP
tags. Since you are talking about only a connection problem, here is your config code that handles that:
[php]

<?php if(!mysql_connect("localhost","root","")) { die('oops connection problem ! --> '.mysql_error()); } if(!mysql_select_db("passbook")) { die('oops database selection problem ! --> '.mysql_error()); } ?>

[/php]
Now, here is a link that helps explain how to do this in MySQLi or PDO. Try this and show us what you come
up with. (Note that you will have to change all of your mysql_ functions into mysqli_ ones or into PDO.

#3

Ok I got it. Thank you so much for the reply. I’ll post the result after.

#4

Hmmm, it didn’t post the link… Here is a link to how PDO and MySQLi works and you can look down the page
to see just the PDO part. Also, if you press the green Next-Chapter button, you can see how to create a new
database table, new fields, how to insert data, read data, update data and just about anything you will need.
Just press the green button, look down to the PDO parts and continue once you learn each. A second link is
a site that a lot of programmers here like to pass on. It covers a lot of info on how PHP programming should be
handled. It should be helpful, too!

http://www.w3schools.com/php/php_mysql_connect.asp
http://www.phptherightway.com/