<snip>
>
> <I NEED THIS>
> When GO =< 1000 ), the links to PDF file are shown,
> and when GO > 1000, the links to PDF file are not shown (just brank
> cells).
>
> So probably I need to change this part.
> <td><A HREF="/momatlib/gendai/pdf/<? echo $row["GO"];
> ?>.pdf">pdf</A></td>
> But dont know how to do it.
>
> Please help me anybody, thank you!!
My syntax may look different but it's basically the same thing.
>
>
> Here is a complete PHP (simplified version) Im using.
> ------------------------------------------
> <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);
// I hope that's not your real passwd that you just posted. :)
> mysql_select_db(gendai);
> if($go == "" &&
> $dt == "" &&
> $ti == "" &&
> $au == "" &&
> $ay == "")
> {
> echo 'Please type something';
> }
/*
>From the looks of the code below, these ought to be $_GET vars? Where are
they coming from? When passing variables through the URL they should be
called through the $_GET array. Variables passed through headers are
called through the $_POST vars. I'll use $_GET as I'm simpy guessing.
This also might mean that you have register_globals on in php.ini? You
should turn it off and train to use the $_GET and $_POST.
http://us2.php.net/manual/en/language.variables.external.php
http://us2.php.net/manual/en/security.registerglobals.php
*/
if (empty($_GET["go"]) &
empty($_GET["dt"]) &
empty($_GET["ti"]) &
empty($_GET["au"]) &
empty($_GET["ay"])) {
echo "Please type something";
>
> elseif($go == "%" || $dt == "%" || $ti == "%" || $au == "%" || $ay ==
> "%"){
> echo 'Not Valid';
> }
} elseif ($_GET["go"] == "%" |
$_GET["dt"] == "%" |
$_GET["ti"] == "%" |
$_GET["au"] == "%" |
$_GET["ay"] == "%") {
echo "Not Valid";
>
> else{
> if($go == ""){
> $go = '%';
> }
> if($dt == ""){
> $dt = '%';
> }
> if($ti == ""){
> $ti = '%';
> }
> if($au == ""){
> $au = '%';
> }
> if($ay == ""){
> $ay = '%';
> }
// For this part we can make it a little easier using a foreach loop.
} else {
foreach ($_GET as $value) {
if (empty($value)) $value = "%";
}
/*
The foreach loop will cycle through each of the values in the $_GET array
and assign it a "%" if it's empty
*/
> $result = mysql_query("select * from gen_table
> where GO like '%$go%'
> and ym like '%$dt%'
> and Tit like '%$ti%'
> and Aut like '%$au%'
> and Auty like '%$ay%'");
// What I think you're doing is using the $_GET array to query your DB?
$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"].'");
/*
Because $_GET is an array you need to concatenate them into the string.
Check out complex (curly) syntax:
http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex
*/
> $rows = mysql_num_rows($result);
> echo $rows,"Records Available<p>";
// %row is just a straight variable so you can include it in the string
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><A HREF="/momatlib/gendai/pdf/<? echo $row["GO"];
> ?>.pdf">pdf</A></td>
Were the above $row["ID"] and $row["GO"] missing the semi-colon a typo?
> </tr>
> <?
> }
>
> }
> ?>
> </table>
> </body>
> </html>
> ------------------------------------------------------
>
Not sure if I missed anything?
--
--Matthew Sims
--<http://killermookie.org>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php