Jump to content
php.lv forumi

insert, un nolasit


neprasa

Recommended Posts

Ieliec koda sākuma error_reporting(E_ALL & ~E_NOTICE);

 

Datubāzē var ierakstīt

<?php
mysql_query("INSERT INTO tabula (vards, uzvards, niks)VALUES ('Jānis','Lapiņš','Janka')");
?>

 

 

Nolasīt no datubāzes var

<?php
$result = mysql_query("SELECT *  FROM tabula ");
while ($row = mysql_fetch_assoc($result))
{
echo $row['vards'];
echo $row['uzvards'];
echo $row['niks'];
}
?>

Link to comment
Share on other sites

nolasit

 

<?php

$con = mysql_connect("localhost","es","es");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

 

mysql_select_db("tests", $con);

$result = mysql_query("SELECT * FROM tabula ");

while ($row = mysql_fetch_assoc($result))

{

echo $row['vards'];

echo $row['uzvards'];

echo $row['niks'];

}

mysql_close($con)

?>

ierakstiit

 

<?php

$con = mysql_connect("localhost","es","es");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

 

mysql_select_db("tests", $con);

mysql_query("INSERT INTO tabula (vards, uzvards, niks)VALUES ('Jānis','Lapiņš','Janka')");

mysql_close($con)

?>

taa ?

Edited by neprasa
Link to comment
Share on other sites

×
×
  • Create New...