TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
waseem shaikh
NA
22
6.4k
how to use insert and select statement together
Jan 21 2014 1:03 AM
can any one tell me how to use insert and select statement together with in a same table in mysql.my query is this
INSERT
INTO `test` ( `id` , `UName` , `Password` )
SELECT
'', 'Ahmed', 'Ahmed123'
FROM test
but it will return more than one rows inserted.but when i try this
INSERT
INTO `test` ( `id` , `UName` , `Password` )
SELECT
'', 'Ahmed', 'Ahmed123'
FROM test
where id = 2;
it will return 0 row inserted .
my php code is this
$sql="INSERT into alumnireg(id,Fname,Mname,Lname,Email,Password)
select '','$fname','$mname','$lname','$email','$pass'
from alumnireg where Email = '$email' AND Password = '$pass'";
$result =mysql_query($sql);
confirm_query($result);
Reply
Answers (
4
)
Pivot Table or Cross Tab in PHP using MYSQL for attendance
check availability by date