Page 1 of 1

Sounds a bit stoopid :? But can somebody help me fast?

Posted: Mon Nov 04, 2002 5:58 am
by Skywalker
My syntax is this, but it still doesn't update the empty table colum

$Opdracht = "Update $Table SET ID=$ID, Naam=$Naam, AchterNM=$AchterNM, WNPlaats=$WNPlaats, Post=$Post, Straat=$Straat, Studie=$Studie, Email=$Email, Username=$Username, Password=$Password, Blok=$Blok, WHERE ID=$ID";

Posted: Mon Nov 04, 2002 6:08 am
by twigletmac
You probably need single quotes around all of those strings that you are trying to enter and no comma before the WHERE clause:

Code: Select all

$Opdracht = "Update $Table SET ID='$ID', Naam='$Naam', AchterNM='$AchterNM', WNPlaats='$WNPlaats', Post='$Post', Straat='$Straat', Studie='$Studie', Email='$Email', Username='$Username', Password='$Password', Blok='$Blok' WHERE ID='$ID'";
Mac

Posted: Mon Nov 04, 2002 6:30 am
by Skywalker
It still doesn't work Don't forget that the Blok Table Colum is empty in the first place.

As you can see herehttp://members.chello.nl/~s.vandemeulen/test.jpg

Posted: Mon Nov 04, 2002 9:27 am
by Kyori
i'm not sure if i understand you but here goes...

you cannot update an empty table.

remove comma before WHERE

If there a $id value in your table?


Other than that, I just learned a thing from you. That's a very short way of doing things. I would have done it this way.

'UPDATE tablename SET id=' . $id . ', naam=' . $naam . ' WHERE id=' . $id;

Posted: Mon Nov 04, 2002 9:34 am
by twigletmac
Have you tried echoing out the query to make sure that all the variables are being passed to it correctly? Have you tried running the query in phpMyAdmin? (Obviously replacing the variables, $ID, $blok etc with actual data). You are putting the statement through a mysql_query() call aren't you?

Code: Select all

mysql_query($Opdracht) or die(mysql_error().'<p>'.$Opdracht.'</p>');
Mac

Posted: Mon Nov 04, 2002 9:42 am
by Skywalker
Yes that is correct first it makes a query on the page and on that page ther is a link that must be able to send al the qeury information of just one row with an uniec number (ID)

To Blockuser.php and in that source coed stands that The row with this ID has to be updated The update must be don in the colm BLOK in to ther has to come the word YES So that the blok colm is not enymore empty and contains the word yes

So the user has still his account, but it contains the word yes in blok and when Blok is Yes, the user can not continue with login because he is blocked.

Maybe that is more clear. But maybe I should fill in for al the Blok Colms A NO in the first place so I can update it to a YES?

Maybe that will work? What do you guys think?

Greathings Skywalker

Posted: Mon Nov 04, 2002 11:39 am
by smesquita
The colum can be empty. If you want to update just one colum you may do this:

Code: Select all

$Opdracht = "Update $Table SET Blok='$Blok' WHERE ID=$ID";

Posted: Tue Nov 05, 2002 2:06 am
by twigletmac
What type of column is blok? varchar? And smesquita is right, if you only want to update one column you don't have to put in the information for all the others as well.

Mac

Posted: Tue Nov 05, 2002 3:20 am
by Skywalker
that's right, the clom is Char and I will try the easy way then :D