Re: [PHP-DB] Mysql result resource error

2001-12-20 Thread Jim Lucas

which one was giving you the problem? the first or second mysql try.  if it
was the second, try wrapping the $cattyname with single quotes  like this
Minor_Category = '$cattyname'.  if the $cattyname var has anything but
numbers, the statement won't work.

Jim
- Original Message -
From: Shannon Doyle [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 19, 2001 4:19 PM
Subject: [PHP-DB] Mysql result resource error


 Hi People,

 I am getting a Not a valid Mysql result resource error with the
 following code, can someone take a look at this for me and see if there
 is anything that stands out

 Thanks,

 Shannon

 ?
 $cattyname = ;
 $sql = select Minor_Category main where Page = 'wines' order by
 Minor_Category;
 $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
 $results2 = mysql_db_query($db,$sql,$dbh);
   for($j = 0; $j  mysql_num_rows($results2); $j++) {
   $array[$j] = mysql_fetch_array($results2);
 }
 mysql_close($dbh);
 for ($h = 0; $h  count($array); $h++)  {

 if ($array[$h][Minor_Category] != $cattyname) {
   $cattyname = $array[$h][Minor_Category];
   echo trtd colspan='4'a
 name='.$cattyname.'/ab.$cattyname./b/td/td/tr;


 $catname = ;
 $sql = select Category,Code,Description,Pack,Unit,Price from main where
 Page = 'wines'  Minor_Category = $cattyname order by Category;
 $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
 $results = mysql_db_query($db,$sql,$dbh);
   for($i = 0; $i  mysql_num_rows($results); $i++) {
   $array[$i] = mysql_fetch_array($results);
 }
 mysql_close($dbh);

 for ($i = 0; $i  count($array); $i++)  {

 if ($array[$i][Category] != $catname) {
   $catname = $array[$i][Category];
   echo trtd colspan='4'a
 name='.$catname.'/ab.$catname./b/tdtd
 align='center'pbCarton Size/b/p/tdtd
 align='center'pbUnit/b/p/tdtd
 align='right'pbPrice/b/p/tdtda href='#top'img
 src='images/arrow.gif' border='0'/a/td/tr;
 }

   echo trtd/tdtdpa
 href=javascript:order_now(quot;.$array[$i][Code].quot;)img
 src='images/order.gif' border='0'/a/tdtd/tdtd
 align='left'p.$array[$i][Description]./p/tdtd
 align='center'p.$array[$i][Pack]./p/tdtd
 align='center'p.$array[$i][Unit]./p/tdtd
 align='right'p$.$array[$i][Price]./p/td/tr\n;
 }
 }
 }
 ?


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Mysql result resource error

2001-12-20 Thread Shannon Doyle

Hi Jim,

Ahh yes of courseI have corrected this.

I am still getting the error on the first query...not sure why. And now
I am getting a whole bunch of empty lines being output to the screen.
Like there is supposed to be data in those lines, but nothing happening.
Plus I am getting repeats of the same data. Its like it is doing each
query three times or something.

Don't know why it is doing that.

- Shannon

 -Original Message-
 From: Jim Lucas [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, 21 December 2001 03:52 AM
 To: Shannon Doyle; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Mysql result resource error
 
 
 which one was giving you the problem? the first or second 
 mysql try.  if it
 was the second, try wrapping the $cattyname with single 
 quotes  like this
 Minor_Category = '$cattyname'.  if the $cattyname var has anything but
 numbers, the statement won't work.
 
 Jim
 - Original Message -
 From: Shannon Doyle [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, December 19, 2001 4:19 PM
 Subject: [PHP-DB] Mysql result resource error
 
 
  Hi People,
 
  I am getting a Not a valid Mysql result resource error with the
  following code, can someone take a look at this for me and 
 see if there
  is anything that stands out
 
  Thanks,
 
  Shannon
 
  ?
  $cattyname = ;
  $sql = select Minor_Category main where Page = 'wines' order by
  Minor_Category;
  $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
  $results2 = mysql_db_query($db,$sql,$dbh);
for($j = 0; $j  mysql_num_rows($results2); $j++) {
$array[$j] = mysql_fetch_array($results2);
  }
  mysql_close($dbh);
  for ($h = 0; $h  count($array); $h++)  {
 
  if ($array[$h][Minor_Category] != $cattyname) {
$cattyname = $array[$h][Minor_Category];
echo trtd colspan='4'a
  name='.$cattyname.'/ab.$cattyname./b/td/td/tr;
 
 
  $catname = ;
  $sql = select Category,Code,Description,Pack,Unit,Price 
 from main where
  Page = 'wines'  Minor_Category = $cattyname order by Category;
  $dbh = @mysql_connect($dbhost,$dbuser,$dbpass);
  $results = mysql_db_query($db,$sql,$dbh);
for($i = 0; $i  mysql_num_rows($results); $i++) {
$array[$i] = mysql_fetch_array($results);
  }
  mysql_close($dbh);
 
  for ($i = 0; $i  count($array); $i++)  {
 
  if ($array[$i][Category] != $catname) {
$catname = $array[$i][Category];
echo trtd colspan='4'a
  name='.$catname.'/ab.$catname./b/tdtd
  align='center'pbCarton Size/b/p/tdtd
  align='center'pbUnit/b/p/tdtd
  align='right'pbPrice/b/p/tdtda href='#top'img
  src='images/arrow.gif' border='0'/a/td/tr;
  }
 
echo trtd/tdtdpa
  href=javascript:order_now(quot;.$array[$i][Code].quot;)img
  src='images/order.gif' border='0'/a/tdtd/tdtd
  align='left'p.$array[$i][Description]./p/tdtd
  align='center'p.$array[$i][Pack]./p/tdtd
  align='center'p.$array[$i][Unit]./p/tdtd
  align='right'p$.$array[$i][Price]./p/td/tr\n;
  }
  }
  }
  ?
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]