Page 1 of 1

Error Message

Posted: Mon Jul 07, 2003 7:24 am
by tuta
Hallow friends;
I´m a poblem now!!!
My php is returning this message:

Parse error: parse error, unexpected $end in c:\inetpub\wwwroot\teste.php on line 35

I´m using While {}.

<?php
$res1 = mysql_connect("localhost","primeira");

if($res1) {
$var = $_POST["mytextbox"];
echo $var;
$sql = "select * from primeira1 where NomPrimeira Like ('%$var%')";
$result = mysql_db_query("primeira","$sql",$res1);
?>
<html>
<head>
<title>Teste</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="4" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="33%" align="center" bgcolor="#808080"><b>Código</b></td>
<td width="33%" align="center" bgcolor="#808080"><b>Nome</b></td>
</tr>
<? while($valor = mysql_fetch_array($result)) { ?>

<tr>
<td width="25%" bgcolor="#000080"><b><font color="#FFFFFF">
<? echo $valor["Codigo"]; ?> </font></b></td>
<td width="75%" bgcolor="#000080" align="right"><b>
<? echo $valor["Nompriemira"]; ?> </font></b></td>
</tr>


<?
} ?>
</table>
</body>
</html>

What is the poblem?

Miguel

Posted: Mon Jul 07, 2003 7:47 am
by twigletmac
These errors are generally caused by missing braces on code:

Code: Select all

<?php 
$res1 = mysql_connect("localhost","primeira"); 

if($res1) { 
	$var = $_POST["mytextbox"]; 
	echo $var; 
	$sql = "select * from primeira1 where NomPrimeira Like ('%$var%')"; 
	$result = mysql_db_query("primeira","$sql",$res1); 
?> 
HTML
<?php
		while($valor = mysql_fetch_array($result)) {
?> 
HTML
<?php 
		}
// missing closing brace
?> 
HTML
Mac