SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast AimyThomas's Avatar
    Join Date
    Sep 2011
    Posts
    46
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Need Help in PHP MySQL?

    PHP MySQLI code not working

    $q = "UPDATE users SET password = '6c55803d6f1d7a177a0db3eb4b343b0d50f9c111' WHERE id = '1';";
    mysqli_query($dbc, $q);



    Dot knows but some cause it keeps giving me the following error:


    Warning: mysqli_query()

    Expects parameter 1 to be mysqli, null given



    Can anyone help me

    Thanks in advance

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,069
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Where are you defining/declaring the variable $dbc?

    As shown in the PHP Manual, $dbc needs to be the result of mysqli_connect (second example)

  3. #3
    SitePoint Addict kduv's Avatar
    Join Date
    May 2012
    Location
    Maui, HI
    Posts
    211
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Also, in your SQL, you do not need the second-to-last semicolon.
    Change:
    PHP Code:
    $q "UPDATE users SET password = '6c55803d6f1d7a177a0db3eb4b343b0d50f9c111' WHERE id = '1';"
    To:
    PHP Code:
    $q "UPDATE users SET password = '6c55803d6f1d7a177a0db3eb4b343b0d50f9c111' WHERE id = 1"
    Also note that you don't need to (and probably shouldn't) quote integer values in your SQL.


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
  •