Jump to content
php.lv forumi

ka lai uzraksta vienkarshak


marlboro

Recommended Posts

  • Replies 42
  • Created
  • Last Reply

Top Posters In This Topic

<sho lapas augspuse kur kipa skripts atrodas!>

Notice: Undefined index: lapa in /usr/local/www/apache22/data/tmpl/main.html on line 31

 

<sho tur kur drukaa ara !>

Notice: Undefined offset: 0 in /usr/local/www/apache22/data/tmpl/main.html on line 94

 

<?php

####################START######################
ini_set("display_errors", true);
error_reporting(E_ALL);
#######################END####################

include("inc/config.php");

$result = mysql_query("SELECT id, saturs FROM xx_lv.lapas WHERE id") or die("Nevar savienoties ar tabulu!");
$lapu_masivs = Array();

while ($row = mysql_fetch_assoc($result)){
$lapu_masivs[$row['id']]=$row['saturs'];
}
$lapa = (int)$_GET['lapa']; 

?>

Link to comment
Share on other sites

Noversu to problemu ar 0 id veljoprojam - Notice: Undefined index: lapa in /usr/local/www/apache22/data/tmpl/main.html on line 31 :( ka lai pareizak vinju nodefineju ?

Vel jautajums ka lai tagad uztaisa taa ja id neksiste tad piem izruka ka tada lpp nau ?

<?php
include("inc/config.php");

$result = mysql_query("SELECT id, saturs FROM xx_lv.lapas WHERE id") or die("Nevar savienoties ar tabulu!");
$lapu_masivs = Array();

while ($row = mysql_fetch_assoc($result)){
$lapu_masivs[$row['id']]=$row['saturs'];
}
<<line 31>> $lapa = (int)$_GET['lapa'] ? $_GET['lapa'] : 1; 

?>

Link to comment
Share on other sites

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /usr/local/www/apache22/data/index.php on line 72

Lapa Netika atrasta!

 

izmet shadu pazinjojumu un to uz visiem id ari tiem kuri eksiste

 

<?php
if(array_key_exists($lapu_masivs, $lapa)){;

echo $lapu_masivs[$lapa];
}
else {

echo "Lapa Netika atrasta!";
}

?>

Link to comment
Share on other sites


×
×
  • Create New...