Re: [PHP] MySQL PHP database script PLEASE

2004-10-21 Thread Ramil Sagum
   td? echo $row[end]; ?/td
   tdA HREF=/momatlib/gendai/pdf/? echo $row[GO]; ?.pdfpdf/A/td
  /tr

replace the  above block with

td? echo $row[end]; ?/td
td
?php   if($row[GO] = 1000) {  ?
  A HREF=/momatlib/gendai/pdf/? echo $row[GO]; ?.pdfpdf/A
?php   }?
/td
/tr


ganbatte!



ramil
http://ramil.sagum.net

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



Re: [PHP] MySQL PHP database script PLEASE

2004-10-21 Thread Matthew Sims
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.
  tdA HREF=/momatlib/gendai/pdf/? echo $row[GO];
 ?.pdfpdf/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

 TITLEgen_search1.php/TITLE
 BODY TEXT=#00 LINK=#FF VLINK=#008040 ALINK=#FF00FF
 BASEFONT SIZE=3

 table border=1 align=center BGCOLOR=#F2FEE0
 tr
 td align=centerID/td
 td align=centerVolume/td
 td align=centerDate/td
 td align=centerTitle/td
 td align=centerAuthor/td
 td align=centerPage/td
 td align=centerPage/td
 td align=centerImage/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 Availablep;

// %row is just a straight variable so you can include it in the string

echo $rows Records Availablep;


   while($row = mysql_fetch_array($result)){
   ?
   tr
   td align =rightA HREF = gen_detail.php ?id=? echo $row[ID]
 ??
 echo $row[ID]; /A/td
   td align =rightA 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
   tdA HREF=/momatlib/gendai/pdf/? echo $row[GO];
 ?.pdfpdf/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