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

This is a discussion on an easy one i'm apparently too tired to fix... within the alt.comp.lang.php forums, part of the PHP Programming Forums category; this block is included by my index.php if the user has selected a category ($catID) of products to view... $...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-29-2003
Matthew Crouch
 
Posts: n/a
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?


Reply With Quote
  #2 (permalink)  
Old 10-29-2003
Janwillem Borleffs
 
Posts: n/a
Default Re: an easy one i'm apparently too tired to fix...


"Matthew Crouch" <matthew.crouch@spamlessverizon.net> schreef in bericht
news:_8Wnb.5046$Q9.1599@nwrddc02.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



Reply With Quote
  #3 (permalink)  
Old 10-30-2003
Matthew Crouch
 
Posts: n/a
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" <jw@jwscripts.com> wrote in message
news:3fa03c12$0$209$1b62eedf@news.euronet.nl...
>
> "Matthew Crouch" <matthew.crouch@spamlessverizon.net> schreef in bericht
> news:_8Wnb.5046$Q9.1599@nwrddc02.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
>
>
>



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:47 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0