|
| Visning af database Fra : @L |
Dato : 10-12-03 14:37 |
|
Hej
Fejl:
Parse error: parse error, unexpected T_STRING in d:\program files\apache
group\apache2\htdocs\viewdb.php on line 4
Kode:
<html>
<?php
$db = mysql_connect("localhost", "root", ") ;
mysql_select_db("learndb",$db) ;
$result = mysql_query("SELECT * FROM personnel",$db) ;
echo "<table>" ;
echo"<tr><td><b>full name</b><td><b>nick name</b><td><b>salary</b></tr>" ;
while ($myrow = mysql_fetch_array($result))
{
echo "<tr><td>" ;
echo $myrow["firstname"] ;
echo " " ;
echo $myrow["lastname"] ;
echo "<td>";
echo $myrow["nick"] ;
echo "<td>" ;
echo $myrow["salary"] ;
}
echo "</table>" ;
?>
</html>
Hvad er der galt?
Mvh
Anders
| |
@L (10-12-2003)
| Kommentar Fra : @L |
Dato : 10-12-03 14:40 |
|
Okay. Jeg havde glemt et semi-kolon på linie 3...Grrr...
"@L" <dsl38495@vip.cybercity.dk> wrote in message
news:3fd72191$0$95081$edfadb0f@dread11.news.tele.dk...
> Hej
>
> Fejl:
> Parse error: parse error, unexpected T_STRING in d:\program files\apache
> group\apache2\htdocs\viewdb.php on line 4
>
> Kode:
> <html>
> <?php
> $db = mysql_connect("localhost", "root", ") ;
> mysql_select_db("learndb",$db) ;
> $result = mysql_query("SELECT * FROM personnel",$db) ;
> echo "<table>" ;
> echo"<tr><td><b>full name</b><td><b>nick name</b><td><b>salary</b></tr>" ;
> while ($myrow = mysql_fetch_array($result))
> {
> echo "<tr><td>" ;
> echo $myrow["firstname"] ;
> echo " " ;
> echo $myrow["lastname"] ;
> echo "<td>";
> echo $myrow["nick"] ;
> echo "<td>" ;
> echo $myrow["salary"] ;
> }
> echo "</table>" ;
> ?>
> </html>
>
> Hvad er der galt?
>
> Mvh
> Anders
>
>
| |
Jacob Atzen (10-12-2003)
| Kommentar Fra : Jacob Atzen |
Dato : 10-12-03 14:44 |
|
"@L" <dsl38495@vip.cybercity.dk> writes:
> Parse error: parse error, unexpected T_STRING in d:\program files\apache
> group\apache2\htdocs\viewdb.php on line 4
Jaa, hvad står der mon på linie 4, lad os se:
1 <html>
2 <?php
3 $db = mysql_connect("localhost", "root", ") ;
4 mysql_select_db("learndb",$db) ;
Der står ikke umiddelbart noget galt i linie 4. Men i linie 3 er der
da vist en slemmert. En uafsluttet streng som sidsteparameter til
connect kaldet, tsk, tsk.
--
Med venlig hilsen
- Jacob Atzen
| |
|
|