www.webdeveloper.com
Results 1 to 3 of 3

Thread: mysqli connection not cooperating

  1. #1
    Join Date
    Mar 2014
    Location
    Corpus Christi, TX
    Posts
    88

    mysqli connection not cooperating

    All,

    I've been programming PHP for about a year now, but for some reason, I can't connect to one of my databases.

    PHP Code:
    $con mysqli_connect("localhost""timw79_rfid""xpress13""timw79_rxrfid");if (mysqli_connect_errno()) {  echo "Failed to connect to MySQL: " mysqli_connect_error();}
    $result mysqli_query($con,"SELECT AssignedMachine FROM TagAssignments WHERE TagID=$tag1");


    while(
    $row mysqli_fetch_array($result)) {  echo $row['AssignedMachine'] . " " $row['TagID'];  echo "<br>";} 
    I have confirmed that $tag1 is reporting correctly. I checked spelling and capitalization. I'm stumped on this one. I am getting the error:
    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home3/timw79/public_html/rxrfid/piupload/addmachinenames.php on line 76

    Where have I gone wrong?

    I have attached the PHP MyAdmin page for this table in case it is needed.

    rxrfidsnap.JPG

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    724
    Add a check to see if you query ran - it didn't. Echo out the error message from it.
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  3. #3
    Join Date
    Mar 2014
    Location
    Corpus Christi, TX
    Posts
    88
    Ah yes, I forgot to report the errors. I was able to get the query working. I appreciate the reminder.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles