Jump to content
php.lv forumi

SQL tabulas


Seal
 Share

Recommended Posts

Sveiki, es izveidoju šo kodu

 

<?php
$mysqlconnnect = mysql_connect ('localhost','root','85221802');
if (!$mysqlconnnect){
die ('Savienojums ar datubāzi netika veikts, ievadi pareizos datus!');
}
mysql_select_db ("cms", $mysqlconnnect);
$sql = "CREATE TABLE RegisteredUsers
(
Login varchar(15) NOT NULL,
Password varchar(15) NOT NULL,
Age int
)";
mysql_query ($sql,$mysqlconnnect);
mysql_select_db ("cms", $mysqlconnnect);
$sql2 ="INSERT INTO RegisteredUsers (Login, Password, Age)
VALUES
('$_POST[Login]','$_POST[Password]','$_POST[age]')";
if (!mysql_query($sql2,$mysqlconnnect))
{
die ('' . mysql_error());
}
else
echo '<b>Tika pievienota informācija datubāzē!</b>'
?>

 

Tad es mēģināju izdzēst tabulas kurās jau bija informāciju, kuru es ieguvu caur FORM (Login, parole, vecums un submit poga).Itkā izdzēsās tabulas ar informāciju, bet to vietā parādās vienmēr viens un tāds pats skaits rindu. Kad es FORMā ievadu tukšas ailes, pievienojas vēl tās rindas un izdzēst man viņas neizdodas.

 

 

Varbūt vajag kaut ko pie SQL koda pierakstīt lai neveidotos bezjēdzīgas tabulas ar tukšumiem?

post-8465-0-39237600-1323631358_thumb.jpg

Edited by Seal
Link to comment
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...
 Share

×
×
  • Create New...