0

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

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:

Error suppression ignored for ( ! ) Parse error: syntax error, unexpected 'while' (T_WHILE), expecting ',' or ';' in C:\wamp\www\droidlogin\citas.php on line 13

3

3 Answers 3

3

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>";
Sign up to request clarification or add additional context in comments.

3 Comments

thanks! now the error is SCREAM: Error suppression ignored for ( ! ) Parse error: syntax error, unexpected '/' in C:\wamp\www\droidlogin\citas.php on line 14
@user2056944 did you made both modification?
yes the error now is ! ) SCREAM: Error suppression ignored for ( ! ) Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\droidlogin\citas.php on line 13 Call Stack # Time Memory Function Location 1 0.0010 254864 {main}( ) ..\citas.php:0 2 1.0130 270096 mysql_fetch_array ( ) ..\citas.php:13
0

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"]

6 Comments

thanks!! but now the error is SCREAM: Error suppression ignored for ( ! ) Notice: Undefined variable: link in C:\wamp\www\droidlogin\citas.php on line 5 Call Stack # Time Memory Function Location 1 0.0018 254568 {main}( ) ..\citas.php:0
@user2056944 does $link is defined inside connectbd.php?
i correct the error now just this SCREAM: Error ignored for suppression (!) Warning: mysql_fetch_array () Expects parameter 1 to be resource, boolean Given in C: \ wamp \ www \ droidlogin \ citas.php on line 13
@user2056944 , i m not sure but remove $link from select query and then try.
replace include("connectbd.php"); to require_once "connectbd.php";
|
0

try this:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.