[PHP] One more time (Duft Punk) about hyperlink

2005-04-20 Thread Sugimoto
Thank you very much, I do appreciate your help.

Ur script doens work, but, curiously, it works when I changed a bit...
   select left(loc1,3) as locx, openart_id, tit1, pub1, id1, ref1 from
openart_table

If possible, can I ask one more thing?
This part is the problem
   A HREF="/momatlib/image/? echo $row["locx"]; ?.jpg"? echo
$row["locx"]; ?/A

I got 3 letters, but I would like to show all "loc1" data (eg "1-2 near
entrance") in the table, and have first 3 letters of "loc1" for jpg
hyperlink (http://www.heyjude.com/image/1-2.jpg).

Do you know how to fix this?

script--
$result = mysql_query("select left(loc1,3) as locx, openart_id, tit1, pub1,
id1, ref1 from openart_table
 where tit1   like '%$tit%'
   and res1   like '%$res%'
   and pub1  like '%$pub%'
   and date1  like '%$date%'
   and id1   like '%$id%'
   and ref1  like '%$ref%'
   and loc1  like '%$loc%'
   and type1   like '%$type%'
   and vol1  like '%$vol%'
   and fre1  like '%$fre%'
   and note1   like '%$note%' order by tit1");

$rows = mysql_num_rows($result);
 echo $rows,"Record Found p";
 while($row = mysql_fetch_array($result)){
 ?
  tr
  tda href = "openart_detail.php ?iden=? echo $row["openart_id"] ?"?
echo $row["openart_id"]; ?/abr/td
  td? echo $row["tit1"]; ?br/td
  td? echo $row["pub1"]; ?br/td
  td? echo $row["id1"]; ?br/td
  td? echo $row["ref1"]; ?br/td
  td
  A HREF="/momatlib/image/? echo $row["locx"]; ?.jpg"? echo
$row["locx"]; ?
  /Abr
  /td
  /tr

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

[PHP] PHP script problem (with MySQL)

2005-04-19 Thread Sugimoto
Hello,
I need your help about PHP (ver 4.3.1) and MySQL (ver 3.23) database.
I am struggling to customise a database (using left command etc), and am
stuck now.
Please have a brief look at my scripts below.

What I do like to do is to get first 3 letters from "loc1" column from
openart_table (MySQL).
And show the data in the follwoing part...
  td? echo $row["loc1"]; ?br/td

but also I would like to make hyperlinks to jpg files to images/"the first 3
letters from loc1".jpg
So it will be something like this...
  td
  a href="/image/? echo $row["loc1"]; ?.jpg"? echo $row["loc1"];
?/abr
  /td

But when I tried, "select left (loc1,3) from openart_table where.."
doesnt work properly.
I do not want to destroy anything for the rest of the table.
I need all data from "tit1", "pub1", "id1", and "ref1" in each column.

Could you show me a script example?
Could you help me, please? Thank you.

-PHP script from here
html
body
table border="1" bordercolor="black" cellspacing="0" align="center"
BGCOLOR="#CC" width="900"
tr bgcolor="#ffcc66"
td align="center"bID No/bbr/td
td align="center" BGCOLOR="#CC3366"bBook Title/bbr/td
td align="center"bPublisher/bbr/td
td align="center"bID/bbr/td
td align="center"bReference/bbr/td
td align="center" width="10%"bLocation/bbr/td
/tr

?
mysql_connect(localhost,root,cheers);
mysql_select_db(openart);
if($tit == "" 
   $res == "" 
   $pub == "" 
   $date == "" 
   $id == "" 
   $ref == "" 
   $loc == "" 
   $type == "" 
   $vol == "" 
   $fre == "" 
   $note == "")
{
 echo 'Type something';
}

elseif($tit == "%" || $res == "%" || $pub == "%" || $date == "%" || $id ==
"%" ||
   $ref == "%" || $loc == "%" || $type == "%" || $vol == "%" || $fre ==
"%" || $note == "%"){
 echo 'Not Valid';
}

else{
 if($tit == ""){
$tit = '%';
 }
 if($res == ""){
$res = '%';
 }
 if($pub == ""){
$pub = '%';
 }
 if($date == ""){
   $date = '%';
 }
 if($id == ""){
   $id = '%';
 }
 if($ref == ""){
$ref = '%';
 }
 if($loc == ""){
$loc = '%';
 }
 if($type == ""){
$type = '%';
 }
 if($vol == ""){
$vol = '%';
 }
 if($fre == ""){
$fre = '%';
 }
 if($note == ""){
$note = '%';
 }
$result = mysql_query("select * from openart_table
 where tit1   like '%$tit%'
   and res1   like '%$res%'
   and pub1  like '%$pub%'
   and date1  like '%$date%'
   and id1   like '%$id%'
   and ref1  like '%$ref%'
   and loc1  like '%$loc%'
   and type1   like '%$type%'
   and vol1  like '%$vol%'
   and fre1  like '%$fre%'
   and note1   like '%$note%' order by tit1");

$rows = mysql_num_rows($result);
 echo $rows,"Records Found p";
 while($row = mysql_fetch_array($result)){
  ?
  tr
  tda href = "openart_detail.php ?iden=? echo $row["openart_id"] ?"?
echo $row["openart_id"]; ?/abr/td
  td? echo $row["tit1"]; ?br/td
  td? echo $row["pub1"]; ?br/td
  td? echo $row["id1"]; ?br/td
  td? echo $row["ref1"]; ?br/td
  td? echo $row["loc1"]; ?br/td
  /tr
  ?
   }
}
?
/table
/body
/html

end of script

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

[PHP] Thanks but problem again! Re: [PHP] PHP script problem (with MySQL)

2005-04-19 Thread Sugimoto
Thank you, Richard,

I simply change this part
(select * from openart_table) into
(select substring(loc1, 1, 3) as THREE_LETTER_CODE, * from openart_table)
but Ive got this error, whats wrong with it?

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in c:\apache..\openart\test\openart_search.php on line 98
Records Found

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in c:\apache\openart\test\openart_search.php on line 100

Cheers

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