Results 1 to 2 of 2

Thread: MySQL via PHP include()?

  1. #1
    Join Date
    Jan 2005

    MySQL via PHP include()?

    I have a problem trying to run a MySQL query through an "include()"-ed page.

    Page A is as follows:
    $query1 = "SELECT blah FROM blah....";
    $result1 = mysql_query($query1);
    //This query works, proving that the connect.php file has linked successfully.
    //See Page B's code below
    Now for Page B:
    $query2 = "SELECT blah FROM blah...";
    $result2 = mysql_query($query2);
    while($row2 = mysql_fetch_assoc($result2))
    echo $row2['blah'];
    The problem is that this second query (the one in page B) never writes the result to Page A. I have tried adding the "include('connect.php');" line to Page B to ensure that it works, but it still doesn't. Any reasons why a query written in a different file won't execute from a page that include()s it?

  2. #2
    Join Date
    Jan 2005
    Okay, never mind. For future reference, it DOES work but I had a PHP version error. Sorry for the trouble!

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