PHP Tutorial 26 - MySQL Introduction (PHP For Beginners)

PHP Tutorial 26 - MySQL Introduction (PHP For Beginners)

TeachMeComputer

12 лет назад

84,160 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@mohamedahamedsabeer1978
@mohamedahamedsabeer1978 - 01.07.2017 04:24

Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\New folder\mysql.php on line 3
mysql_error

how to solve this error???

Ответить
@ZeeshanMRaje
@ZeeshanMRaje - 11.02.2017 05:23

/to connect mysql with php coding

<?php

$servername="localhost";
$username="root"; /write your username here
$password="**"; / write your password

$conn=new mysqli("$servername","$username","$password"); */Mysqli stands My scripted query language improved

if($conn->connect_error)
{
die("not connected".$conn->connect_error);
}
echo"connected successfully";

?>

Ответить
@ailemak59
@ailemak59 - 04.01.2017 19:48

For all who has problem:

<?php

$user = 'root';
$pass = ''; //your password
$db = 'proiectbd'; //here you write the name of your database

$db = new mysqli('localhost' ,$user , $pass , $db ) or die("Unable to connect");

echo "Great work"; //to see that it works
?>

Ответить
@rustdude2465
@rustdude2465 - 25.12.2016 22:28

this shit is not working!!

Ответить
@ammulu.c9062
@ammulu.c9062 - 27.03.2016 19:29

Fatal error: Call to undefined function mysql_connect() in G:\XAMPP\htdocs\root\mysql.php on line 4
Help me anyone Please

Ответить
@dabluedevil1000
@dabluedevil1000 - 06.03.2016 10:05

Your accent sounds like you're from Liverpool.

Ответить
@krystallangomez5374
@krystallangomez5374 - 06.01.2016 16:40

hi im using php v7.0.1 mysql_connent is not working please help me fatal error

Ответить
@totalytaco3715
@totalytaco3715 - 14.12.2015 15:17

to everyone who's asking for more tutorials, he works at amazon, he's busy.

Ответить
@mflum7
@mflum7 - 30.07.2015 20:33

mysql_connect("localhost", "root", "password")or die(mysql_error()); shows this error: Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead.

Replace mysql_connect with PDO:
$username = 'root';
$password = 'password';
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');

try {
    $dbh = new PDO($dsn, $username, $password, $options);
} catch(PDOException $ex) {
    echo "An Error Occured!" . $ex;
}

Ответить
@123456ahaha
@123456ahaha - 09.02.2015 17:14

isn't it that you have "password123" as password for database? how come it worked in php as "password"?

Ответить
@nithyasundar9607
@nithyasundar9607 - 22.01.2015 14:53

Getting errors when connecting to db,

Access denied for user 'root'@'localhost'(using password: YES)

Ответить
@anudhanda1143
@anudhanda1143 - 09.01.2015 03:11

Hello everyone can u tell me which username & password can i entered here because when i enter the username root & password is blank or any other it show the error message like couldn't connect to the database.I am doing work on mac-book pro.Please help me   

Ответить
@IroshanVithanage
@IroshanVithanage - 06.01.2015 04:32

Why did you stop making tutorials?

Ответить
@00713926
@00713926 - 03.01.2015 12:29

its awesome and  easy to understand .. thanks buddy 

Ответить
@raghavkhanna2096
@raghavkhanna2096 - 19.11.2014 17:24

hey! I wanna give you a very big thanks for these tutorials and i am also a big fan of your's as i also love web designing :)> 

Ответить
@nithyasundar9607
@nithyasundar9607 - 28.10.2014 13:03

what's wrong in my code can't insert data in to database

<?php
        
        $connect = mysql_connect("localhost","root","root") or die(mysql_error());
        mysql_select_db("accounts",$connect);
        $sql = "
            CREATE TABLE users3
           {
            
ID int NOT NULL AUTO_INCREMENT,
Username VARCHAR(20),
Password VARCHAR?(20),
First VARCHAR(20),
Last VARCHAR(20)

)
 ";
        echo $sql;
                
        mysql_query($sql,$connect);
        
        ?>

Ответить
@ppothuri
@ppothuri - 15.08.2014 01:42

cool..good lecture

Ответить
@jezzadiaz5972
@jezzadiaz5972 - 11.06.2014 18:19

Hey! super thank you. You're such a good guy for conducting lectures like this. Thaaaaanks! I hope I could thank you personally.

Ответить
@Tklall8
@Tklall8 - 03.04.2014 02:34

Excellent job! You do an excellent job in explaining things. I am a slow learner, but I grasped tons from your tutorial. Thank you

Ответить
@LalaTheFirst95
@LalaTheFirst95 - 01.04.2014 20:59

GOOD MAN BRENNIE YOU LEGEND!!!!!!!!!!!!!

Ответить
@jorenwouters9334
@jorenwouters9334 - 22.03.2014 01:42

Parse error: syntax error, unexpected ';' in C:\Users\Joren\Documents\Code\Websites\Xampp\htdocs\mysql.php on line 3

That is the error I get, can somebody help me?

Ответить
@GALAXIN10
@GALAXIN10 - 25.02.2014 06:22

When I write mysqli_connect with an 'i'.They said no privilege to create database.What to do 

Ответить
@mrnishare
@mrnishare - 16.02.2014 13:16

when i give username and password it says " #1045 Cannot log in to the MySQL server" plz anyone can help me ?

Ответить
@NoeLayan
@NoeLayan - 01.02.2014 10:44

why this isn't working on me? I follow everything in  this tutorial. I'm using XAMPP V3.2.1

Ответить
@AbdulQadirghayour
@AbdulQadirghayour - 15.01.2014 15:33

Giving the following error while logging in( #1045 Cannot log in to the MySQL server)

Ответить
@majidnoroozi4015
@majidnoroozi4015 - 02.01.2014 18:51

PLEASE HELP ME

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\mns\ControlPanel\Check.php on line 25



$link = mysql_connect($ServerName.":".$User.$Pass);
mysql_select_db($DBName,$link);
$sql =  "Select * from Administration where  username='$_username' and password='$_password' " ;
$result= mysql_query($sql,$link);
if (mysql_fetch_assoc($result))       //this is line 25

//goto main page
 print ( Redirect('Main.php') );

Ответить
@bridgetbasan4519
@bridgetbasan4519 - 04.12.2013 02:01

If this doesn't work for anyone, try typing mysqli_connect with an 'i'. It worked for me then.

Ответить
@isaiahcordova3953
@isaiahcordova3953 - 24.09.2013 07:17

how many are u going to make this is awesome!

Ответить
@isaiahcordova3953
@isaiahcordova3953 - 24.09.2013 07:17

you sound diffrent

Ответить
@JamesAllenIII
@JamesAllenIII - 20.09.2013 21:21

Dude this totally awesome!!!

Ответить
@slavicakaraterzieva3257
@slavicakaraterzieva3257 - 07.09.2013 18:30

please help! I tried to create database but there was a sign saying no privilegies! and I couldnt open database.

Ответить
@hpss007
@hpss007 - 01.08.2013 14:53

i know i will start earning some bucks learning php from you dude.. hats off.. thanks for sharing your valuable knowledge in simplest form.

Ответить
@ranaboy007
@ranaboy007 - 20.07.2013 17:49

How to make a composite key of two foreign keys in xampp?

Ответить
@sumer9999
@sumer9999 - 14.07.2013 22:18

This is the simplest tutorial i have ever seen

Ответить
@rockmanzerox105
@rockmanzerox105 - 05.04.2013 12:57

thanks much! :D

Ответить
@BlitzenRot
@BlitzenRot - 19.03.2013 00:04

Yes, it's amazing isn't it! :D

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:49

while testing your connection comment the top loine out i.e. // error_reporting(0); and save the file

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:44

other connection methods are through PDO or mysqli, these are supposed to be more secure, i.e. error_reporting(0); $db_connection = mysqli_connect("localhost", "root", "YourPassword", "YourDatabase") or die(mysql_errors()); if (mysqli_connect_errno()) { echo "Error, call back later"; exit(); } else { echo "Connected"; }

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:31

If you have problems remembering all your different passwords think about downloading and installing Keepass.

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:29

If you download the latest version of Xampp when the app starts you can see which ports are used by each engine, these ports need to be free for it to run without problems, if you have other software running that uses any of these ports you will need to stop that software then start up Xampp.

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:21

if it is xampp it uses port 80, do the same, find out the software using the port and stop it

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:20

You may have other software using the port that mysql uses, the default is 3306, you need to find the software that is using it and stop it then start mysql

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:19

By the looks of it the port maybe being used by some other software. Mysql uses port 3306, try to locate what software is using it, if it is just something that you have installed that you are not using then you can stop it and start mysql.

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:16

If you lose/forget your password for phpmyadmin/xampp google find password in xampp to get instructions how to resolve without having to reinstall.

Ответить
@dashbyictfd
@dashbyictfd - 15.03.2013 02:15

The colleges block it for security reasons, you will not be able to get round it unless you hacked into the system which obviously I wouldn't suggest you try unless you want to cut your course short. You should download and install Xampp (On your own computer) and that installs all that Chris is going over at this point.

Ответить
@JonathanMacIntyre
@JonathanMacIntyre - 14.03.2013 18:52

When I try to log into phpadmin I get the message "Cannot log in to the MySQL server" I went back and changed my password to make sure it is correct and restarted. I still cannot get into phpadmin. Can anyone help?

Ответить
@ankitkumarsinha6218
@ankitkumarsinha6218 - 13.03.2013 20:34

hey i am facing some problem regarding sql services.. port 3306 is been blocked in my college.. so i could not start my sql.. please help as soon as possible.

Ответить
@09821354343
@09821354343 - 06.03.2013 14:41

if i dont have UN and PW then what is the syntax ?

Ответить
@MrYoungsuss
@MrYoungsuss - 03.03.2013 14:25

i have entered my password and username but still it replies cannot log in to the Mysql seerver ????????

Ответить
@MrYoungsuss
@MrYoungsuss - 02.03.2013 17:44

i cant acces my php admin HELP

Ответить