Question

i have this situation (mysql + php):

mysql:

    `| employee | visitday   | customername | picnumber | picpath   |
     ----------------------------------------------------------------
     |  agent 1 | 2014-02-16 |   customer   |    1      |c:\....jpg |
     |  agent 2 | 2014-01-11 |   customer   |    1      |c:\....jpg |`

in my site i have a tree menu like this: employee -> visitday -> customername, based on mysql

How can i do that when I click on customername to open a image gallery with customers pictures.

thx.

Was it helpful?

Solution

I guess you have some sort of file called customer.php

so the link to that customer in the menu could be something like: customer.php?name=customername

and then in customer.php use the following:

<?php
$customer = $_GET['name'];

if(isset($customer) && !empty($customer)) {
   $query = mysql_query("SELECT `id`, `customername`, `picpath` FROM `the table name` WHERE `customername` = '$customer'");


  echo '<table>
              <tr> <th>Foto</th> </tr><tr>';
   while( $associate = mysql_num_rows($query)) {
         echo '<td><img src="'.$associate['picpath'].'"></td>
              </tr><tr>';
   }
  echo '</tr>
     </table>';
} else {
     header('Location: index.php');
     exit();
}
?> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top