hello plz i need help with this urgently as it i supposed to be used tomorrow :S
i get this error from the following script
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/aybasuco/public_html/MySQL-Formmaker/lib/db_index.inc.php on line 42
thanks in advance for your valiable time
<?php
# MySQL-Formmaker 2002 by Kristof De Jaeger
# swentel@realize.be
# index page displaying databases.
$error = "";
$dbname = "";
$description = "";
/*
POST checking from new db insert if $_POST is set, otherwhise just form
if everything is ok, redirect to table overview (which will be empty)
otherwise, display errors etc
*/
if (isset($_POST["dbsubmit"]))
{
$dbname = trim($_POST["newdbname"]);
if (empty($dbname)) $error .= translate("error1")."<br />";
if (eregi("[^[:alpha:]_]+",$dbname)) $error .= translate("error3")."<br />";
if (strlen($dbname) > 64) $error .= translate("error2")."<br />";
$found = in_array_cin($dbname);
if ($found == 1) $error .= translate("error5")."<br />";
$query = "select db_name from formmaker_db where db_name = '".mq_add($dbname)."'";
$result = mysql_query($query);
$row = mysql_fetch_object($result);
if ($row) $error .= translate("error4")."<br />";
$description = $_POST["description"];
/* no errors -> insert & redirect to table index */
if ($error == false)
{
$query = "insert into formmaker_db values ('','$dbname','".nl2br(mq_add($_POST['description']))."','0')";
mysql_query($query);
$dbid = mysql_insert_id();
header("location: index.php?formaction=table_index&dbid=$dbid");
}
}
include("header.inc.php");
/* display existing databases */
$query = "select db_id,db_name,db_description from formmaker_db order by db_name ASC";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
if ($rows > 0)
{
echo '<span class="titles">'.
translate("listofdbs").'</span><br /><br />
<table border="0" cellpadding="4" cellspacing="0">
<tr><td class="toprow">'.translate("name").'</td><td class="toprow">'.translate("description").'</td>
<td class="toprow">'.translate("update").'</td><td class="toprow">'.translate("delete").'</td></tr>';
$foo = '';
while ($row = mysql_fetch_object($result))
{
echo '
<tr>
<td valign="top" class="list">'.mq_out($row->db_name).'</td>
<td valign="top" class="list">'.mq_out($row->db_description).'</td>
<td valign="top" class="list"><a href="index.php?formaction=table_index&dbid='.$row->db_id.'">'.translate("details").'</a></td>
<td valign="top" class="list"><a onclick="return confirmdelete(\''.translate("deleteq1").'\')" href="index.php?formaction=db_del&dbid='.$row->db_id.'">'.translate("delete").'</a></td>
</tr>';
}
echo '</table>';
}
else echo '<b>'.translate("nodbsyet").'</b>';
echo '<br /><br />';
# form form for creating new database
echo '<span class="titles">'.
translate("createnewdb").'</span>
<form action="index.php" method="post">';
if (!empty($error)) echo '<span class="error">'.$error.'</span>';
echo '<p>'.translate("name").' : <br /><input type="text" value="'.mq_out($dbname,1).'" name="newdbname"></input><br />
* '.translate("help1").' * '.translate("dbeventcreate").'</p>
<p>'.translate("description").' : <br /><textarea cols="50" rows="5" name="description">'.mq_out($description,1).'</textarea></p>
<p><input type="submit" name="dbsubmit" value="'.translate("submitnewdb").'"></input></p>
</form>';
include("footer.inc.php");
?>