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'><center><table border='0' cellpadding='0' cellspacing='0' width=\"40%\">\n"; while($num=mysql_fetch_array($search)) { printf ("<tr><td width=\"70%\">Name:%s Number:%s</td><td width=\"30%\">Team: %s</td></tr><tr><td width=\"100%\" colspan='2'>Penalty: %s</td></tr><tr><td width=\"50%\">Groundballs: %s</td><td width=\"50%\">Shots: %s</td></tr><tr><td width=\"50%\">Faceoffs Won:%s</td><td width=\"50%\">Faceoffs Lost: %s</td></tr><tr><td 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"]. > " #".$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'><center><table border='0' cellpadding='0' > > cellspacing='0' width=\"40%\"><tr><td > > width=\"70%\">Name:%s #%s</td><td > > width=\"30%\">Team: %s</td></tr><tr><td width=\"100%\" > colspan='2'>Penalty: > > %s</td></tr><tr><td width=\"50%\">Groundballs: %s</td><td > > width=\"50%\">Shots: %s</td></tr><tr><td width=\"50%\">Faceoffs > > Won:%s</td><td width=\"50%\">Faceoffs Lost: %s</td></tr><tr><td > > 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 > > --------------------------------------------------------------------- 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