2016-04-13 15 views
1

Ich habe bereits diesen Beitrag How to get row ID in button click? verwiesen, aber kann immer noch nicht laden Werte und ich weiß nicht warum. Ich bin ziemlich sicher, dass die ID gewesen ist richtig erfasst bei profile.php. Unten ist mein Code:Wie ID auf eine andere Seite zu bekommen und es Wert basierend auf ID

hanj.php 

    style type="text/css"> 
     .buttonize { 
     text-decoration: none; 
     border: 1px solid #ccc; 
     background-color: #efefef; 
     padding: 10px 15px; 
     -moz-border-radius: 11px; 
     -webkit-border-radius: 11px; 
     border-radius: 11px; 
     text-shadow: 0 1px 0 #FFFFFF; 
     } 
    <?php require_once('Connections/conn.php');?> 
    </style> 
    <table border="1" cellpadding="5" cellspacing="2" width="600"> 
    <tr> 
     <th>Vendor Id</th> 
     <th>Kategori</th> 
     <th>Nama Vendor</th> 
     <th>Alamat</th> 
     <th>Poskod</th> 
     <th>Bandar</th> 
     <th>Negeri</th> 
     <th>No</th> 
     <th>Email</th> 
    </tr> 



    <?php 
    session_start(); 
    $_SESSION['profile']= $row ['v_id']; 
    mysql_select_db ($database_conn,$conn); 
    $query="SELECT v_id,type,companyName,address,code,city,state,contact,email FROM vendor"; 
    $result=mysql_query($query) or die(mysql_error()); 

    while($row=mysql_fetch_array($result)) 
    { 
     echo "</td><td>"; 
     echo $row['v_id']; 
     echo "</td><td>"; 
     echo $row['type']; 
     echo "</td><td>"; 
     echo $row['companyName']; 
     echo "</td><td>"; 
     echo $row['address']; 
     echo "</td><td>"; 
     echo $row['code']; 
     echo "</td><td>"; 
     echo $row['city']; 
     echo "</td><td>"; 
     echo $row['state']; 
     echo "</td><td>"; 
     echo $row['contact']; 
     echo "</td><td>"; 
     echo $row['email']; 
     echo "</td><td>"; 
     print '<center><a href="profile.php?id='.$row['v_id'].'" class="buttonize">View</a></center>'; 
     echo "</td></tr>"; 
    } 
    ?> 



profile.php 
    <?php require_once('Connections/conn.php'); ?> 
    <html> 
     <head> 
     <meta charset="utf-8"> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
     <title>Casado</title> 
      <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> 
      <script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> 
      <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"> 
      <link href="http://pingendo.github.io/pingendo-bootstrap/themes/default/bootstrap.css" rel="stylesheet" type="text/css"> 

    <div class="container"> 
    <div class="col-md-12"> 
    <div class="col-md-2"></div> 

    <div class="col-md-8"> 
    <table class="table table-bordered"> 
        <thead> 
        <tr> 
         <th>Pakej</th> 
         <th>Image</th> 
         <th>Harga</th> 
         <th>Vendor Id</th> 
        </tr> 
        </thead> 
        <tbody> 

        <?php 
        session_start();    
        mysql_select_db ($database_conn,$conn); 
        $vid = $_SESSION['profile']; 
        $sql = mysql_query("SELECT * from item where v_id = '$vid' ") or die (mysql_error()); 
        while($res = mysql_fetch_array($sql)) { 
        ?> 




        <tr> 
         <td><?php echo $res['pakej'] ?></td> 
         <td><?php echo '<img src="data:image;base64,'.$res['image'].'" class="img-thumbnail">' ?></td> 
         <td><?php echo $res['harga'] ?></td> 
         <td><?php echo $res['v_id'] ?></td> 
        </tr> 
        <?php } 
        ?> 

        </tbody> 
       </table> 
       </div> 

       <div class="col-md-2"></div> 
       </div> 
       </div> 

    </body> 
    </html> 

btw

+0

Statt $ _SESSION ['profile'] benutze $ _REQUEST ['id'] in deiner profile.php und es sollte funktionieren. –

+0

danke es funktioniert Mann !!!! :) –

+0

Willkommen Bruder. :) –

Antwort

0

Statt $_SESSION['profile'] Verwendung $_REQUEST['id'] in Ihrem profile.php und es sollte funktionieren.

0

In profile.php Verwendung $ _GET kein Syntaxfehler wird die in 'id' übergeben zu verweisen. d.h Ersetzen die folgende Zeile

$vid = $_SESSION['profile']; 

mit diesem.

$vid = $_GET['id']; 

Hoffe das hilft.

+0

nein ich habe es versucht..nicht funktioniert, noch keine Werte gezeigt Mubashar Abbas –

+0

Erhalten Sie irgendwelche Fehler? –

+0

kein Mann :(, ich bekomme keinen Fehler –

0

diese Frage durch Bikash Paul oben beantwortet wird, wo er vorschlagen

0

Statt $vid = $_SESSION['profile']; versuchen $vid = $_GET['profile']; $ _SESSION [ 'Profil'] auf $ _REQUEST [ 'id'] zu ändern, wenn nicht funktioniert, dann print_r ($ _GET) oder print_r ($ _ REQUEST) & zeigen uns die Details

Verwandte Themen