Jump to content
php.lv forumi

upload image un upload txt savienosana!


Recommended Posts

<?
require ($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
$connection = @mysql_connect($db_host, $db_user, $db_password); 
if (!$connection)
{
die ('Could not connect: ' . mysql_error());
}
mysql_select_db("latbit_db", $connection);

$query  = "SELECT id, name FROM upload";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Database is empty <br>";
} 
else
{
while(list($id, $name) = mysql_fetch_array($result))
{
?>
	<img src="index.php?id=<?=$id;?>"/><br>
<?php
}
}
mysql_close($connection);
?>

un

<?php

require ($_SERVER["DOCUMENT_ROOT"]."/config/db_config.php");
$connection = @mysql_connect($db_host, $db_user, $db_password); 
if (!$connection)
{
die ('Could not connect: ' . mysql_error());
}
mysql_select_db("latbit_db", $connection);

$result = mysql_query("SELECT * FROM upload_txt");

echo "<table border='1'>
<tr>
<th>id</th>
<th>title</th>
<th>description</th>
</tr>";

while($row = mysql_fetch_array($result))
 {
 echo "<tr>";
 echo "<td>" . $row['autoID'] . "</td>";
 echo "<td>" . $row['title'] . "</td>";
 echo "<td>" . $row['description'] . "</td>";
 echo "</tr>";
 }
echo "</table>";

mysql_close($connection);
?>

Ka lie apvienoju sos divus skriptus? Neko daudz no php nezinu, tapec busu pateiciigs ja izkaidrotu cilveciski. ja pareizi domaju ta man vajag apvienot

while(list($id, $name) = mysql_fetch_array($result))

ar

while($row = mysql_fetch_array($result))

Link to post
Share on other sites
×
×
  • Create New...