Professional Web Applications Themes

an easy one i'm apparently too tired to fix... - PHP Development

this block is included by my index.php if the user has selected a category ($catID) of products to view... $db = mysql_connect($host, $dbuser, $dbpass) or die("no connection"); mysql_select_db($dbase,$db); $sql = "SELECT * FROM product WHERE CategoryID ='$catID' and featured='Y' ORDER BY ProductName LIMIT 12"; echo $sql; $result = mysql_query($sql,$db); //this is just so I can generate a new <tr> when 3 columns have been displayed $numCols=0; echo "<table><tr><td>"; while ($myrow = mysql_fetch_array($result)) { Astonishingly, it works when catID=1 but not catID=2. I took the sql statement that got echoed when catID=2 and pasted it into phpmyadmin, and it retrieved the ...

  1. #1

    Default an easy one i'm apparently too tired to fix...

    this block is included by my index.php if the user has selected a category
    ($catID) of products to view...
    $db = mysql_connect($host, $dbuser, $dbpass) or die("no connection");

    mysql_select_db($dbase,$db);

    $sql = "SELECT * FROM product WHERE CategoryID ='$catID' and featured='Y'
    ORDER BY ProductName LIMIT 12";

    echo $sql;

    $result = mysql_query($sql,$db);

    //this is just so I can generate a new <tr> when 3 columns have been
    displayed

    $numCols=0;

    echo "<table><tr><td>";

    while ($myrow = mysql_fetch_array($result)) {

    Astonishingly, it works when catID=1 but not catID=2. I took the sql
    statement that got echoed when catID=2 and pasted it into phpmyadmin, and it
    retrieved the record correctly. So the data is there. And it works, like I
    said, for catID=1. So the connection is there. Can you see any red flags?


    Matthew Crouch Guest

  2. #2

    Default Re: an easy one i'm apparently too tired to fix...


    "Matthew Crouch" <matthew.crouchspamlessverizon.net> schreef in bericht
    news:_8Wnb.5046$Q9.1599nwrddc02.gnilink.net...
    >
    > Astonishingly, it works when catID=1 but not catID=2. I took the sql
    > statement that got echoed when catID=2 and pasted it into phpmyadmin, and
    it
    > retrieved the record correctly. So the data is there. And it works, like I
    > said, for catID=1. So the connection is there. Can you see any red flags?
    >
    >
    One option would be, that your website runs on another version then
    phpmyadmin does (are you developing on localhost)?

    Another option would be, that permissions deny the user to access the table
    through your page, while you are logging into phpmyadmin as root.

    Try some debugging by appending 'or die(mysql_error())' after each mysql_*
    function call.


    Good night ;-)

    JW



    Janwillem Borleffs Guest

  3. #3

    Default Re: an easy one i'm apparently too tired to fix...

    Thanks for replying. it was something different, though...which I'll share
    for amusement value (amazing what a good nap will do for you):

    I had to make a copy of the dB awhile back and was looking at the old one
    through phpmyadmin. So when I said the data is definitely there, I was being
    hasty. I was looking for data that I had added since the copy.

    bye


    "Janwillem Borleffs" <jwjwscripts.com> wrote in message
    news:3fa03c12$0$209$1b62eedfnews.euronet.nl...
    >
    > "Matthew Crouch" <matthew.crouchspamlessverizon.net> schreef in bericht
    > news:_8Wnb.5046$Q9.1599nwrddc02.gnilink.net...
    > >
    > > Astonishingly, it works when catID=1 but not catID=2. I took the sql
    > > statement that got echoed when catID=2 and pasted it into phpmyadmin,
    and
    > it
    > > retrieved the record correctly. So the data is there. And it works, like
    I
    > > said, for catID=1. So the connection is there. Can you see any red
    flags?
    > >
    > >
    >
    > One option would be, that your website runs on another version then
    > phpmyadmin does (are you developing on localhost)?
    >
    > Another option would be, that permissions deny the user to access the
    table
    > through your page, while you are logging into phpmyadmin as root.
    >
    > Try some debugging by appending 'or die(mysql_error())' after each mysql_*
    > function call.
    >
    >
    > Good night ;-)
    >
    > JW
    >
    >
    >

    Matthew Crouch Guest

Similar Threads

  1. Ok I am tired
    By David in forum PERL Beginners
    Replies: 4
    Last Post: August 10th, 05:32 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139