Re: Thanks but problem Again! (MySQL & PHP database script PLEASE)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Its been awhile since I did any PHP but I would look at if you need to excape some of those double quote or encapsulate your sql in a single quote.

Sugimoto <sugimoto@xxxxxxxxxxx> wrote: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

------------------------------------------------------










ID
Volume
Date
Title
Author
Page
Page
Image


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
";

while($row = mysql_fetch_array($result)){
?>


?>">
?>">







.pdf">pdf



}

}
?>




----------------------------------------------------------

HTML file here










Search FieldsInput Valuealign="center">tips
ID [input] maxlength= "10">

Volume [input] "10" maxlength= "10">

Date [input] maxlength= "10">

Title [input] maxlength="60">

Author [input] maxlength="60">

Yomi [input] maxlength="60">

Search Another
Way








 [input] 
 [input] 






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"

		
---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux