Jump to content

cant update


karq

Recommended Posts

<?php
//votame formi data
$pealkiri=$_POST["peal"];
$uudis=$_POST["uudis"];
$num=$_POST["id"];
//Tuli ikka õigest kohast
if (!isset($pealkiri) || !isset($uudis)) {
echo "<center><b>Kuskil oli viga, proovi uuesti</b><br />";
echo "<a href='muuda.php'>Tagasi</a><center>";
}//kui tuldi valest kohast
//Kui väljad on tyhjad;
elseif (strlen($pealkiri || $uudis)==0){
echo "<center><b>Täida väljad</b><br />";
echo "<a href='muuda.php'>Tagasi</a><center>";
}
//Kontrollime kas session on olemas
else {
session_start();
if (session_is_registered("kasutaja")) {
include "db.php";
//uuendame databaasi
$uue="UPDATE uudis SET pealkiri='$pealkiri' and uudis='$uudis'
WHERE num='$num'";
if (mysql_query($uue,$con)) {
echo "<center><b>Databaas uuendatud</b><br />
<a href='muuda.php'>Tagasi</a></center>";
}
else {
echo mysql_error();
}//kui ei saanud uudendada
}//kui kõik oli ok
else {
echo "<center><b>Te pole sisse loginud</b><br />";
echo "<a href='logi.php'>Logi sisse</a><center>";
}
}
?>

 

Why dosent it update that table?

Link to comment
Share on other sites

the problem is some where here

//Kontrollime kas session on olemas
else {
session_start();
if (session_is_registered("kasutaja")) {
include "db.php";
//uuendame databaasi
$uue="UPDATE uudis SET pealkiri='$pealkiri' and uudis='$uudis'
WHERE num='$num'";
if (mysql_query($uue,$con)) {
   echo "<center><b>Databaas uuendatud</b><br />
   <a href='muuda.php'>Tagasi</a></center>";
}
else {
   echo mysql_error();

Link to comment
Share on other sites

Another question, why are you running mysql_query on $update when your query is $uue?

 

It dosent give any error. It just dosent work.

As requested before, please echo the sql query.

echo mysql_query($update,$con);

 

and the output is 1

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.