Jump to content
php.lv forumi
Sign in to follow this  
GeRik

Problema koda

Recommended Posts

pekshni koda paradijas kljuuda kods ir shads

kljudas.jpg

<?php
$platums = "160"; // platums px
$forums = "/forum"; // foruma url
$limits = "5"; // cik daudz jaunumi uzradisies
$host = "localhost"; // db hosts
$dbname = "forum"; // foruma datubaze
$dbuser = "root"; // foruma db users
$dbpass = ""; // juusu foruma datubaazes parole
$link = mysql_connect($host, $dbuser, $dbpass)
or die("NEsanaaca piekontektities: " . mysql_error());
mysql_select_db($dbname) or die("Datubaaze neekstistee");
mysql_query("SET NAMES UTF-8"); // lai rada LV alfabetu

// dabuunam datus no DB
$kverisdivi = mysql_query("SELECT posts, last_poster_name, last_poster_id, title, tid, forum_id, last_post FROM ibf_topics ORDER
BY last_post DESC LIMIT ".$limits."");

echo "<ul><font size='1pt'><div>";
// izvadam jaunumus
while($row = mysql_fetch_array( $kverisdivi )) {
 $datums = $row['start_date'];
 $piev_datums = date("d/m/Y : H:i:s",$datums);

mb_internal_encoding("UTF-8");
echo "<right><img src='images/24.png'><a href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\"

title=\"\">".(strlen($row['title'])>31?substr($row['title'],0,31).'...':$row['title'])."</a> (".$row[posts].") 
<br>";
}
echo "</div></font>";
?>

Edited by GeRik

Share this post


Link to post
Share on other sites

GeRik: kāpēc tu mums liec darīt lieku darbu - skaitīt, kura tev tur ir 27. rindiņa?

Liec kodu http://paste.php.lv/ lai to automātiski var redzēt.

 

Kļūdas paziņojums ir vistipiskākais situācijai, kad tiek lietots nepareiza sintakse masīva elementa piekļūšanai, piemēram: $arr[posts]. Tā vietā vajag rakstīt $arr["posts"].

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...