PHP Tutorial 27 - MySQL Creating A Table (PHP For Beginners)

preview_player
Показать описание
In the previous tutorial we took a first look at MySQL and Phpmyadmin. In this video we will run our first MySQL Query through PHP to create a table inside of our accounts database that we created in part 26.

For more information, check out the website:

Рекомендации по теме
Комментарии
Автор

It's actually sad that I've learned more in less than a day from this guy than half a year at a university in UK.

Grayfoxhound
Автор

He sure is an intelligent guy and presents in all very well. I bet he could walk into many a job, I'm sure it was a long road to accumulate all that knowledge. Well done and thank you.

Pantheranca
Автор

These tutorials are awsome! Finally I"m understanding the real thing. thanks man, you are a great tutor!

samuelbetances
Автор

I know SQL, dont know PHP.
This is a Godsend.

JohnWilkinsonTesla
Автор

Thank you Chris, I really enjoyed your tutorials.
For those who have creating table problem, try this out:
$con=mysqli_connect("example.com", "peter", "abc123");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Create database
$sql="CREATE DATABASE my_db";
if (mysqli_query($con, $sql))
{
echo "Database my_db created successfully";
}
else
{
echo "Error creating database: " . mysqli_error();
}

elwaledali
Автор

One thing that worked for me: put a fourth parameter into the mysql_connect function and add your database name. Cheers!

mundebateguyperson
Автор

I am very happy about your video in PHP. they are very helpful. thank you very much.

jerbancoalijerban
Автор

Thank buddy! You are the best! I finally learnt it from your video!!

EricsonSWeah
Автор

ok, for anyone else who had this problem, I realised what happened. I used curly brackets inside the $sq1 variable, when they should be regular roundy ones. It's just a little hard to see them properly on the screen sometimes. Thanks again for these videos :)

TheBraisinful
Автор

Yes, I also made a syntax error and no warnings, just didn't create the table. But good to know - thanks jjeerrnneejj.
And thanks again Chris Johnson - you're awesome!!!

Bencia
Автор

Hey Chris, I would request you to upload some video tutorials of javascript as well.

chiraggupta
Автор

It works :

<?php

$con = mysqli_connect("localhost", "root", "", "accounts1");
// Check connection

// Create table
$sql = "CREATE TABLE users7
(
ID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(ID),
Username varchar(20),
Password varchar(20),
FirstName varchar(20),
LastName varchar(20)
)";

// Execute query
mysqli_query($con, $sql)

hef
Автор

great work mate really appreciate these videos, any chance of more in the future on php?

ProsOnlyProductions
Автор

You need to check for typos, 1 typo = no table. It does work when you have it written as Chris has done it.

dashbyictfd
Автор

if your having problems with it creating the second table, make sure you are not putting any spaces in the name of row properties, so "first name varchar(20)" would be "firstname varchar(20)"

adrianr
Автор

Thank you very much for these tutorials they are amazing ! This is the first video which i got stuck in and was wondering if you could help me out....

I managed to establish the connection with my localhost database, the only problem is the table users2 is not getting created.

Do you have an idea why this might be occurring ?


iksciberras
Автор

I have made sure my code is correct, and so far every tutorial has gone smoothly for me. But for some reason the table 'user2' is not being created. I have thoroughly checked the code. Any suggestions? Great videos, very clear and concise. Thanks!

TheBraisinful
Автор

Hi mate, great tutorial and Im enjoying it a lot. I learned more from you than from my professor. Anyway, I have a little problem. I followed everything on the tutorial, it executed great on browser(no errors), but the table does not show up in the account. Something I did wrong? A little help, please :)

MasterChicken
Автор

For those who are not getting the second table i.e, in this case user2,  please logout from the phpMyAdmin and then login again. or Just open a new tab and type localhost/xampp/  and go to the phpMyAdmin link again. User2 will be there. #HappyCoding :)

TheAbbyLo
Автор

hey bro ! nice line up of tutorials . I, ve been following all the tutorials with ease, but now i am having a small problem . I cannot connect mySQL and php properly, i can't create a table to can't update some date to mySQL . what should i do . Help plz . thanks in advance,  

ammadtarar
welcome to shbcf.ru