MySQL & PHP database script PLEASE

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

 



Hi Im Sugimoto.

I have a problem with PHP (4.3.1) and MySQL database (3.23).
Im creating a very simple library database (just type keywords of a book and
show the result),
 but it doesnt work in a way I want. Basically what I would like to do is to
show/not-show the hyperlinks to particular PDF files when the result is
different.
Probably for most of you, it is bloody easy thing, but Ive just started PHP
and dont know the commands.
Could somebody have a look at the following PHP and tell me how to do it,
please? (See script at the bottom)

<Basic info>
"ID" is a primary key of MySQL (="id" in PHP/HTML)
"GO" is the volume of a book, the name of a column in MySQL (="go" in
PHP/HTML)

<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!!


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);
mysql_select_db(gendai);
if($go == "" &&
   $dt == "" &&
   $ti == "" &&
   $au == "" &&
   $ay == "")
{
 echo 'Please type something';
}

elseif($go == "%" || $dt == "%" || $ti == "%" || $au == "%" || $ay == "%"){
 echo 'Not Valid';
}

else{
 if($go == ""){
    $go = '%';
 }
 if($dt == ""){
    $dt = '%';
 }
 if($ti == ""){
    $ti = '%';
 }
 if($au == ""){
   $au = '%';
 }
 if($ay == ""){
   $ay = '%';
 }
$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%'");
 $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><A HREF="/momatlib/gendai/pdf/<? echo $row["GO"]; ?>.pdf">pdf</A></td>
 </tr>
  <?
   }

}
?>
</table>
</body>
</html>
------------------------------------------------------

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


[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