Results 1 to 7 of 7

Thread: MySQL ko PhP say connect karny ka tariqa with full explaination

  1. #1
    ali_num13 is offline Senior Member+
    Last Online
    9th August 2016 @ 07:28 PM
    Join Date
    29 Dec 2012
    Gender
    Male
    Posts
    199
    Threads
    102
    Credits
    1,008
    Thanked
    8

    Lightbulb MySQL ko PhP say connect karny ka tariqa with full explaination

    Assalam o aliekum dosto, aaj may aa sab ko ek bht he simple tariqa btaoun ga or wo bhi full explaination k sath.
    Bht say log jb mysql start karty hain tio wo es bat may bht confuse ho jatay hain k unsy php say mysql say connection nahi ban rha to aaj es tutorial may a to btaoun ga k kesay bnaya jata hy. Dosto es tutorial may main ny 110% explain kia hy sari logics k sath k connection kis trah banta hy taaky har bat clear ho jaye.

    sb say pehly may ye bta du k mysql bnany wali company ny ab esay upgrade kar k esko MySQLi kar dia hy.. yani end per "i" ata hy ab jiska matlb hy improved or aab aagay yehi chal rahi hay purana sab ditch kar dia geya hy php walo ki taraf say bhi or mysql ki taraf say bhi

    Connection:
    es k lye php ka ek function use hota hy:
    mysqli_connect();
    ye function 4 parameters leta hy jo apki database say connection bnaty hain
    (i) Internet Service ka Host name
    (ii) Username jo apny mysqli may set kia hota hy
    (iii) password jo mysqli may set kia hota
    (iv) DataBase ka name jis Database say connect karna hy

    behtar hy hum en charon ko variable bna k mysqli_connect k function may send kar dein

    $hostname = "localhost";
    $username = "root";
    $password = "";
    $dbname = "userRecords";


    dosto ye sab default settings hain jo generally use hoti hain mgar professional level pe username or password lazmi different hoty hain or hostname ziadatar localhost he chalta hy....To ab en ko function may send karty hain

    mysqli_connect($hostname, $username, $password, $dbname);

    php ka ye function humy ek cheese return karta hy jisay kaha jata hy mysqli connection handler or ye handler functions ko ye btata hy k kis db say data use karna hy, ye handler hum 90% say ziada php k functions may use karty hain es lye behtar hy k esko ek variable may store kr lia jaye:

    $con = mysqli_connect($hostname, $username, $password, $dbname);

    Last step ye hy k hum ye confirm karty hain k connection bana hy k nahi or agr nahi bana to php ko he stop kar dete hain:

    if(mysqli_connect_errno()){
    die("Connection Failed: ".mysqli_connect_error());
    };


    to agr connection bnaty huye koi error aya to if k ander jo expression hy yani k mysqli_connect_errno() uski koi na koi value hogi or agar connection ban gya successfully to eski value automatically ho jaye ge false or baqi ki site open ho jye ge. ye function humy db connection ka error num return karta hy.
    mysqli_connect_error() ka function humy pura error return karta hy vrna php k apny error msgs apny dekhy he hongy kitny buray lagty hain ye saf suthra error return karta hy..

    ye lein dosto full code connection ka...

    $hostname = "localhost";
    $username = "root";
    $password = "";
    $dbname = "userRecords";

    $con = mysqli_connect($hostname, $username, $password, $dbname);

    if(mysqli_connect_errno()){
    die("Connection Failed: ".mysqli_connect_error());
    };


    to li jiye dosto ye full explaination hy k PHP ki script ko aap MySQLi say kesay connect karty hain. umeed hy aap sab ko pasand aye ga. comments zaroor di jiye ga or mera youtube channel zaroor check karein may us per bhi full explain karta hu logics k sath k koi cheese kesay kam karti hy..


  2. #2
    Dilshad642 is offline Member
    Last Online
    16th June 2016 @ 09:58 AM
    Join Date
    14 Jun 2014
    Location
    mirani
    Age
    25
    Gender
    Male
    Posts
    1,714
    Threads
    147
    Thanked
    101

    Default

    Nice Thread

  3. The Following User Says Thank You to Dilshad642 For This Useful Post:

    ali_num13 (15th March 2016)

  4. #3
    ali_num13 is offline Senior Member+
    Last Online
    9th August 2016 @ 07:28 PM
    Join Date
    29 Dec 2012
    Gender
    Male
    Posts
    199
    Threads
    102
    Credits
    1,008
    Thanked
    8

    Default

    thank you janab

  5. #4
    Umarkhan147's Avatar
    Umarkhan147 is offline Advance Member
    Last Online
    6th October 2017 @ 10:59 AM
    Join Date
    22 Dec 2015
    Location
    Faisalabad
    Age
    22
    Gender
    Male
    Posts
    4,869
    Threads
    231
    Credits
    31,357
    Thanked
    300

    Default

    Bhot Achy

    - - - Updated - - -

    Bhot Achy

  6. #5
    Prince786123 is offline Senior Member+
    Last Online
    29th November 2017 @ 05:17 PM
    Join Date
    05 Apr 2017
    Age
    21
    Gender
    Male
    Posts
    63
    Threads
    8
    Credits
    452
    Thanked: 1

    Default php nice

    wowow

  7. #6
    asad_leo94's Avatar
    asad_leo94 is offline Junior Member
    Last Online
    3rd May 2017 @ 11:31 AM
    Join Date
    15 Apr 2017
    Location
    Islamabad
    Gender
    Male
    Posts
    25
    Threads
    1
    Credits
    316
    Thanked
    0

    Default

    nice

  8. #7
    asad_leo94's Avatar
    asad_leo94 is offline Junior Member
    Last Online
    3rd May 2017 @ 11:31 AM
    Join Date
    15 Apr 2017
    Location
    Islamabad
    Gender
    Male
    Posts
    25
    Threads
    1
    Credits
    316
    Thanked
    0

    Default

    Nice

Similar Threads

  1. Pc sy Mobile connect karny ka tariqa
    By Iltaf Bozdar in forum Nokia & Othre Mobiles
    Replies: 30
    Last Post: 18th November 2015, 06:19 PM
  2. qmobile model chek karny ka tariqa
    By mali486 in forum Mobile phones problems and Help Zone
    Replies: 11
    Last Post: 3rd August 2015, 05:08 PM
  3. N70 hack karny ka tariqa btady
    By HiDayaT_Niazi in forum Mobile phones problems and Help Zone
    Replies: 10
    Last Post: 16th July 2015, 04:50 PM
  4. PTCL Brodband ki speed ko share karny ka tariqa
    By janu in forum Ask an Expert
    Replies: 5
    Last Post: 10th February 2010, 10:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •