简体   繁体   English

在php中显示来自mysql的数据

[英]display data from mysql in php

i am beginner in php and mysql, php where I make an HTML table display name hour date and show me the table of my database containing the fields "name" "hour" "date" The name of the database is androidhive and the table name is products 我是php和mysql的初学者,在php中,我制作了一个HTML表,显示名称小时日期,并向我显示包含字段“名称”,“小时”,“日期”的数据库表,数据库名称为androidhive,表名是产品

My code is: 我的代码是:

<?php
include("connectbd.php"); //importamos el archivo para la coneccion a la base de datos

$res=mysql_query("SELECT * FROM products",$link); //Hacemos la consulta
?>
<html>
<head></head>
<body>
<?php
echo"<table><tr><td>Nombre</td><td>hora<td>fecha</td></tr>" //Hacemos una tabla html para ordenar los datos

while($row=mysql_fetch_array($res)){ //Guardaremos los datos en un array llamado $row cada indice del array sera el nombre del campo "Nombre","Apellidos", "Email", "Id"
echo"<td>".$row["Nombre"]." ".$row["hora"]."".$row["fecha"]</td>"; //le pasamos el id a la pagina del link para que reconosca el dato
}
echo"</table>";
?>
</body>
</html>

the error is SCREAM: 错误是SCREAM:

Error suppression ignored for ( ! ) Parse error: syntax error, unexpected 'while' (T_WHILE), expecting ',' or ';' (!)的错误抑制被忽略分析错误:语法错误,意外的“ while”(T_WHILE),期望为“,”或“;” in C:\\wamp\\www\\droidlogin\\citas.php on line 13 在第13行的C:\\ wamp \\ www \\ droidlogin \\ citas.php中

This line: 这行:

echo"<table><tr><td>Nombre</td><td>hora<td>fecha</td></tr>"

Need a ; 需要一个; at the end: 在末尾:

echo"<table><tr><td>Nombre</td><td>hora<td>fecha</td></tr>";

And this one: 还有这个:

echo"<td>".$row["Nombre"]." ".$row["hora"]."".$row["fecha"]</td>";

has an unclosed attachement , mean one ." left: 有一个未封闭的附件 ,意思是一个."左:

echo"<td>".$row["Nombre"]." ".$row["hora"]."".$row["fecha"]."</td>";

尝试这个:

 echo"<td>".$row["Nombre"]." ".$row["hora"]." ".$row["fecha"]."</td>";

Replace : 更换:

echo"<td>".$row["Nombre"]." ".$row["hora"]."".$row["fecha"]</td>"; //le pasamos el id a la pagina del link para que reconosca el dato

To

echo"<td>".$row["Nombre"]." ".$row["hora"]."".$row["fecha"]."</td>"; //le pasamos el id a la pagina del link para que reconosca el dato

Missing ." after $row["fecha"] 缺少."之后, $row["fecha"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM