Jump to content
php.lv forumi

Jaunākie raksti forumā!


Recommended Posts

Problēma:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\host\jaunakais.php on line 18

 

Jaunakais php:

<?php
$platums = "160"; // platums px
$forums = "http://forums"; // foruma url
$limits = "6"; // cik daudz jaunumi uzradisies
$host = "localhost"; // db hosts
$dbname = "******"; // 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 "<div>";
// izvadam jaunumus
while($row = mysql_fetch_array( $kverisdivi )) {
 $datums = $row['start_date'];
 $piev_datums = date("d/m/Y : H:i:s",$datums);
echo "<p><b>Kur:</b> <a style='text-decoration: none' href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\" 

title=\"\">".$row[title]."</a> | <strong>".$row[posts]."</strong><br>
<b>Kas:</b> <a style='text-decoration: none' href=\"http://forums/index.php?showuser=".$row[last_poster_id]."\" 

title=\"\">".$row[last_poster_name]."</a></p>";
}
echo "</div>";

?>

Link to post
Share on other sites
  • 1 month later...
<?php
$platums = "160"; // platums px
$forums = "http://izeed-dirsu.lv/forums"; // foruma url
$limits = "5"; // cik daudz jaunumi uzradisies
$host = "localhost"; // db hosts
$dbname = "ipb"; // foruma datubaze
$dbuser = "root"; // foruma db users
$dbpass = "neteiksu"; // 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 "<div>";
// izvadam jaunumus
while($row = mysql_fetch_array( $kverisdivi )) {
 $datums = $row['start_date'];
 $piev_datums = date("d/m/Y : H:i:s",$datums);
echo "<p><b>Kur:</b> <a style='text-decoration: none' href=\"$forums/index.php?showtopic=".$row[tid]."&view=getnewpost\" 

title=\"\">".$row[title]."</a> | <strong>".$row[posts]."</strong><br>
<b>Kas:</b> <a style='text-decoration: none' href=\"$forums/index.php?showuser=".$row[last_poster_id]."\" 

title=\"\">".$row[last_poster_name]."</a></p>";
}
echo "</div>";

?>

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