Thanks but problem Again! (MySQL & PHP database script PLEASE)
| From: | Sugimoto | Date: | Fri, 22 Oct 2004 07:13:07 +0000 |
| Subject: | Thanks but problem Again! (MySQL & PHP database script PLEASE) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-200063@lists.php.net to get a copy of this message | ||
Thank you for two of you. Im amazed how quick the replys were. Very pleased.
When I simply inserted the PHP sentense, it worked.
But as I turned off register_globals,
and changed as Matthew suggested, it looked like this:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in c:\apache\htdocs\momatlib\gen_search1.php on line 49
Records Available
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in c:\apache\htdocs\momatlib\gen_search1.php on line 52
BTW
When I added this (or die("Bad query: ".mysql_error()); ) in this part
($result = mysql_query...)
Ive got this.
Bad query: You have an error in your SQL syntax near 'and Tit like and Aut
like and Auty like ' at line 4
Oh NO! Whats wrong with the script??
Any mistype or anything else? Or am I just stupid?
Arigato thank you.
Sugimoto
------------------------------------------------------
<html>
<body>
<TITLE>gen_search1.php</TITLE>
<BODY TEXT="#000000" LINK="#0000FF" VLINK="#008040"
ALINK="#FF00FF">
<BASEFONT SIZE="3">
<table border="1" align="center" BGCOLOR="#F2FEE0">
<tr>
<td align="center">ID</td>
<td align="center">Volume</td>
<td align="center">Date</td>
<td align="center">Title</td>
<td align="center">Author</td>
<td align="center">Page</td>
<td align="center">Page</td>
<td align="center">Image</td>
</tr>
<?
mysql_connect(localhost,root,love);
mysql_select_db(gendai);
if (empty($_GET["go"]) &
empty($_GET["dt"]) &
empty($_GET["ti"]) &
empty($_GET["au"]) &
empty($_GET["ay"])) {
echo 'Please type something';
}
elseif ($_GET["go"] == "%" |
$_GET["dt"] == "%" |
$_GET["ti"] == "%" |
$_GET["au"] == "%" |
$_GET["ay"] == "%") {
echo 'Not Valid';
}
else {
foreach ($_GET as $value) {
if (empty($value)) $value = "%";
}
$result = mysql_query("select * from gen_table
where GO like ".$_GET["go"]."
and ym like ".$_GET["dt"]."
and Tit like ".$_GET["ti"]."
and Aut like ".$_GET["au"]."
and Auty like ".$_GET["ay"]."");
$rows = mysql_num_rows($result);
echo "$rows Records Available<p>";
while($row = mysql_fetch_array($result)){
?>
<tr>
<td align ="right"><A HREF = "gen_detail.php ?id=<? echo
$row["ID"];
?>"><? echo $row["ID"]; ?></A></td>
<td align ="right"><A HREF = "gen_search1.php ?go=<? echo
$row["GO"];
?>"><? echo $row["GO"]; ?></A></td>
<td><? echo $row["ym"]; ?></td>
<td width="400"><? echo $row["Tit"]; ?></td>
<td width="200"><? echo $row["Aut"]; ?></td>
<td><? echo $row["sta"]; ?></td>
<td><? echo $row["end"]; ?></td>
<td>
<?php if($row["GO"] <= 1000) { ?>
<A HREF="/momatlib/gendai/pdf/<? echo $row["GO"];
?>.pdf">pdf</A>
<?php } ?>
</td>
</tr>
<?
}
}
?>
</table>
</body>
</html>
----------------------------------------------------------
HTML file here
<html>
<body>
<TITLE>gen_menu.html</TITLE>
<BODY TEXT="#000000" LINK="#0000FF" VLINK="#008040"
ALINK="#FF00FF">
<BASEFONT SIZE="3">
<form action="gen_search1.php" method="get">
<table border="1" align="center" BGCOLOR="#F2FEE0">
<tr><td> Search Fields</td><td align="center">Input
Value</td><td
align="center">tips</td></tr>
<tr><td align="center">ID</td><td><input type="text"
name="id" size= "10"
maxlength= "10"></td><td></td></tr><p>
<tr><td align="center">Volume</td><td><input
type="text" name="go" size=
"10" maxlength= "10"></td><td></td></tr><p>
<tr><td align="center">Date</td><td><input
type="text" name="dt" size= "10"
maxlength= "10"></td><td></td></tr><p>
<tr><td align="center">Title</td><td><input
type="text" name="ti" size="60"
maxlength="60"></td><td></td></tr><p>
<tr><td align="center">Author</td><td><input
type="text" name="au" size="60"
maxlength="60"></td><td></td></tr><p>
<tr><td align="center">Yomi</td><td><input
type="text" name="ay" size="60"
maxlength="60"></td><td></td></tr><p>
<tr><td></td><td align="center"><a
href="/momatlib/gen50.php">Search Another
Way</a></td><p>
</table><p>
<p align="center">
<input type="submit" value="Search">
<input type="reset" value="Clear" ></P>
</form>
</body>
</html>