Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

mysql replace/update????????

Posted on 2002-05-03
4
Medium Priority
?
186 Views
Last Modified: 2006-11-17
i need a query to replace first_name and surname on my candidates table on my database where email is = to $email

i have tried to write it, but mines says error. Can someone do it for me its frying my brain.

$query=
0
Comment
Question by:owarnes
2 Comments
 
LVL 32

Accepted Solution

by:
Batalf earned 200 total points
ID: 6989303
Something like this?

mysql_query("update candate set firstname='$newFirstname',lastname='$newLastname' where email = '$email'");

??
0
 
LVL 2

Expert Comment

by:jpoesen
ID: 6989611
yep, that should do it.

owarnes, don't forget to put single quotes around variables you insert in a sql query :

$query = "select * from T1 where name=$namevar"
-> will NOT work

$query = "select * from T1 where name='$namevar' "
-> will work.

Good luck
jpoesen

 
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question