PDA

View Full Version : THe Data from MySQL can't show up at browser



mariocs
12-15-2004, 08:54 PM
I have been learning for pHP in few days and
I have problem. And the problem make me very confuse.
I want to show some data from MySQL into my browser Internet Explorer 6.0. But it can't make it.
The result is blank and dids't give me any message of my mistakes.
All the syntax is correct but it can't happen as i want.
This is the syntax.

$sql = "SELECT id, firstname, lastname, spouse_firstname, housenumber, streetname, city, state, zip
FROM $table_name ORDER BY lastname";
$result = @mysql_query($sql, $connection) or die(mysql_error());
$num = @mysql_num_rows($result);
if ($num < 1) {
$display_block = "

Sorry! No results.</p>";
} else {
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
echo $id;

$firstname = $row['firstname'];
echo $firstname;

$lastname = $row['lastname'];
echo $lastname;

$streetname = $row['streetname'];
echo $streetname;

$city = $row['city'];
echo $city;

$state = $row['state'];
echo $state;

$zip = $row['zip'];
echo $zip;
}

Is there anything mistake at PHP 5.0 ? I use it.
Anyone can help me? Please...

mariocs

wmabear54
12-16-2004, 03:20 AM
Hi Mariocs

I am new to but I see you need one more closing bracket and not sure but is the @ nessicessary in php5.0 I use 4.3

Hope that helps
Mike

Deep13
12-18-2004, 12:41 PM
$result = @mysql_query($sql, $connection) or die(mysql_error());

try this

$result = @mysql_query($sql) or die(mysql_error());

check this for syntax info...

http://in2.php.net/mysql_query

Regards
Deep