need help debugging!

2002-03-01 Thread Alex Behrens

Hey All,

I am new to mysql and I need help debugging this peice of code for my site:

?php
$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
mysql_select_db(rahs,$db);
$search = mysql_query(SELECT * FROM rahs);
while($num=mysql_fetch_array($search)) {
printf (div align='center'centertable border='0' cellpadding='0'
cellspacing='0' width=\40%\trtd
width=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
width=\30%\Team: %s/td/trtrtd width=\100%\ colspan='2'Penalty:
%s/td/trtrtd width=\50%\Groundballs: %s/tdtd
width=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
Won:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
width=\100%\ colspan='2'p
align='center'Date:%s/td/tr/table/center/div,$num[name],$num[
number],$num[team],$num[penalty],$num[groundballs],$num[shots],$num
[faceoffs_won],$num[faceoffs_lost],$num[date]);
}
?

it says this error:
Warning: Supplied argument is not a valid MySQL result resource on line 17
line 17 would be this line:
while($num=mysql_fetch_array($search)) {

what is wrong with my code?


Thanks!

-Alex Big Al Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging!

2002-03-01 Thread Uma Shankari T.


Hello Alex,


  If the mysql query returns 0 then it will display the message like this


-Uma


On Fri, 1 Mar 2002, Alex Behrens wrote:

ABHey All,
AB
ABI am new to mysql and I need help debugging this peice of code for my site:
AB
AB?php
AB$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
ABmysql_select_db(rahs,$db);
AB$search = mysql_query(SELECT * FROM rahs);
ABwhile($num=mysql_fetch_array($search)) {
ABprintf (div align='center'centertable border='0' cellpadding='0'
ABcellspacing='0' width=\40%\trtd
ABwidth=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
ABwidth=\30%\Team: %s/td/trtrtd width=\100%\ colspan='2'Penalty:
AB%s/td/trtrtd width=\50%\Groundballs: %s/tdtd
ABwidth=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
ABWon:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
ABwidth=\100%\ colspan='2'p
ABalign='center'Date:%s/td/tr/table/center/div,$num[name],$num[
ABnumber],$num[team],$num[penalty],$num[groundballs],$num[shots],$num
AB[faceoffs_won],$num[faceoffs_lost],$num[date]);
AB}
AB?
AB
ABit says this error:
ABWarning: Supplied argument is not a valid MySQL result resource on line 17
ABline 17 would be this line:
ABwhile($num=mysql_fetch_array($search)) {
AB
ABwhat is wrong with my code?
AB
AB
ABThanks!
AB
AB-Alex Big Al Behrens
ABE-mail: [EMAIL PROTECTED]
ABUrgent E-mail: [EMAIL PROTECTED] (Please be brief!)
ABPhone: 651-482-8779
ABCell: 651-329-4187
ABFax: 651-482-1391
ABICQ: 3969599
ABOwner of the 3D-Unlimited Network:
ABhttp://www.3d-unlimited.com
ABSend News:
AB[EMAIL PROTECTED]
AB
AB
AB-
ABBefore posting, please check:
AB   http://www.mysql.com/manual.php   (the manual)
AB   http://lists.mysql.com/   (the list archive)
AB
ABTo request this thread, e-mail [EMAIL PROTECTED]
ABTo unsubscribe, e-mail 
[EMAIL PROTECTED]
ABTrouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
AB

-- 

Love and you shall be loved by others


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging!

2002-03-01 Thread Alex Behrens

how do I fix it so mysql doesn't returns a 0? is my syntax wrong somewhere?

Thanks!

-Alex Big Al Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]
- Original Message -
From: Uma Shankari T. [EMAIL PROTECTED]
To: Alex Behrens [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 7:35 PM
Subject: Re: need help debugging!



 Hello Alex,


   If the mysql query returns 0 then it will display the message like this


 -Uma


 On Fri, 1 Mar 2002, Alex Behrens wrote:

 ABHey All,
 AB
 ABI am new to mysql and I need help debugging this peice of code for my
site:
 AB
 AB?php
 AB$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
 ABmysql_select_db(rahs,$db);
 AB$search = mysql_query(SELECT * FROM rahs);
 ABwhile($num=mysql_fetch_array($search)) {
 ABprintf (div align='center'centertable border='0' cellpadding='0'
 ABcellspacing='0' width=\40%\trtd
 ABwidth=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
 ABwidth=\30%\Team: %s/td/trtrtd width=\100%\
colspan='2'Penalty:
 AB%s/td/trtrtd width=\50%\Groundballs: %s/tdtd
 ABwidth=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
 ABWon:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
 ABwidth=\100%\ colspan='2'p

ABalign='center'Date:%s/td/tr/table/center/div,$num[name],$nu
m[

ABnumber],$num[team],$num[penalty],$num[groundballs],$num[shots],$
num
 AB[faceoffs_won],$num[faceoffs_lost],$num[date]);
 AB}
 AB?
 AB
 ABit says this error:
 ABWarning: Supplied argument is not a valid MySQL result resource on line
17
 ABline 17 would be this line:
 ABwhile($num=mysql_fetch_array($search)) {
 AB
 ABwhat is wrong with my code?
 AB
 AB
 ABThanks!
 AB
 AB-Alex Big Al Behrens
 ABE-mail: [EMAIL PROTECTED]
 ABUrgent E-mail: [EMAIL PROTECTED] (Please be brief!)
 ABPhone: 651-482-8779
 ABCell: 651-329-4187
 ABFax: 651-482-1391
 ABICQ: 3969599
 ABOwner of the 3D-Unlimited Network:
 ABhttp://www.3d-unlimited.com
 ABSend News:
 AB[EMAIL PROTECTED]
 AB
 AB
 AB-
 ABBefore posting, please check:
 AB   http://www.mysql.com/manual.php   (the manual)
 AB   http://lists.mysql.com/   (the list archive)
 AB
 ABTo request this thread, e-mail [EMAIL PROTECTED]
 ABTo unsubscribe, e-mail
[EMAIL PROTECTED]
 ABTrouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 AB

 --

 Love and you shall be loved by others




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging!

2002-03-01 Thread Uma Shankari T.


Hello Alex,


  Check it manually wheather ur query returns any row.


-Uma




On Fri, 1 Mar 2002, Alex Behrens wrote:

ABhow do I fix it so mysql doesn't returns a 0? is my syntax wrong somewhere?
AB
ABThanks!
AB
AB-Alex Big Al Behrens
ABE-mail: [EMAIL PROTECTED]
ABUrgent E-mail: [EMAIL PROTECTED] (Please be brief!)
ABPhone: 651-482-8779
ABCell: 651-329-4187
ABFax: 651-482-1391
ABICQ: 3969599
ABOwner of the 3D-Unlimited Network:
ABhttp://www.3d-unlimited.com
ABSend News:
AB[EMAIL PROTECTED]
AB- Original Message -
ABFrom: Uma Shankari T. [EMAIL PROTECTED]
ABTo: Alex Behrens [EMAIL PROTECTED]
ABCc: [EMAIL PROTECTED]
ABSent: Friday, March 01, 2002 7:35 PM
ABSubject: Re: need help debugging!
AB
AB
AB
AB Hello Alex,
AB
AB
AB   If the mysql query returns 0 then it will display the message like this
AB
AB
AB -Uma
AB
AB
AB On Fri, 1 Mar 2002, Alex Behrens wrote:
AB
AB ABHey All,
AB AB
AB ABI am new to mysql and I need help debugging this peice of code for my
ABsite:
AB AB
AB AB?php
AB AB$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
AB ABmysql_select_db(rahs,$db);
AB AB$search = mysql_query(SELECT * FROM rahs);
AB ABwhile($num=mysql_fetch_array($search)) {
AB ABprintf (div align='center'centertable border='0' cellpadding='0'
AB ABcellspacing='0' width=\40%\trtd
AB ABwidth=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
AB ABwidth=\30%\Team: %s/td/trtrtd width=\100%\
ABcolspan='2'Penalty:
AB AB%s/td/trtrtd width=\50%\Groundballs: %s/tdtd
AB ABwidth=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
AB ABWon:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
AB ABwidth=\100%\ colspan='2'p
AB
ABABalign='center'Date:%s/td/tr/table/center/div,$num[name],$nu
ABm[
AB
ABABnumber],$num[team],$num[penalty],$num[groundballs],$num[shots],$
ABnum
AB AB[faceoffs_won],$num[faceoffs_lost],$num[date]);
AB AB}
AB AB?
AB AB
AB ABit says this error:
AB ABWarning: Supplied argument is not a valid MySQL result resource on line
AB17
AB ABline 17 would be this line:
AB ABwhile($num=mysql_fetch_array($search)) {
AB AB
AB ABwhat is wrong with my code?
AB AB
AB AB
AB ABThanks!
AB AB
AB AB-Alex Big Al Behrens
AB ABE-mail: [EMAIL PROTECTED]
AB ABUrgent E-mail: [EMAIL PROTECTED] (Please be brief!)
AB ABPhone: 651-482-8779
AB ABCell: 651-329-4187
AB ABFax: 651-482-1391
AB ABICQ: 3969599
AB ABOwner of the 3D-Unlimited Network:
AB ABhttp://www.3d-unlimited.com
AB ABSend News:
AB AB[EMAIL PROTECTED]
AB AB
AB AB
AB AB-
AB ABBefore posting, please check:
AB AB   http://www.mysql.com/manual.php   (the manual)
AB AB   http://lists.mysql.com/   (the list archive)
AB AB
AB ABTo request this thread, e-mail [EMAIL PROTECTED]
AB ABTo unsubscribe, e-mail
AB[EMAIL PROTECTED]
AB ABTrouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
AB AB
AB
AB --
AB
AB Love and you shall be loved by others
AB
AB
AB
AB
AB-
ABBefore posting, please check:
AB   http://www.mysql.com/manual.php   (the manual)
AB   http://lists.mysql.com/   (the list archive)
AB
ABTo request this thread, e-mail [EMAIL PROTECTED]
ABTo unsubscribe, e-mail 
[EMAIL PROTECTED]
ABTrouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
AB

-- 

Love and you shall be loved by others


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging!

2002-03-01 Thread Alex Behrens

what do you mean by checking each query manually? how do I do this?

Thanks!

-Alex Big Al Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]
- Original Message -
From: Uma Shankari T. [EMAIL PROTECTED]
To: Alex Behrens [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 7:59 PM
Subject: Re: need help debugging!



 Hello Alex,


   Check it manually wheather ur query returns any row.


 -Uma




 On Fri, 1 Mar 2002, Alex Behrens wrote:

 ABhow do I fix it so mysql doesn't returns a 0? is my syntax wrong
somewhere?
 AB
 ABThanks!
 AB
 AB-Alex Big Al Behrens
 ABE-mail: [EMAIL PROTECTED]
 ABUrgent E-mail: [EMAIL PROTECTED] (Please be brief!)
 ABPhone: 651-482-8779
 ABCell: 651-329-4187
 ABFax: 651-482-1391
 ABICQ: 3969599
 ABOwner of the 3D-Unlimited Network:
 ABhttp://www.3d-unlimited.com
 ABSend News:
 AB[EMAIL PROTECTED]
 AB- Original Message -
 ABFrom: Uma Shankari T. [EMAIL PROTECTED]
 ABTo: Alex Behrens [EMAIL PROTECTED]
 ABCc: [EMAIL PROTECTED]
 ABSent: Friday, March 01, 2002 7:35 PM
 ABSubject: Re: need help debugging!
 AB
 AB
 AB
 AB Hello Alex,
 AB
 AB
 AB   If the mysql query returns 0 then it will display the message like
this
 AB
 AB
 AB -Uma
 AB
 AB
 AB On Fri, 1 Mar 2002, Alex Behrens wrote:
 AB
 AB ABHey All,
 AB AB
 AB ABI am new to mysql and I need help debugging this peice of code for
my
 ABsite:
 AB AB
 AB AB?php
 AB AB$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
 AB ABmysql_select_db(rahs,$db);
 AB AB$search = mysql_query(SELECT * FROM rahs);
 AB ABwhile($num=mysql_fetch_array($search)) {
 AB ABprintf (div align='center'centertable border='0'
cellpadding='0'
 AB ABcellspacing='0' width=\40%\trtd
 AB ABwidth=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
 AB ABwidth=\30%\Team: %s/td/trtrtd width=\100%\
 ABcolspan='2'Penalty:
 AB AB%s/td/trtrtd width=\50%\Groundballs: %s/tdtd
 AB ABwidth=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
 AB ABWon:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
 AB ABwidth=\100%\ colspan='2'p
 AB

ABABalign='center'Date:%s/td/tr/table/center/div,$num[name],
$nu
 ABm[
 AB

ABABnumber],$num[team],$num[penalty],$num[groundballs],$num[shots
],$
 ABnum
 AB AB[faceoffs_won],$num[faceoffs_lost],$num[date]);
 AB AB}
 AB AB?
 AB AB
 AB ABit says this error:
 AB ABWarning: Supplied argument is not a valid MySQL result resource on
line
 AB17
 AB ABline 17 would be this line:
 AB ABwhile($num=mysql_fetch_array($search)) {
 AB AB
 AB ABwhat is wrong with my code?
 AB AB
 AB AB
 AB ABThanks!
 AB AB
 AB AB-Alex Big Al Behrens
 AB ABE-mail: [EMAIL PROTECTED]
 AB ABUrgent E-mail: [EMAIL PROTECTED] (Please be brief!)
 AB ABPhone: 651-482-8779
 AB ABCell: 651-329-4187
 AB ABFax: 651-482-1391
 AB ABICQ: 3969599
 AB ABOwner of the 3D-Unlimited Network:
 AB ABhttp://www.3d-unlimited.com
 AB ABSend News:
 AB AB[EMAIL PROTECTED]
 AB AB
 AB AB
 AB
AB-
 AB ABBefore posting, please check:
 AB AB   http://www.mysql.com/manual.php   (the manual)
 AB AB   http://lists.mysql.com/   (the list archive)
 AB AB
 AB ABTo request this thread, e-mail
[EMAIL PROTECTED]
 AB ABTo unsubscribe, e-mail
 AB[EMAIL PROTECTED]
 AB ABTrouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
 AB AB
 AB
 AB --
 AB
 AB Love and you shall be loved by others
 AB
 AB
 AB
 AB
 AB-
 ABBefore posting, please check:
 AB   http://www.mysql.com/manual.php   (the manual)
 AB   http://lists.mysql.com/   (the list archive)
 AB
 ABTo request this thread, e-mail [EMAIL PROTECTED]
 ABTo unsubscribe, e-mail
[EMAIL PROTECTED]
 ABTrouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 AB

 --

 Love and you shall be loved by others




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging!

2002-03-01 Thread Michael Stassen


rahs is the name of your db and your table?

It's a good idea to check for errors as you go.  Try something like:

?php  
   
$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1) or
die(Couldn't connect: .mysql_error());
mysql_select_db(rahs,$db) or die(Couldn't select db: .mysql_error());
$search = mysql_query(SELECT * FROM rahs) or die(Query failed
:.mysql_error());
while($num=mysql_fetch_array($search)) { ...

Also, if that's your real user and password in the mysql_connect, you
should change it now, as this is an open list.

Michael

On Fri, 1 Mar 2002, Alex Behrens wrote:

 how do I fix it so mysql doesn't returns a 0? is my syntax wrong somewhere?
 
 Thanks!
 
 -Alex Big Al Behrens
 
 - Original Message -
 From: Uma Shankari T. [EMAIL PROTECTED]
 
  Hello Alex,
 
 
If the mysql query returns 0 then it will display the message like this
 
 
  -Uma
 
 
  On Fri, 1 Mar 2002, Alex Behrens wrote:
 
  ABHey All,
  AB
  ABI am new to mysql and I need help debugging this peice of code for my
 site:
  AB
  AB?php
  AB$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
  ABmysql_select_db(rahs,$db);
  AB$search = mysql_query(SELECT * FROM rahs);
  ABwhile($num=mysql_fetch_array($search)) {
  ABprintf (div align='center'centertable border='0' cellpadding='0'
  ABcellspacing='0' width=\40%\trtd
  ABwidth=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
  ABwidth=\30%\Team: %s/td/trtrtd width=\100%\
 colspan='2'Penalty:
  AB%s/td/trtrtd width=\50%\Groundballs: %s/tdtd
  ABwidth=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
  ABWon:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
  ABwidth=\100%\ colspan='2'p
 
 ABalign='center'Date:%s/td/tr/table/center/div,$num[name],$nu
 m[
 
 ABnumber],$num[team],$num[penalty],$num[groundballs],$num[shots],$
 num
  AB[faceoffs_won],$num[faceoffs_lost],$num[date]);
  AB}
  AB?
  AB
  ABit says this error:
  ABWarning: Supplied argument is not a valid MySQL result resource on line
 17
  ABline 17 would be this line:
  ABwhile($num=mysql_fetch_array($search)) {
  AB
  ABwhat is wrong with my code?
  AB
  AB
  ABThanks!

Michael Stassen
University Information Technology Services
Indiana University Bloomington
[EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging!

2002-03-01 Thread Jim Lucas [jimmysql]

Try adding this to your mysql_query() function.

$search = mysql_query()
or die(ERROR: . mysql_error() . ( . mysql_errno(). ));

this will tell you whether or not the query is dieing for one reason or
another.
if it doesn't return the die() statement then you must assume that it was
successfull.

the best way to catch whether or not the result pointer is empty, is to run
a mysql_num_rows() on the pointer.

this will return to you the total number of rows returned by the select
statement.

if you wrap your while clause with an if statement and have the condition be
whether or not the returned value of the mysql_num_rows() is greater then
zero. upon failing, returning zero results, it will never run the while
loop, therefor never give you the error that it's tring to use an invalid
result pointer.

So, try this

?php
$db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
$db = mysql_select_db(rahs,$db);
$search = mysql_query(SELECT * FROM rahs) or die(ERROR: . mysql_error()
. ( . mysql_errno(). ));
if(mysql_num_rows($search))
{
while($num = mysql_fetch_array($search))
{
echo div align='center'
table border='0' cellpadding='0'
cellspacing='0' width=\40%\ align='center'
tr
td width=\70%\Name: .$num[name].
nbsp;nbsp;nbsp;nbsp; #.$num[number]./td
td width=\30%\Team:
.$num[team]./td
/tr
tr
td width=\100%\
colspan='2'Penalty.$num[penalty]./td
/tr
tr
td width=\50%\Groundballs:
.$num[groundballs]./td
td width=\50%\Shots:
.$num[shots]./td
/tr
tr
td width=\50%\Faceoffs Won:
.$num[faceoffs_won]./td
td width=\50%\Faceoffs Lost:
.$num[faceoffs_lost]./td
/tr
tr
td width=\100%\ colspan='2'p
align='center'Date .$num[date]./p/td
/tr
/table
/div;
}
} else {
die(didn't find any results);
}

?
- Original Message -
From: Alex Behrens [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 5:25 PM
Subject: need help debugging!


 Hey All,

 I am new to mysql and I need help debugging this peice of code for my
site:

 ?php
 $db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
 mysql_select_db(rahs,$db);
 $search = mysql_query(SELECT * FROM rahs);
 while($num=mysql_fetch_array($search)) {
 printf (div align='center'centertable border='0' cellpadding='0'
 cellspacing='0' width=\40%\trtd
 width=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
 width=\30%\Team: %s/td/trtrtd width=\100%\
colspan='2'Penalty:
 %s/td/trtrtd width=\50%\Groundballs: %s/tdtd
 width=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
 Won:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
 width=\100%\ colspan='2'p

align='center'Date:%s/td/tr/table/center/div,$num[name],$num[

number],$num[team],$num[penalty],$num[groundballs],$num[shots],$num
 [faceoffs_won],$num[faceoffs_lost],$num[date]);
 }
 ?

 it says this error:
 Warning: Supplied argument is not a valid MySQL result resource on line 17
 line 17 would be this line:
 while($num=mysql_fetch_array($search)) {

 what is wrong with my code?


 Thanks!
 
 -Alex Big Al Behrens
 E-mail: [EMAIL PROTECTED]
 Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
 Phone: 651-482-8779
 Cell: 651-329-4187
 Fax: 651-482-1391
 ICQ: 3969599
 Owner of the 3D-Unlimited Network:
 http://www.3d-unlimited.com
 Send News:
 [EMAIL PROTECTED]


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: need help debugging! (more!)

2002-03-01 Thread Alex Behrens

Actually I figured out the problem my db name was wrong, however I am
getting a new code, here is my code now tho and the error (with the pass
this time!):

?php
$db = mysql_connect(db, ***, ***);
mysql_select_db(net3dual_lax,$db);
$search = mysql_query(SELECT * FROM rahs);
echo div align='center'centertable border='0' cellpadding='0'
cellspacing='0' width=\40%\\n;
while($num=mysql_fetch_array($search)) {
printf (trtd width=\70%\Name:%snbsp;nbsp;nbsp;nbsp;
Number:%s/tdtd width=\30%\Team: %s/td/trtrtd width=\100%\
colspan='2'Penalty: %s/td/trtrtd width=\50%\Groundballs:
%s/tdtd width=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
Won:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
width=\100%\ colspan='2'p
align='center'Date:%s/td/tr/table/center/div,$num[name],$num[
number],$num[team],$num[penalty],$num[groundballs],$num[shots],$num
[faceoffs_won],$num[faceoffs_lost],$num[date]);
}
?

it gives me this error:
  Warning: printf(): too few arguments

how do I fix this? I checked the number of %s and the number of $num
arguments and they shuld match. what am I doing wrong?

Thanks!

-Alex Big Al Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]
- Original Message -
From: Jim Lucas [jimmysql] [EMAIL PROTECTED]
To: Alex Behrens [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 10:19 PM
Subject: Re: need help debugging!


 Try adding this to your mysql_query() function.

 $search = mysql_query()
 or die(ERROR: . mysql_error() . ( . mysql_errno(). ));

 this will tell you whether or not the query is dieing for one reason or
 another.
 if it doesn't return the die() statement then you must assume that it was
 successfull.

 the best way to catch whether or not the result pointer is empty, is to
run
 a mysql_num_rows() on the pointer.

 this will return to you the total number of rows returned by the select
 statement.

 if you wrap your while clause with an if statement and have the condition
be
 whether or not the returned value of the mysql_num_rows() is greater then
 zero. upon failing, returning zero results, it will never run the while
 loop, therefor never give you the error that it's tring to use an invalid
 result pointer.

 So, try this

 ?php
 $db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
 $db = mysql_select_db(rahs,$db);
 $search = mysql_query(SELECT * FROM rahs) or die(ERROR: .
mysql_error()
 . ( . mysql_errno(). ));
 if(mysql_num_rows($search))
 {
 while($num = mysql_fetch_array($search))
 {
 echo div align='center'
 table border='0' cellpadding='0'
 cellspacing='0' width=\40%\ align='center'
 tr
 td width=\70%\Name:
.$num[name].
 nbsp;nbsp;nbsp;nbsp; #.$num[number]./td
 td width=\30%\Team:
 .$num[team]./td
 /tr
 tr
 td width=\100%\
 colspan='2'Penalty.$num[penalty]./td
 /tr
 tr
 td width=\50%\Groundballs:
 .$num[groundballs]./td
 td width=\50%\Shots:
 .$num[shots]./td
 /tr
 tr
 td width=\50%\Faceoffs Won:
 .$num[faceoffs_won]./td
 td width=\50%\Faceoffs Lost:
 .$num[faceoffs_lost]./td
 /tr
 tr
 td width=\100%\ colspan='2'p
 align='center'Date .$num[date]./p/td
 /tr
 /table
 /div;
 }
 } else {
 die(didn't find any results);
 }

 ?
 - Original Message -
 From: Alex Behrens [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, March 01, 2002 5:25 PM
 Subject: need help debugging!


  Hey All,
 
  I am new to mysql and I need help debugging this peice of code for my
 site:
 
  ?php
  $db = mysql_connect(db30.pair.com, net3dual, rosevilleX1);
  mysql_select_db(rahs,$db);
  $search = mysql_query(SELECT * FROM rahs);
  while($num=mysql_fetch_array($search)) {
  printf (div align='center'centertable border='0' cellpadding='0'
  cellspacing='0' width=\40%\trtd
  width=\70%\Name:%snbsp;nbsp;nbsp;nbsp; #%s/tdtd
  width=\30%\Team: %s/td/trtrtd width=\100%\
 colspan='2'Penalty:
  %s/td/trtrtd width=\50%\Groundballs: %s/tdtd
  width=\50%\Shots: %s/td/trtrtd width=\50%\Faceoffs
  Won:%s/tdtd width=\50%\Faceoffs Lost: %s/td/trtrtd
  width=\100%\ colspan='2'p
 

align='center'Date:%s/td/tr/table/center/div,$num[name],$num[
 

number

Need help debugging 3.23.32 crashing

2001-02-04 Thread Brad Fitzpatrick

MySQL 3.23.32 has been crashing on me quite frequently, as well as the past
several versions.  At first I gave MySQL the benefit of the doubt and blamed
it on the compilation.  I've since tried 6 different builds, ranging from
fully optimized with no debugging to bloated and slow, with full debugging.
Each one of the crashes.

I know the table that is causing MySQL to segfault, but I can't reproduce
yet the sequence of queries that caues it to happen.

What I really need help with is instructions on how to make mysqld write its
core file after it crashes.  I have "core" on its own line in /etc/my.cnf,
in the [mysqld] section.  Is that enough?  Obviously not.  I'm new to using
the my.cnf  the parsing of that file seems somewhat odd.

If that is what I'm supposed to do, where are the core files supposed to go?

Also, the error doesn't show me a stack trace, but instead says:

  Bogus stack limit or frame pointer, aborting backtrace.

Then, mysqld restarts and I see a bunch of lines like:

  read_const: Got error 126 when reading table ./livejournal/dirsearchres

I've pretty much figured out that MySQL crashes after I do a "DELETE FROM
dirsearchres".  That table is constantly growing up to a million rows or so,
and then a cron job deletes everything in them.  (Why this is necessary is
another discussion in itself)

MySQL developers --- maybe that means something to you.  The schema is:

CREATE TABLE dirsearchres (
dsid INT UNSIGNED NOT NULL,
userid INT UNSIGNED NOT NULL,
KEY (dsid) --- really an INDEX, not a key
);

The this table grows a ton, then rapidly shrinks.

Maybe TRUNCATE dirsearchres would work better than DELETE FROM dirsearchres.

But regardless, MySQL is crashing and should be fixed.  I don't want to find
a workaround.

Any suggestions?

- Brad



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php