I have a strange, but probably easy to fix problem. I need to check to see
if something is in a table...that part is easy, but if the table is empty,
it doesn't go through my "while" statement so that I can create something
in it. I am sure that if there was something in the table, that I would
not be having this problem. Below is my code.
-----------
$searchStmt = "SELECT * from division1rank";
$stmt= substr($searchStmt, 0, strlen($searchStmt)) ;
// Connect to the Database
if (!($link=mysql_pconnect($hostName, $userName, $password))) {
DisplayErrMsg(sprintf("error connecting to host %s, by user %s",
$hostName, $userName)) ;
exit() ;
}
// Select the Database
if (!mysql_select_db($databaseName, $link)) {
DisplayErrMsg(sprintf("Error in selecting %s database", $databaseName)) ;
DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link),
mysql_error($link))) ;
exit() ;
}
// Execute the Statement
if (!($result =mysql_query($stmt, $link))) {
DisplayErrMsg(sprintf("Error in executing %s stmt", $stmt)) ;
DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link),
mysql_error($link))) ;
exit() ;
}
while (($row = mysql_fetch_object($result))){
if($row->team_id == "$team_id"){
echo "It is in there";
}else{
echo "We will need to add it to the table";
}
}
}
---------------------------------------------------------------------
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