Hello,
(BI need your help about PHP (ver 4.3.1) and MySQL (ver 3.23) database.
(BI am struggling to customise a database (using left command etc), and am
(Bstuck now.
(BPlease have a brief look at my scripts below.
(B
(BWhat I do like to do is to get first 3 letters from "loc1" column from
(Bopenart_table (MySQL).
(BAnd show the data in the follwoing part...
(B <td><? echo $row["loc1"]; ?><br></td>
(B
(Bbut also I would like to make hyperlinks to jpg files to images/"the first 3
(Bletters from loc1".jpg
(BSo it will be something like this...
(B <td>
(B <a href="/image/<? echo $row["loc1"]; ?>.jpg"><? echo $row["loc1"];
(B?></a><br>
(B </td>
(B
(BBut when I tried, "select left (loc1,3) from openart_table where......"
(Bdoesnt work properly.
(BI do not want to destroy anything for the rest of the table.
(BI need all data from "tit1", "pub1", "id1", and "ref1" in each column.
(B
(BCould you help me, please?
(B
(B---------------------------------------------PHP script from here
(B<html>
(B<body>
(B<table border="1" bordercolor="black" cellspacing="0" align="center"
(BBGCOLOR="#CCFFFF" width="900">
(B<tr bgcolor="#ffcc66">
(B<td align="center"><b>ID No</b><br></td>
(B<td align="center" BGCOLOR="#CC3366"><b>Book Title</b><br></td>
(B<td align="center"><b>Publisher</b><br></td>
(B<td align="center"><b>ID</b><br></td>
(B<td align="center"><b>Reference</b><br></td>
(B<td align="center" width="10%"><b>Location</b><br></td>
(B</tr>
(B
(B<?
(Bmysql_connect(localhost,root,cheers);
(Bmysql_select_db(openart);
(Bif($tit == "" &&
(B $res == "" &&
(B $pub == "" &&
(B $date == "" &&
(B $id == "" &&
(B $ref == "" &&
(B $loc == "" &&
(B $type == "" &&
(B $vol == "" &&
(B $fre == "" &&
(B $note == "")
(B{
(B echo 'Type something';
(B}
(B
(Belseif($tit == "%" || $res == "%" || $pub == "%" || $date == "%" || $id ==
(B"%" ||
(B $ref == "%" || $loc == "%" || $type == "%" || $vol == "%" || $fre ==
(B"%" || $note == "%"){
(B echo 'Not Valid';
(B}
(B
(Belse{
(B if($tit == ""){
(B $tit = '%';
(B }
(B if($res == ""){
(B $res = '%';
(B }
(B if($pub == ""){
(B $pub = '%';
(B }
(B if($date == ""){
(B $date = '%';
(B }
(B if($id == ""){
(B $id = '%';
(B }
(B if($ref == ""){
(B $ref = '%';
(B }
(B if($loc == ""){
(B $loc = '%';
(B }
(B if($type == ""){
(B $type = '%';
(B }
(B if($vol == ""){
(B $vol = '%';
(B }
(B if($fre == ""){
(B $fre = '%';
(B }
(B if($note == ""){
(B $note = '%';
(B }
(B$result = mysql_query("select * from openart_table
(B where tit1 like '%$tit%'
(B and res1 like '%$res%'
(B and pub1 like '%$pub%'
(B and date1 like '%$date%'
(B and id1 like '%$id%'
(B and ref1 like '%$ref%'
(B and loc1 like '%$loc%'
(B and type1 like '%$type%'
(B and vol1 like '%$vol%'
(B and fre1 like '%$fre%'
(B and note1 like '%$note%' order by tit1");
(B
(B$rows = mysql_num_rows($result);
(B echo $rows,"Records Found <p>";
(B while($row = mysql_fetch_array($result)){
(B ?>
(B <tr>
(B <td><a href = "openart_detail.php ?iden=<? echo $row["openart_id"] ?>"><?
(Becho $row["openart_id"]; ?></a><br></td>
(B <td><? echo $row["tit1"]; ?><br></td>
(B <td><? echo $row["pub1"]; ?><br></td>
(B <td><? echo $row["id1"]; ?><br></td>
(B <td><? echo $row["ref1"]; ?><br></td>
(B <td><? echo $row["loc1"]; ?><br></td>
(B </tr>
(B <?
(B }
(B}
(B?>
(B</table>
(B</body>
(B</html>
(B
(B----------------------------------------------------end of script
(B
(B--
(BPHP Database Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php