Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,149,786 members, 7,806,180 topics. Date: Tuesday, 23 April 2024 at 12:36 PM

Most Used Mysql Database Functions - Programming (2) - Nairaland

Nairaland Forum / Science/Technology / Programming / Most Used Mysql Database Functions (13101 Views)

Android Quiz App With Php And MYSQL Database / Web Development And Programming Using PHP/MYSQL Database At Yemlat / DHTMLSQL - A Very Advanced Wrapper For Mysql Database! (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Re: Most Used Mysql Database Functions by swtdrms(m): 3:06pm On Jan 14, 2016
This is good, am actually excited seeing someone creating a thread for application development. @OP, it'll be better if u can be more professional in ur programming threads or articles by taking screen shots from a code editor, it presents u as a professional as well help the intended readers to make sense of it.
Also always stick to what title or topics you give ur article/thread. As your title do not correlate with the body of the write up and lastly, screen shots of the final results will also put you in the professional light.

As always, you have tried, keep it up and improve on it....

As for me, do i really have time dirtying my hands with mysql functions? Frameworks can really do lots of this elementary stuffs in a cinch, and if i'll have to, i'll rather go the OOP way

3 Likes

Re: Most Used Mysql Database Functions by RALPHOW(m): 3:26pm On Jan 14, 2016
FagsamPHP:
well done op.....
i know this looks like rubbish to many.

IT LOOKS LIKE RUBISH, BUT THIS WHAT NIGERIAN YOUTH SHOULD LEARN INSTEAD OF FIGHTING ON FOOTBALL , OR DOING YAHOO YAHOO.
IF YOU KNOW THIS VERY WELL, YOU CAN BECOME A MILLIONAIRE LESS THAN A YEAR.

3 Likes

Re: Most Used Mysql Database Functions by polarman(m): 3:47pm On Jan 14, 2016
Nice one op
Re: Most Used Mysql Database Functions by Urine: 4:03pm On Jan 14, 2016
imohchard:
I know.. But you have ready made plugins in wp that does essential web app functions

I get your point at the end of day, it's about your client's budget.
Re: Most Used Mysql Database Functions by Fhemmmy: 4:23pm On Jan 14, 2016
BUSHHUNTER:
Using Dreamweaver for programming html now

Any special reason why you would wanna use dreamw.?
Re: Most Used Mysql Database Functions by Fhemmmy: 4:25pm On Jan 14, 2016
imohchard:
So people still code websites? Wordpress and joomla don collect work frrom una hand na... CMS all the way... So I go code 25k Website?

Even with Joomla and Wordpress, still important to understand the code . . . .except if you just wanna build for fun but for a professional site, you must understand the code and even know the plugins to use for what.

1 Like

Re: Most Used Mysql Database Functions by BUSHHUNTER: 4:39pm On Jan 14, 2016
FHA:


Any special reason why you would wanna use dreams.?

preferred dreamwvr...easy 4 coding nd some other tins
Re: Most Used Mysql Database Functions by GoodMuyis(m): 4:52pm On Jan 14, 2016
BUSHHUNTER:


preferred dreamwvr...easy 4 coding nd some other tins

Could Try VIM, thats badt pass Dreamweaver.

By the way, e be like say Oga seun don start to dey moderate,
Re: Most Used Mysql Database Functions by BUSHHUNTER: 5:12pm On Jan 14, 2016
GoodMuyis:


Could Try VIM, thats badt pass Dreamweaver.

By the way, e be like say Oga seun don start to dey moderate,



Will try it....Nice 1
Re: Most Used Mysql Database Functions by lurex2rhyme(m): 5:31pm On Jan 14, 2016
bigdrey:
If you want to have a very powerful and interactive website then consider the use of web database either MYSQL or ORACLE just to mention a few.

In this article we will see and explain most used mysql function which you may need and must know as a PHP Beginner and Programmer.

Using PHP you can interact with MySQL database either using Mysql extension, PDO extension and MySQLI extension, for security reasons MySQL extension is considered as depreciated and it should not be used. In this article we will focus on MySQLI where ‘I’ means Improved.
BUT WHAT IS MYSQL?

This is an open source relation database management system (RDBMS) based on structured query language (SQL)
WHY NEED MYSQLI

This structured query language (SQL) provide an easy way to add, remove, alter and join information in database using standard SQL commands INSERT, DELETE, JOIN AND UPDATE. Let’s take a look on each function in detail.

Before you can use MySQLI extension you may need to connect to database once, to connect to database you need to know few things about your database such as password, host, user and database name.

HOST: This is where the database is located; it can be either localhost meaning your web server machine is hosting it's self the database or the database can be in another server.
To connect to database which is on another server you use IP Address of the server otherwise you may use localhost (Self hosted database).

CONNECTING TO DATABASE

define(“HOST”,”localhost”); // our database host
define(“USER”,”root”); // by default if mysql user name has not been changed the default is root
define(“PASSWORD”,””); // database password
define(“DB”,”test”); // our database to connect to

$con = mysqli_connect(HOST,USER,PASSWORD,DB);
if($con) die(“unable to connect to database”);

Don’t forget to see how to create database and database table
ADDING DATA TO DATABASE

$query = “INSERT TO users (username,email,password) VALUES (‘user1’,’user0@gmail.com’,’password1’)"; // do not add comma (,) at the end
$sql_execute = mysqli_query($query,$con);
# check if MySQL executed successfully or not
If(!$sql_execute){
die("unable to insert data into database"wink;
}else{
echo ("successfully added new record to database"wink;
}
UPDATING DATA IN DATABASE

$query = “UPDATE users SET email = ’user1@gmail.com’ WHERE email = ’user0@gmail.com’ LIMIT 1”;
// Its always a good practice to add LIMIT when using update command, if more than one record match all will be updated

$sql_execute = mysqli_query($query,$con);

// let’s check if an update was successful
If(mysqli_affected_rows($con) > 0){
echo = “Record updated”;
}else{
die(“No record was updated”);
}
// if making alteration to a record with same info you may get an error
DELETING DATA IN DATABASE

- When performing this command you need to be careful as it can delete all records of the database and there is no undo

$query = “DELETE FROM users WHERE email = ’user1@gmail.com’ LIMIT 1”;
$ sql_execute = mysqli_query($query,$con);

// let’s check if Delete was successful
If(!$ sql_execute){
die (“Unable to delete file”);
}else{
echo(“succefully deleted a file”);
}

Hint: for security reasons you are required to close MySQL connection when a query finishes but lucky MySQL usually do this for you when connection is not closed

Don’t forget to check how to create simple but secure login script
Don’t forget to check the power of OOP’s in PHP

Source: http://blog.windrey.com/most_used_mysql_functions/
baba i wana learn d sql step by step plz
Re: Most Used Mysql Database Functions by Wolfbrother(m): 6:09pm On Jan 14, 2016
Re: Most Used Mysql Database Functions by Amastermovic(m): 6:14pm On Jan 14, 2016
labogini13:
want to create my blog
Mail me and I will explain how to go about it free of charge no hidden charges
Re: Most Used Mysql Database Functions by Ricswagger: 6:21pm On Jan 14, 2016
bigdrey:

Ehya too bad. Thanks for letting me know. Seems not everyone should have programming knowledge.
BOSS abeg i wan learn mysql step by step,i am working with macromedia dreamweaver,i already know html,css, still learning js , php
abeg bro
Re: Most Used Mysql Database Functions by 9jawebdev(m): 6:59pm On Jan 14, 2016
The mysqli procedural is okay but recommended is the object oriented.

Instantiate a mysqli database connection using

$con = new mysqli(host,username,password,db)

Then execute an sql query by calling the query method

Like

$con->query($sql) ;

Etc.
Re: Most Used Mysql Database Functions by Nobody: 7:17pm On Jan 14, 2016
I was disappointed when I came here to see php. Overlooking that, there's also a huge difference between your topic and what you eventually wrote on.

And why do I get the feeling that you webdev cats seem to think SQL is just about Web? I recently moved transaction data management on my embedded device from flat file to SQL-based. I use sqlite.so. Imagine if I were to start a topic on sqlite C functions telling you it's "SQL"?
Re: Most Used Mysql Database Functions by sunnico(m): 8:05pm On Jan 14, 2016
Well done mods, this is actually d first programming article am seeing at front page..we want more of this

2 Likes

Re: Most Used Mysql Database Functions by sunnico(m): 8:11pm On Jan 14, 2016
GoodMuyis:


Could Try VIM, thats badt pass Dreamweaver.

By the way, e be like say Oga seun don start to dey moderate,
cheesy
I guess dats why dis topic made fp.....
Re: Most Used Mysql Database Functions by JD123(m): 10:48pm On Jan 14, 2016
Sorry to say,but mysqli is well outdated .expect its deprecation. It still has its own loopholes. I use PDO
,search that out. It's secured and beyond deprecation.


check my personal webpage http://akin.com.ng and see sites I built with it
Re: Most Used Mysql Database Functions by DualCore1: 11:03pm On Jan 14, 2016
Brothers, embrace PDO and be free.
Re: Most Used Mysql Database Functions by grossarchive: 11:59pm On Jan 14, 2016
Nice effort, for me, i prefer PDOstatement
Re: Most Used Mysql Database Functions by spikesC(m): 3:48am On Jan 15, 2016
JD123:
Sorry to say,but mysqli is well outdated .expect its deprecation. It still has its own loopholes. I use PDO
,search that out. It's secured and beyond deprecation.

...

Are you sure you know what you're saying? or you mean mysql not mysqli
PDO is only good when you might be changing databases in the future, but mysqli is better if you're gonna stick to mysql database.
Nevertheless, you should always abstract your database/library codes, this solves the PDO case
Re: Most Used Mysql Database Functions by Nobody: 8:48am On Jan 15, 2016
sunnico:
cheesy
I guess dats why dis topic made fp.....
. . . .and they call me sarcastic eh? You are caustic like Caustic Soda (not soda water o).
Re: Most Used Mysql Database Functions by Nobody: 11:11am On Jan 15, 2016
bigdrey
I have a wamp server on my pc, i already installed but i don't know how to connect to the local host stuff. how do i go about that?
Re: Most Used Mysql Database Functions by bigdrey(m): 9:49am On Jan 16, 2016
Ofatfoed:
bigdrey
I have a wamp server on my pc, i already installed but i don't know how to connect to the local host stuff. how do i go about that?
check if it's working by starting the wamp server as an administrator and then open any of your preferred browsers and type in http://localhost in the address bar or type in http://127.0.0.1 and see if it loads the wamp server index page. Update me on that.
Re: Most Used Mysql Database Functions by bigdrey(m): 9:57am On Jan 16, 2016
olukenzo:
I was disappointed when I came here to see php. Overlooking that, there's also a huge difference between your topic and what you eventually wrote on.

And why do I get the feeling that you webdev cats seem to think SQL is just about Web? I recently moved transaction data management on my embedded device from flat file to SQL-based. I use sqlite.so. Imagine if I were to start a topic on sqlite C functions telling you it's "SQL"?
Bro the post wasn't about SQL, it was about MySQL, you should be able to differentiate that. And i need to related the mysql with a programming language to make complete sense.
Thanks
Re: Most Used Mysql Database Functions by bigdrey(m): 10:07am On Jan 16, 2016
9jawebdev:
The mysqli procedural is okay but recommended is the object oriented.

Instantiate a mysqli database connection using

$con = new mysqli(host,username,password,db)

Then execute an sql query by calling the query method

Like

$con->query($sql) ;

Etc.
I get you, but i needed to use that method because of newbies whom are in need of the post more. For example, most newbie programmer will not know what -> means in oop
Re: Most Used Mysql Database Functions by bigdrey(m): 10:22am On Jan 16, 2016
Ricswagger:

BOSS abeg i wan learn mysql step by step,i am working with macromedia dreamweaver,i already know html,css, still learning js , php
abeg bro
contact me tru whatsapp @ 08132961297 or contact us at www.windrey.com
Re: Most Used Mysql Database Functions by bigdrey(m): 10:25am On Jan 16, 2016
swtdrms:
This is good, am actually excited seeing someone creating a thread for application development. @OP, it'll be better if u can be more professional in ur programming threads or articles by taking screen shots from a code editor, it presents u as a professional as well help the intended readers to make sense of it.
Also always stick to what title or topics you give ur article/thread. As your title do not correlate with the body of the write up and lastly, screen shots of the final results will also put you in the professional light.

As always, you have tried, keep it up and improve on it....

As for me, do i really have time dirtying my hands with mysql functions? Frameworks can really do lots of this elementary stuffs in a cinch, and if i'll have to, i'll rather go the OOP way
Thanks a lot for the advice. It's good for one to know the basics before making use of frameworks, and that's one of the purpose of this thread.
Re: Most Used Mysql Database Functions by bigdrey(m): 10:31am On Jan 16, 2016
labogini13:
want to create my blog
contact me directly @ 08132961297 or contact us at www.windrey.com. We are ready to help you.
Re: Most Used Mysql Database Functions by Nobody: 11:41pm On Jan 16, 2016
bigdrey:

check if it's working by starting the wamp server as an administrator and then open any of your preferred browsers and type in http://localhost in the address bar or type in http://127.0.0.1 and see if it loads the wamp server index page. Update me on that.
I tried it, both urls, but it doesn't load the wamp server index page. pls, what am i to do next?
Re: Most Used Mysql Database Functions by Nobody: 3:25am On Jan 17, 2016
As at the time of starting this thread, I was rounding up the documentation of an SQL library which is a great tool for MySQL users. You can take a quick look at it here - https://www.nairaland.com/2870586/dhtmlsql-very-advanced-wrapper-mysql
Re: Most Used Mysql Database Functions by bigdrey(m): 10:39am On Jan 17, 2016
Ofatfoed:

I tried it, both urls, but it doesn't load the wamp server index page. pls, what am i to do next?
I need to know the error it's bringing or is it jst loading continuously without completion?
Your antivirus could be the problem, or port.
U can change ur port to 8080 in httdp.conf file by left clicking on the wamp icon at d taskbar wen started, then ho to apache and click on httpd.conf and after changing the port, restart your wamp server and then load localhost:8080 in ur browser.

(1) (2) (3) (Reply)

Is There Any Statement Like C System''pause'' For Python Cos It Dissappears Immediately I run the co / Bash Shell Vulnerability Affects Linux, Unix And Mac OS X / How To Build A Forum Website Like Nairaland .com

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 53
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.