Page 1 of 1

can i show id by this?

Posted: Sun Dec 06, 2009 10:25 am
by LikPan
hello, i come from hong kong , so my english is not good, so sorry for that :oops:
but i need the help! :(
my boss need me do some php thing(i just graphic designer)
i just know very simple php code...


-----------------------------
I have some data in mysql
and every date have a column is "vipcheck"
if vipcheck == 1 is vip
if vipcheck == 0 is not vip

and my boss need i do something like the attachment
id=1 maybe is not id[1] , just if is vip must put in id=1
id=2 - id=7 just put not vip data

and then i maybe have page 2,3,4....so and so.
but the problem is maybe i do not have the many data , maybe jusy 4,5 data

this is my code:

Code: Select all

 
<?        include('header.php');
        include('db_connect.php');
       
        $id=$_GET["id"];
        switch($id){
                case "tst":
                 $id = "???";
                break;
 
                case "cwb":
                 $id = "???";
                break;
 
                case "mk":
                 $id = "??";
                break;
               
                case "wc":
                 $id = "??";
                break;
 
                default:
                  $id = "??";
        }
 
   
?>
 
             </table>
       <table width="100%" border="0" class="mtable">
 
<?       
    $sql = "select * from  ubarbar_bar where badd='{$id}' order by vipcheck desc, sn desc limit 10";
    $result = mysql_query($sql);
       
        $row = mysql_fetch_array($result);
        if (!$row) {
                echo "<center>??????</center>";
        } else {
                do {
                        if($row[vipcheck] == "2"){ $vip = "yes"; } $vip = "no";
?>
                        <tr>
                        <td colspan="2" align="center"><?=$row[name];?></td>
                        </tr>
                        <tr>
                                <td align="left"><a href="bar_main.php?id=<?=$row[sn];?>"><img src="<?=$row[img];?>" width="200" border="0" /></a></td>
                                <td align="left">
                                <p>??:<?=$row[name];?></p><br /><br />
                                <p>??:<?=$row[add];?></p><br /><br />
                                <p>??:<?=$row[phone];?></p></td>
                        </tr>
                        <tr>
                        <td colspan="2" align="right">
                        [<a href="bar_main.php?id=<?=$row[sn];?>">????</a>]</td>
                        </tr>
                        <tr>
                        <td colspan="2" height="10"></td>
                        </tr>
<?
                } while ($row = mysql_fetch_array($result));
        }
?>
            </table></td>
          </tr>
    </table>
<? include('footer.php') ?>
see the picture:

Re: can i show id by this?

Posted: Sun Dec 06, 2009 10:19 pm
by LikPan
please help :cry: