|
Posted by Richard Conway on 07/12/05 15:56
Luigi Donatello Asero wrote:
> "Richard Conway" <ric@shoe.com> skrev i meddelandet
> news:NOOAe.4096$2I4.2995@fe05.ams...
>
>>Luigi Donatello Asero wrote:
>>
>>>"Richard Conway" <ric@shoe.com> skrev i meddelandet
>>>news:FaOAe.2$HQ1.0@fe08.ams...
>>
>>In that case, there is something wrong with your query. Try changing
>>the following line from:
>>
>>$result = mysql_query("SELECT * FROM name of the table", $db);
>>
>>to:
>>
>>$result = mysql_query("SELECT * FROM name of the table", $db) or
>>die(mysql_error());
>>
>>This will trap the error and output it for you so you can get some idea
>>of where you've gone wrong.
>
>
> After some changes:
>
> <html> <body>
> <?php $db = mysql_connect("localhost", "user",
> "password");
> mysql_select_db("databas", $db);
> $result = mysql_query("SELECT * FROM table", $db) or
> die(mysql_error());
> echo "<table border=1>\n"; echo "<tr><th>Region</th>
> <th>Ort</th><th>Sovplatser</th><th>Rum</th><th>Avstånd till havet i
> km</th><th>Terrass</th></tr>\n";
> while ($mycolumn=mysql_fetch_array ($result))
> { printf("<tr><td>%s
> %s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
> $mycolumn[1], $mycolumn[2], $mycolumn[3]
> $mycolumn[4],$mycolumn[5],$mycolumn[6]);
> }
> echo "</table>\n"; ?>
> </body>
> </html>
>
>
> I get
> Parse error: parse error, unexpected T_VARIABLE in
> /home/s/scaiecat/www/sv/test20.php on line 10
>
>
> I do not understand yet, what is wrong.
>
>
In your printf() statement you have '%s' seven times but only six
variables are listed
[Back to original message]
|