my gud !!!
Unknown column 'permission' in 'field list'
| SitePoint Sponsor |
my gud !!!
Unknown column 'permission' in 'field list'


OK forget that, I just saw the last post, check your spelling of permission against what you have in the database.
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!




oh **** i forgot the field is called perms lol hat would i change to make it perms?
YesOriginally Posted by Tidal Wave


permission = '$_POST[newpermission]',
to
perms = '$_POST[newpermission]',
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!




what and were would i change it so it knows its perms instead of permission


exactly what I just put!!!
perms = '$_POST[newpermission]',
(in the query)
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!




says this now and didnt update:
UPDATE users SET username = 'luke', perms = 'member', opnick = 'none' where username=''Record Updated


username=''Record Updated
means the original username isn't being passed properly.
Check the field is set up and that the code retrieving it ($_POST['username']) is correct
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!
<form action="addoppro.php" method="post">
Username: <input type="text" name="newusername" value="<? echo $username; ?>"><br><input type="hidden" name="username" value="<? echo $username; ?>">
Permission: <input type="text" name="newperms" value="<? echo $perms; ?>"><br>
Operator Nickname: <input type="text" name="newopnick" value="<? echo $opnick; ?>"><br>
<input type="Submit" value="Update">
</form>
<?
include "../db_connect.php";
#include "theme.php";
$query = "UPDATE users SET username = '$_POST[newusername]', perms = '$_POST[newperms]', opnick = '$_POST[newopnick]' where username='$_POST[username]'";
echo $query;
mysql_query($query) or die(mysql_error());
echo "Record Updated";
?>
<input type="hidden" name="username" value="<? echo $username; ?>">
added?


Off Topic:
just as an aside to this ongoing question,
Using short tags such as <? and <?= will soon be impossible as they are on the list of deprectated items. Try and use <?php and <?php echo instead.
Mike
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!




says this
UPDATE users SET username = 'luke', perms = 'member', opnick = 'None' where username=''Record Updated


right, lets start at the beginning!
How is the form being populated?
Does the information get to the form from a database record correctly?
view the source of the page from a browser and see if the hidden field has been set with the correct username.
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!




i press view source button and dosnt even pop up fo rsome reason :s
can u plz give it a try user and password is temp u gotta login at www.ninechat.com/accounts/ninechat then go to http://servers2/accounts/ninechat/admin/addop.php


OK, there are no values going to the form at all.
In order to update this form using the methods shown you will have to set up a query to get the members details from the database based on their login records.
IE
Now when the form is sent, the values for username will be passed along with it.PHP Code:<?php
# if the user is logged in as Tidal with the password Wave
# the login details would either be from your sessions or your cookie variables
#
$sql=mysql_query("select * from memberstable where username='Tidal' and password='Wave'") or die(mysql_error());
$rows = mysql_fetch_assoc($sql);
# now you can populate the form fields
$username=$row['username'];
$perms = $row['perms'];
$opnick=$rows['opnick'];
?>
<form action="addoppro.php" method="post">
Username: <input type="text" name="newusername" value="<? echo $username; ?>"><br><input type="hidden" name="username" value="<? echo $username; ?>">
Permission: <input type="text" name="newperms" value="<? echo $perms; ?>"><br>
Operator Nickname: <input type="text" name="newopnick" value="<? echo $opnick; ?>"><br>
<input type="Submit" value="Update">
</form>
Cheers
Mike
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!


are you submitting old username value through the form? if not, please do (in a hidden field). Alternatively pass the old username as a session variable... and after the query.. update this session variable with the new value... for you to use session variable.. call session_start() before referencing the value in session globals array ($_SESSION).




i think you got it wrong. This is a page to make it so u type in a username a want to update and text in the perms field so it updates that instead of doing it in phpmyadmin




This is an admin page to edit user permissions in the perms field


I guessed it was but you need a way to define who the member being updated is!
You could just have 3 text fields
Username
New username
Permissions
and do it that way.
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!


Originally Posted by ruchit
Two pages, read the thread, the hidden field is set!
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!




i dont want to change the username i just want the username thing to find that username then change the opnick field for it and the perms field


*spike falls over*
OK type in the username, permissions and nick....
MikePHP Code:<?
include "theme.php";
?>
<form action="addoppro.php" method="post">
Username: <input type="text" name="username"><br>
Permission: <input type="text" name="permission"><br>
Operator Nickname: <input type="text" name="opnick"><br>
<input type="Submit" value="Update">
</form>
addoppro:
<?
include "../db_connect.php";
include "theme.php";
$perms = $_POST['perms'];
$username=$_POST['username'];
$onpick = $_POST['onpick'];
$query = "UPDATE users SET username = '$username', perms = '$permission', opnick = '$opnick' WHERE username = '$username'";
mysql_query($query);
echo "Record Updated";
?>
Mike Swiffin - Community Team Leader
Only a woman can read between the lines of a one word answer.....
I started out with nothing... and still got most of it left!
I think you make an error.Originally Posted by spikeZ
if $username was changed,then $username was not the username in database


in that case just remove username='$newusername' part from the query and just use the hidden username field and not text box for submitting username.
Note to spikeZ... guess i did it again... probably we both had the same idea... just that ur msg got published before me... sorry again mate!
Bookmarks