Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<?php
if (isset($_POST['name'])=== true && empty($_POST['name'])=== false) {
        require '../db/connect.php';
        $query = mysql_query("SElECT id  FROM Customers WHERE  Customer_Name= '".mysql_real_escape_string(trim($_POST['name']))."'
        ");

        $fred = mysql_result($query,0,'id' );
        echo "$fred";

        $sql = "SELECT * FROM Customers WHERE id='$fred'" ;
        $results= mysql_query($sql);
    If (!$results){
        die('Invalid query:'.mysql_error());
    }
    echo "<table border=1>
            <tr>
            <th>Customer</th>
            <th>Region</th>
            <th>Email</th>
            <th>Phone</th>
            </tr>";
    while($result= mysql_fetch_array($results) ){
        echo"<tr>";
        echo"<td>".$result['Customer_Name']."</td>";
        echo"<td>".$result['Physical_Region']."</td>";
        echo"<td>".$result['Email_Address']."</td>";
        echo"<td>".$result['Phone_Number']."</td>";
        echo"</tr>";
    }
        echo"</table>";
}

    ?>
Posted
Updated 15-May-15 20:26pm
v3
Comments
vbmike 16-May-15 12:51pm    
I think you need to have the double quotes at either end of the statements: echo "<td>.$result['Customer_Name'].</td>".
G4mm4R4y 16-May-15 23:01pm    
No, there is nothing wrong with the way it was, as that wouldnt have the variables value but the actual variable name

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900