如果我理解您的问题,这就是您想要的示例:
<?php
$server = "yourserver";
$user = "youruser";
$pass = "yourpass";
$db = "dbname";
$conexion=mysql_connect ($server, $user, $pass) or die ('problems with conexion:' . mysql_error());
mysql_select_db ($db, $conexion);
$sql ="SELECT company_name, contact_person, phone_number, booth_number FROM registration WHERE sold_by = $username;"
$table = mysql_query($sql, $conexion) or die ("error... <br><b>" . mysql_error()."</b>");
$finds = mysql_num_rows($table);
echo "Persons: ".$finds."<br>;
while ($r = mysql_fetch_array($table)) {
echo $r['company_name', 'company_name', 'contact_person, 'phone_number', 'booth_number'];
}
?>