Warning: Supplied argument is not a valid MySQL result resource in

From: Date: Tue, 13 May 2003 14:09:38 +0000
Subject: Warning: Supplied argument is not a valid MySQL result resource in
Groups: php.general 
Request: Send a blank email to php-general+get-147436@lists.php.net to get a copy of this message
does anyone know why i am getting this error? Warning: Supplied argument is not a valid MySQL result resource in the code is given below <?php if($Submit){ if($catname){ $link_identifier = mysql_connect("localhost", "user", "******"); mysql_select_db("sacc_directory", $link_identifier); $sql1 = "SELECT id FROM category WHERE catname=='$catname'"; $result1 = mysql_query($sql1,$link_identifier); $num_row = mysql_num_rows($result1); if($num_row < 0){ $sql = "INSERT INTO category (catname) VALUES ('$catname')"; $result = mysql_query($sql,$link_identifier); if($result){ echo "category $catname has been added successfully"; } else{ echo "Problem adding new category"; } }else{ echo "Category $catname already exist"; } // close if num rows } else { echo "Category name is blank, please go back and type category name"; } // close if catname } ?> <FORM name="form" method="post" action=""> <TABLE width="400" border="0" cellspacing="0" cellpadding="2"> <TR bgcolor="#8C8CCD"> <TD colspan="2">&nbsp;</TD> </TR> <TR bgcolor="#F4F4FB"> <TD width="109" class="txtNormal">Category Name:</TD> <TD width="291"> <INPUT type="text" name="catname" size="35"> </TD> </TR> <TR bgcolor="#F4F4FB"> <TD width="109">&nbsp;</TD> <TD width="291"> <INPUT type="submit" name="Submit" value="Add New Category"> </TD> </TR> </TABLE> </FORM>

« previous php.general (#147436) next »