Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    Post the code you have between the [insert_php] and [/insert_php] tags. I’ll see what I can see.

    Plugin Author WillBontrager

    (@willbontrager)

    I’m assuming the OP resolved the issue as there was no response.

    Thread Starter Blake

    (@blakemoore123)

    This is not resolved.

    [insert_php]
    $con = mysql_connect("MY SERVER","MY USERNAME","MY PASS");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("MY DATABASE");
    
    $results = mysql_query("select * from wp_users") or die(mysql_error());
    
    if($results)
    {
    echo "$results";
    }
    else
    {
    echo "Failed";
    }
    [/insert_php]

    Cheers Will!

    Plugin Author WillBontrager

    (@willbontrager)

    Use mysqli_connect and its associated mysqli_… functions instead of mysql_connect.

    Two reasons.

    1. mysql_connect is being deprecated.
    (See https://us3.php.net/manual/en/function.mysql-connect.php )

    2. I’ve found that accessing MySQL with my own code concurrently with WordPress using MySQL can fail when I use mysql_connect.

    Will

    Plugin Author WillBontrager

    (@willbontrager)

    One more thing. This is not a forum on how to write PHP code, and I’m not going to let it become one. However, here is one more tip:

    If you want to see the results of your SELECT query, you’ll need to fetch the data from $result with a function for that purpose, mysqli_fetch_assoc() for example.

    Will

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Resource id #250’ is closed to new replies.