Jump to content
php.lv forumi

širošnaa


sviesc

Recommended Posts

man te tāds koda gabaliņš es baigi vēlētos lai man širo pēc sadalam un piemēram izdrukā tikai noteiktas sadaļas saturu

<?
//te saksies to datu izvade kas ir datu bazee
if (!$visi) { echo( mysql_error()); }
else { 
while ($row = mysql_fetch_array($visi)) {
$vards = $row["name"];
$post = $row["post"];
$izvele = $row["sadala"];
$dat = $row["datums"];
?> 
<tr>
<td width="25%"><b><font face="Verdana" size="2" 
color="#000080"><? echo $name; ?></font></b></td>
<td width="25%"><b><font face="Verdana" size="2" 
color="#000080"><? echo $post; ?></font></b></td>
<td width="25%"><b><font face="Verdana" size="2" 
color="#000080"><? echo $izvele; ?></font></b></td>
<td width="25%"><b><font face="Verdana" size="2" 
color="#000080"><? echo $dat; ?></font></b></td>
</tr>

:blink:

Link to comment
Share on other sites

Ok tiktālu labi,

Bet man tagad nākošā problēma šitam koda gabalam tākā nevajadzētu automātiski ieraxtīt datubāze tukšus lauks izņemot datumu uz refreš

<?
$datums=date("d.m.Y H:i:s"); //nodefinejam datumu
$hostname = "localhost"; //nodefine serveri
$username = "bla";//nodefine lietotaju
$password = "blabla";//nodefine paroli
$dbName = "blala"; //nodefine datu bazi
$usertable = "kuku"; //nodefine datubazi


MYSQL_CONNECT ($hostname,$username,$password) OR DIE ("nav servera");
mysql_select_db("$dbName") or DIE ("Nav DB.");


$visi = mysql_query("SELECT * FROM $usertable
ORDER BY `id` DESC "); 
$abols = mysql_query("SELECT * FROM $usertable 
WHERE auglji='Aboli'"); 

$skaits = MYSQL_NUMROWS($visi);


?>
<?

if (!$visi) { echo( mysql_error()); }
else { 
while ($row = mysql_fetch_array($visi)) {
$vards = $row["name"];
$epasts = $row["post"];
$izvele = $row["sadala"];
$dat = $row["datums"];
?>

es tākā nesaprast kapē viņš man uz refreš iemet vel kādu ieraxtu db :blink:

Link to comment
Share on other sites

tur atkal nav neviena mysql_query('INSERT.....');

 

vai nevari iepastot arii to send.php (formas action)

.....

 

vienkaarshi es nesaprotu, kaa var tikt pievienoti db ieraxti, ja vispaar nav neviena INSERT, bet ir tikai SELECT vairaaki.... :huh:

Link to comment
Share on other sites

Pameegjini aizvietot:

 

// ievietojam datus datu baazee
$data = mysql_query("INSERT INTO $usertable (vards, epasts,
auglji, datums ) VALUES ('$vards',
'$text', '$sadala', '$datums')");

 

 

ar

 

 

// ja posts ir noticis ievietojam datus datu baazee
if (sizeof($_POST)>0){
 $data = mysql_query("INSERT INTO $usertable (vards, epasts,
 auglji, datums ) VALUES ('$vards',
 '$text', '$sadala', '$datums')"); 
 //forseejam refresh bez posta
 echo "
   <script>
      window.location='send.php';
   </script>

 "; 
}

Link to comment
Share on other sites

×
×
  • Create New...