Jump to content

PHP SQL help


arcset

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.