473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

NOt able to update existing data of a application form.

I am editing my application form.So what i am Doing telling you here..I am already logged in

* First of all i am giving a edit link(edit_profile1.php) on my home page
* NOw i am asking again for username and password so that unauthorized user can not making editing in your profile
* NOw on edit_profile1.php i am checking username and password sent by user to the username and password stored in database
* If username and password are correct then i am redirected to edit_profile2.php
* Here I am creating a form with same text boxes as i used in filling the application form(i am using same name for boxes).Here is a button with name update

For the last page edit_profile3.php i am giving coading here
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.     $con=mysql_connect("localhost","root","");
  4.         if(!$con)
  5.         {
  6.         die('Could Not Connect:'.mysql_error());
  7.         } 
  8.         mysql_select_db("tcs",$con);
  9.  
  10. $usr=$_POST["username"];                 
  11. $pwd=hash('sha1',$_POST['password']);   
  12.  
  13. $query="select * from employee where Username='$usr' and Password='$pwd'";   
  14.  
  15. $result=mysql_query($query,$con);
  16.  
  17.  
  18. if ($result) 
  19. {
  20.  
  21. $row=mysql_fetch_array($result);
  22. $sql="update employee set ($row['Username']=$usr,$row['Password']=$pwd)";
  23.  
  24. $deepak=mysql_query($sql,$con);
  25.  
  26. if($deepak)
  27. {
  28.     echo "Updation Successfull"
  29. }
  30.  
  31. }
  32. ?>
  33.  
Now when i excute this error is coming like this Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in F:\Study Material\Linux\xampp\htdocs\edit_profile3.php on line 21

Line number 21 is
$sql="update employee set ($row['Username']=$usr,$row['Password']=$pwd)";

NOw i am not getting where i am getting wrong.Plz also tell me is there any other method for updating application forms any another logic.Plz check out above.
Feb 5 '10 #1
4 2109
Dormilich
8,658 Expert Mod 8TB
one of the variable content’s could break your query string. hard to tell without the actual values.
Feb 5 '10 #2
this is the last file actaul code...u tell me what u want should i send all files
Feb 5 '10 #3
Dormilich
8,658 Expert Mod 8TB
I don’t need further files, it’s the sql string itself that makes the problems.

actually, this sql looks a bit twisted … and I don’t understand it’s purpose at all
Expand|Select|Wrap|Line Numbers
  1. $sql="update employee set ($row['Username']=$usr,$row['Password']=$pwd)";
Feb 5 '10 #4
Atli
5,058 Expert 4TB
Yea, be very very careful about using that SQL query. (Or rather; a working version of that SQL query). It has no WHERE or LIMIT clause, so it will update EVERY row in the table with those values.

But to fix the error:
Expand|Select|Wrap|Line Numbers
  1. $str = "This works: $_POST[stuff]";
  2. $str = "This doesn't: $_POST['stuff']";
  3. $str = "But this does: {$_POST['stuff']}";
  4.  
See the differences there?
If you want to include the quotes in the array element names inside a string, it needs to be wrapped in brackets: {}. If you do not use brackets, the elements can not be quoted.
Feb 5 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
10
by: Jim | last post by:
Hi, Let me explain how I'd generally do things. For a page where the user edits data, I'd generally call it something like editfred.php (for example), the page which updates the data would be...
2
by: Niyazi | last post by:
Hi, I have not understand the problem. Before all the coding with few application everything worked perfectly. Now I am developing Cheque Writing application and when the cheque is clear the...
0
by: Metal2You | last post by:
I'm working on an ASP.NET 2.0 application in Visual Studio 2005 that accesses a Sybase database back end. We're using Sybase SQL Anywhere 9.0.2.3228. I have installed and registered the Sybase...
3
by: jpr | last post by:
Hello, I know that this is not the rule but need some help. My datbase has three tables: MASTER TEMPLATES FORMS I have a form which is based on a table named MASTER. I have a primary key...
3
by: Roy | last post by:
Hi Access gurus, I have a A2K application.The data in the database is updated daily by a excel download.I have a master n related tables keyed in by a OrderID.I have a problem in updating data.If...
1
by: Shaun O''Callaghan | last post by:
Hi All, I have a typed dataset on a Windows form on Smart Device Application that displays data from a Sql Server Mobile database. The problem is, whenever I want to add a new record I first...
5
by: Marc Gravell | last post by:
In the following example, the Bindings don't update the UI if the property change is triggered from the non-UI thread - see the async button - from the listbox contents (and observation) the change...
2
by: hotflash | last post by:
Hi Master CroCrew, I found a good PURE ASP that will allow you to upload 10MB file to the server and the file contents such as Network, Author, Title, etc... will insert to MS Access at the same...
17
geolemon
by: geolemon | last post by:
This should be an easy one for anyone with basic forms experience (I'd hate for you guys to be bored!) :D I have a simple form, bound to a single table. I'd *like* the form to work this way:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.