All pastes #946470 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-17 18:58 UTC
rendered paste body
client.php

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php 
include 'config.php';
include 'opendb.php';

$query = "SELECT id, name FROM clients";
 $result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id = $row['id'];
$client_name = $row['name']; 	// i don't like using complicated {$blabla} expansions inside strings
    echo "Names of clients :<br><a href='shclient.php?action=shcl&clid=$id'> $client_name </a><br>";
        
} 

include 'closedb.php';
?>
<body>
</body>

shclient.php

<title>Untitled Document</title>
</head>
<?php
include 'config.php';
include 'opendb.php';

$debug = 1;

$clid = $_GET['clid']*1; // avoid sql injection by forcing numeric
$shcl = $_GET['shcl'];

if ($debug) var_dump($clid, $shcl); // debug info

$result = $query->select("select name, bos from clients where id = $clid"); /* force numeric to avoid injection */

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) 
{
    sprintf("Information of clients :<br>%s<br>" .
		"Beginning of service : %s<br>"
        ,$row['name']
        ,$row['bos'] // again, i don't like fancy expansions, thats just me
       );
} 

include 'closedb.php';

?>
<body>
</body>