Forum Moderators: coopster
<?php
$db=mysql_connect('localhost','xx','xx');
mysql_select_db('baziukas');
if ($db)
{
echo ("CONNECTED<br>");
$CL=mysql_close($db);
if ($CL="") {
echo ("SOMETING WRONG");
}
if ($CL="1")
echo ("RYSYS BAIKTAS");
}
else
echo ("NOT CONNECTED TO MYSQL!");
?>
<table>
<table border=1>
<tr>
<th>ID</th>
<th>Tekstas</th>
<th>Data</th>
</tr>
<?php
$db = mysql_connect("localhost","xx","xx");
if (!$db)
{
die('NOT CONNECTED!' . mysql_error());
}
mysql_select_db("baziukas", $db);
$result = mysql_query("SELECT * FROM table ORDER BY ID DESC LIMIT 6");
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>".$row['id']."</td>";
echo "<td>".$row['date']."</td>";
echo "<td>".$row['psw']."</td>";
echo "</tr>";
$rows[]=$row;
$yrasai=count($rows);
}
$puslapiai=$num_rows/$yraai;
echo $puslapiai;
$page = (isset($_GET['page'])? $_GET['page'] : 1);
$limit = $page * 30 - (30);
echo $page;
mysql_close($db);
?>
</table>
Plz help me :/
[edited by: eelixduppy at 6:30 pm (utc) on Jan. 5, 2009]
[edit reason] removed db specifics [/edit]
<?php
$db=mysql_connect('localhost','xx','xx');
if($db == false){
echo 'NOT CONNECTED TO MYSQL!';
exit(); //or do something else
}
mysql_select_db('baziukas');
?>
... html
<?php
$result = mysql_query("SELECT * FROM table ORDER BY ID DESC LIMIT 6");//Select everything?
while($row=mysql_fetch_assoc($result)) { //use mysql_fetch_assoc
...
$result = mysql_query("SELECT * FROM table ORDER BY ID DESC LIMIT $limit,30");
while($row=mysql_fetch_array($result))
{