#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    8
    Rep Power
    0
    I have a problem caused by the following function. The page will not load with this function in it. If I comment the function out the page loads fine. I don't get any error messages and error_reporting is set to 15. I don't even call the function.

    function dislpayCategory($category)
    {
    $qid = dbQuery("SELECT product_id FROM products_categories WHERE category_id='$category'");
    $result = dbQuery("SELECT name, price, productCode FROM products WHERE id IN '$qid'");
    $productInfo = mysql_fetch_array($result);
    echo "<table width="300">";
    while($productInfo!="false")
    {
    echo "<tr>";
    echo "<td>";
    echo "<a href="product.php?product=$productInfo["productCode"]">$productInfo["name"]</a>";
    echo "</td>";
    echo "<td>";
    echo $productInfo["productCode"];
    echo "</td>";
    echo "<td align="right">";
    echo markup($productInfo["price"]);
    echo "</td>";
    echo "</tr>";

    $productInfo = mysql_fetch_array($result);
    }
    echo "</table>";
    }

    Whenever this function is in the file, all the gets sent to the browser is:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
    <BODY></BODY></HTML>

    That stuff is nowhere in any of my code. Any help would be appreciated.

    -Josh



    [This message has been edited by jpangborn (edited August 16, 2000).]
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    Change error_reporting to 16 (You need e_error on).

    I can see you have an error in your sql statement. You need to get the result set of the first query if you are going to use it in the second query. You can't use the result index as reference for the IN statement.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    8
    Rep Power
    0
    What is the best way to get the result set of the first query. I don't want just one row at a time. I need all of them. Also, I changed the error_reporting to 16 and I still didn't get an error message. This function isn't being called. Just the function definition is present. I haven't even started the code to call the function. Just the definition being present in the file causes the error. Thanks

    -Josh

    [Update]

    I took the error_reporting function out because the server I am on has PHP 4.0.1 without Patch Level 2. Now I get an error message saying Fatal Error: Failed Opening required: [path]/functions.php in application.php on line 30. If I comment out the displayCategory function, it loads fine. It I take the comment out, error comes back. For what reason, would a function definition cause a php file to not load. Thanks


    [This message has been edited by jpangborn (edited August 16, 2000).]

    [This message has been edited by jpangborn (edited August 16, 2000).]

Similar Threads

  1. PHP math problem
    By spank in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 06:58 AM
  2. problem in Uploading file of size more than 512k in php
    By ssomvanshi in forum PHP Development
    Replies: 3
    Last Post: February 7th, 2004, 05:32 AM
  3. XML DOM and PHP Problem, not displaying wanted info
    By drazhargraig in forum PHP Development
    Replies: 2
    Last Post: February 3rd, 2004, 03:14 PM
  4. fread problem: doesn t compile php code
    By ghorghor2002 in forum PHP Development
    Replies: 2
    Last Post: February 3rd, 2004, 05:25 AM
  5. New to PHP - problem with tutorial
    By adam_j_c in forum PHP Development
    Replies: 3
    Last Post: February 1st, 2004, 09:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo