Jump to content

Recommended Posts

i trying to make a php admin panel. it will have textboxs for firstname ,lastname ,username ,and permissions. I set up the page and it can grab the data from the mysql server and place it in the textboxs but when i try to send the submitted edits to the Mysql server its not changing the row.

 

here is the code i am using to send the data

 

$sql = "UPDATE `Users` SET `username` = $muser, `firstname` = $mfname, `lastname` = $mlname, `permission` = $mau WHERE `username` =$oun";[code]

also deleting

[code]$query = "DELETE FROM `Users` WHERE `username` = $oun"

 

any help would be loved[/code][/code]

Link to comment
https://forums.phpfreaks.com/topic/118121-php-sql-help/
Share on other sites

when you do your mysql_query() add or die(mysql_error()) at the end...

 

mysql_query(**stuffhere**) or die(mysql_error());

 

But, looking at your code, if you didn't pre-quote around the input variables that are non-int you'll want to quote them, eg...

 

`firstname` = '$mfname'

 

I'll accept my love in hug form.

Link to comment
https://forums.phpfreaks.com/topic/118121-php-sql-help/#findComment-607730
Share on other sites

You got it all wrong!!!

 

It should be like this

$sql = "UPDATE `Users` SET username = '$muser', firstname = '$mfname', lastname = '$mlname', permission = '$mau' WHERE username ='$oun' ";

 

also when you execute your query put

or die (mysql_error());

 

So you could see the error you are getting

Link to comment
https://forums.phpfreaks.com/topic/118121-php-sql-help/#findComment-607731
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.