"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:
> >
> > AB>Hey All,
> > AB>
> > AB>I 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");
> > AB>mysql_select_db("rahs",$db);
> > AB>$search = mysql_query("SELECT * FROM rahs");
> > AB>while($num=mysql_fetch_array($search)) {
> > AB>printf ("<div align='center'><center><table border='0' cellpadding='0'
> > AB>cellspacing='0' width=\"40%\"><tr><td
> > AB>width=\"70%\">Name:%s&nbsp;&nbsp;&nbsp;&nbsp; #%s</td><td
> > AB>width=\"30%\">Team: %s</td></tr><tr><td width=\"100%\"
> colspan='2'>Penalty:
> > AB>%s</td></tr><tr><td width=\"50%\">Groundballs: %s</td><td
> > AB>width=\"50%\">Shots: %s</td></tr><tr><td width=\"50%\">Faceoffs
> > AB>Won:%s</td><td width=\"50%\">Faceoffs Lost: %s</td></tr><tr><td
> > AB>width=\"100%\" colspan='2'><p
> >
> AB>align='center'>Date:%s</td></tr></table></center></div>",$num["name"],$nu
> m["
> >
> AB>number"],$num["team"],$num["penalty"],$num["groundballs"],$num["shots"],$
> num
> > AB>["faceoffs_won"],$num["faceoffs_lost"],$num["date"]);
> > AB>}
> > AB>?>
> > AB>
> > AB>it says this error:
> > AB>Warning: Supplied argument is not a valid MySQL result resource on line
> 17
> > AB>line 17 would be this line:
> > AB>while($num=mysql_fetch_array($search)) {
> > AB>
> > AB>what is wrong with my code?
> > AB>
> > AB>
> > AB>Thanks!

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

Reply via email to