Jump to content
php.lv forumi

Izvadīt datus no My SQL uz HTML


Guest JesusOnline

Recommended Posts

Guest JesusOnline

Vēlos shitaadu kodu

<?php

include 'config.php';

include 'opendb.php';

 

$query = "SELECT ID, name, text, date FROM news";

$result = mysql_query($query);

 

while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{

echo "ID :{$row['ID']} <br>" .

"Name :{$row['name']} <br>" .

"zina : {$row['text']} <br>" .

"datums : {$row['date']} <br><br>";

}

 

include 'closedb.php';

?>

 

izvadīt iekš tiem html tagiem nu kaa lai pasaka, aptuveni kaukaa shitaa:

 

<table>

<tr>

<td ><? echo $ID;?></td>

</tr>

<tr>

<td ><? echo $name;?></td>

</tr>

<tr>

<td ><? echo $text;?></td>

</tr>

<tr>

<td ><? echo $date;?></td>

</tr>

 

</table>

 

Ceru ka jautājums ir daudzmaz saprotams

Link to comment
Share on other sites

Vovo - pats atbildi uzrakstīji.

Kas tev liedz rakstīt kaut vai šādi???

 

echo'<table>';
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "<tr><td> $row['ID'] </td></tr>" .
"<tr><td>$row['name'] </td></tr>" .
"<tr><td>  $row['text'] </td></tr>" .
"<tr><td> $row['date'] </td></tr>";
} 
echo'</table>';

Edited by ohmygod
Link to comment
Share on other sites

Guest JesusOnline

Lielum liels paldies.... Taa jau reizeem meedz gadiities ka risinaajums pašam ir zinaams, tikai kaukas iebremmzee. Viss griežas... thanks

 

Pamazaam tikai kauko saaku dariities ar to MySQL un taa sintakse man diez ko labi neiet

Edited by JesusOnline
Link to comment
Share on other sites

include 'closedb.php';

Diez vai, lai aizvērtu datubāzi nepieciešams inklūdot veselu failu, ja nu vienīgu, tur kaut kas speciāls. Kapēc nelietot vienkāršu

mysql_close(); // aizver visas mysql konekcijas

Link to comment
Share on other sites

×
×
  • Create New...