You're missing a closing parenthesis at the end of:

while ($row = mysql_fetch_row($result)

This should be

while ($row = mysql_fetch_row($result))

> -----Original Message-----
> From: Delta Storm [mailto:[EMAIL PROTECTED]
> Sent: 10 January 2007 10:45
> To: php-general@lists.php.net
> Subject: [PHP] Problems with mysql_connect()
>
>
> Hi,
>
> I'm having problems with this code (a simple exercise where i wanto to
> connect to sql server and get data from it and write that data in html)
>
>
> :
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>Exercise 23 - Using PHP with MySQL</title>
> </head>
>
> <body>
> <?php
>
>       //Povezuje se s MySQL serverom
>       $connection = mysql_connect('localhost','user','pass') or die
> ("Unable to connect to MySQL server");
>
>       //Odabira bazu podataka
>       mysql_select_db("php1") or die ("Unable to select database");
>
>       //Pravi i zadaje upit
>       $query = "SELECT * FROM items";
>       $result = mysql_query($query) or die ("Error in query:
> $query ."     .
> mysql_error());
>
>       //Provjerava jeli li zapisi vraceni
>       if (mysql_num_rows($result) > 0)
>       {
>               //Pravi html tablicu
>               echo "<table width=100% cellpadding=10
> cellspacing=0                         border=1>";
>               echo "<tr>
>                               <td>
>                                       <b>ID</b>
>                               </td>
>                               <td>
>                                       <b>Name</b>
>                               </td>
>                               <td>
>                                       <b>Price</b>
>                               </td>
>                       </tr>";
>
>               //Prolazi kroz skup zapisa
>               //ispisuje svako polje
>               while ($row = mysql_fetch_row($result)
>               {
>                       echo "<tr>";
>                       echo "<td>" . $row [0] ."</td>";
>                       echo "<td>" . $row [1] ."</td>";
>                       echo "<td>" . $row [2] ."</td>";
>                       echo "</tr>";
>               }
>               echo "</table>";
>
>       }
>       else
>       {
>               //Ispisuje poruku o gresci
>               echo "No rows found!";
>       }
>
>       //Kad je obrada gotova oslobada skup rezultata
>       mysql_free_result($result);
>
>       //Prekida vezu s MySQL serverom
>       mysql_close($connection);
> ?>
>
> </body>
> </html>
>
>
> the error is : "Parse error: parse error, unexpected '{' in C:\Program
> Files\XAMPP\xampp\htdocs\test_folder\exercise23.php on line 41"
>
> I really dont know why is this error showing i looked for syntax errors
> but i think that there aren't any
>
>
> Thanks in advance! :)
>
>
> (P.S dont read the commnents they are croatian)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to