Insert if NOT EXISTS not working Announcing the arrival of Valued Associate #679: Cesar...
Models of set theory where not every set can be linearly ordered
What makes black pepper strong or mild?
How to recreate this effect in Photoshop?
Did Kevin spill real chili?
What happens to sewage if there is no river near by?
How widely used is the term Treppenwitz? Is it something that most Germans know?
Does surprise arrest existing movement?
Is there a "higher Segal conjecture"?
Java 8 stream max() function argument type Comparator vs Comparable
Gastric acid as a weapon
What are the motives behind Cersei's orders given to Bronn?
Stars Make Stars
How do I mention the quality of my school without bragging
What is the longest distance a 13th-level monk can jump while attacking on the same turn?
Is there a concise way to say "all of the X, one of each"?
When to stop saving and start investing?
When -s is used with third person singular. What's its use in this context?
What are the pros and cons of Aerospike nosecones?
Should I call the interviewer directly, if HR aren't responding?
How much radiation do nuclear physics experiments expose researchers to nowadays?
Why are there no cargo aircraft with "flying wing" design?
Should I discuss the type of campaign with my players?
Storing hydrofluoric acid before the invention of plastics
Letter Boxed validator
Insert if NOT EXISTS not working
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)phpMyAdmin Error After Upgrade to 3.5.8.1Returning true or false in a custom functionFederated table of two LEFT JOIN tables not workingCreate Trigger MySql update or insert in another tableError in IF statement in MySQLDon't know why MySQL is not creating table with primary key constraintMySQL stored procedure returns nullWhy doesn't the following stored procedure compile with MySQL Workbench version 6.3.?Error 1064 - You have an error in your SQL syntax;Trying to run query and getting error: Error 1064 (42000)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am trying to copy data from table to another mysql table from two different databases
First I get all data from first table and stored them into php variable
then I loop on that var to insert data to the other table
using this query
INSERT INTO `users` (`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
VALUES ('$entity_id','$name','$firstname','$lastname','$email')
WHERE NOT EXISTS (SELECT `nUserId`,`vEmail`
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
but it's not working
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT `nUserId`,`vEmail` FROM users '
What the correct syntax to make this work ?
mysql php
add a comment |
I am trying to copy data from table to another mysql table from two different databases
First I get all data from first table and stored them into php variable
then I loop on that var to insert data to the other table
using this query
INSERT INTO `users` (`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
VALUES ('$entity_id','$name','$firstname','$lastname','$email')
WHERE NOT EXISTS (SELECT `nUserId`,`vEmail`
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
but it's not working
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT `nUserId`,`vEmail` FROM users '
What the correct syntax to make this work ?
mysql php
add a comment |
I am trying to copy data from table to another mysql table from two different databases
First I get all data from first table and stored them into php variable
then I loop on that var to insert data to the other table
using this query
INSERT INTO `users` (`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
VALUES ('$entity_id','$name','$firstname','$lastname','$email')
WHERE NOT EXISTS (SELECT `nUserId`,`vEmail`
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
but it's not working
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT `nUserId`,`vEmail` FROM users '
What the correct syntax to make this work ?
mysql php
I am trying to copy data from table to another mysql table from two different databases
First I get all data from first table and stored them into php variable
then I loop on that var to insert data to the other table
using this query
INSERT INTO `users` (`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
VALUES ('$entity_id','$name','$firstname','$lastname','$email')
WHERE NOT EXISTS (SELECT `nUserId`,`vEmail`
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
but it's not working
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE NOT EXISTS (SELECT `nUserId`,`vEmail` FROM users '
What the correct syntax to make this work ?
mysql php
mysql php
asked May 13 '15 at 15:26
Ashraf HefnyAshraf Hefny
13115
13115
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
You cannot use WHERE
clause in an INSERT
statement.
However, you may use INSERT IGNORE
if in your targer table you define nUserId or vEmail as unique keys.
More info about INSERT syntax: https://dev.mysql.com/doc/refman/5.6/en/insert.html
1
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."
– ypercubeᵀᴹ
May 13 '15 at 15:53
@Jehad Keriaki Thanks man it's working nowINSERT IGNORE INTO
users` SETnUserId
='$entity_id',vLoginName
='$name',vFirstName
='$firstname',vLastName
='$lastname',vEmail
='$email'`
– Ashraf Hefny
May 13 '15 at 15:59
As an advice, read my comment above and if you care for your data don't useINSERT IGNORE
. Either useINSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.
– ypercubeᵀᴹ
May 13 '15 at 16:02
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
add a comment |
I think the problem might be VALUES and I would write the statement as the following:
INSERT INTO `users`
(`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
SELECT
'$entity_id', '$name', '$firstname', '$lastname', '$email'
FROM dual
WHERE NOT EXISTS (SELECT *
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
The solution.
– Ring Ø
Sep 19 '18 at 3:11
add a comment |
you can try something like
delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from users where username = 'something') THEN
update users set id= 'some' where username = 'something';
ELSE
insert into users (username) values ('something');
END IF;
end $$
delimiter ;
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
add a comment |
No need to store them in php.
Creates a table excactly like the one specified, Note: copies only columns
CREATE TABLE tbl_name LIKE db_name.tbl_name;
If you want specific column names:
CREATE TABLE tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
Then if you want to copy all the data do
INSERT INTO tbl_name SELECT * FROM db_name.tbl_name;
Or specific column data do
INSERT INTO tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
If you want specific data add a WHERE clause.
add a comment |
$existeEmail=$mysqli->query("SELECT * FROM tb_users WHERE email = '$email'");
if(!$existeEmail=mysqli_fetch_array($existeEmail))/si existe en la tabla tblreseteopass/
{
}else{
$email = $existeEmail['email'];
// Direccionado hacia el registro con la Alerta 001
// ya existe una cuenta asociada a este email, si no recuerda la contraseña, solicite una nueva
header("Location: https://www.yourpage.com/b/?m=f_lg);
}
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f101413%2finsert-if-not-exists-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
You cannot use WHERE
clause in an INSERT
statement.
However, you may use INSERT IGNORE
if in your targer table you define nUserId or vEmail as unique keys.
More info about INSERT syntax: https://dev.mysql.com/doc/refman/5.6/en/insert.html
1
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."
– ypercubeᵀᴹ
May 13 '15 at 15:53
@Jehad Keriaki Thanks man it's working nowINSERT IGNORE INTO
users` SETnUserId
='$entity_id',vLoginName
='$name',vFirstName
='$firstname',vLastName
='$lastname',vEmail
='$email'`
– Ashraf Hefny
May 13 '15 at 15:59
As an advice, read my comment above and if you care for your data don't useINSERT IGNORE
. Either useINSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.
– ypercubeᵀᴹ
May 13 '15 at 16:02
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
add a comment |
You cannot use WHERE
clause in an INSERT
statement.
However, you may use INSERT IGNORE
if in your targer table you define nUserId or vEmail as unique keys.
More info about INSERT syntax: https://dev.mysql.com/doc/refman/5.6/en/insert.html
1
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."
– ypercubeᵀᴹ
May 13 '15 at 15:53
@Jehad Keriaki Thanks man it's working nowINSERT IGNORE INTO
users` SETnUserId
='$entity_id',vLoginName
='$name',vFirstName
='$firstname',vLastName
='$lastname',vEmail
='$email'`
– Ashraf Hefny
May 13 '15 at 15:59
As an advice, read my comment above and if you care for your data don't useINSERT IGNORE
. Either useINSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.
– ypercubeᵀᴹ
May 13 '15 at 16:02
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
add a comment |
You cannot use WHERE
clause in an INSERT
statement.
However, you may use INSERT IGNORE
if in your targer table you define nUserId or vEmail as unique keys.
More info about INSERT syntax: https://dev.mysql.com/doc/refman/5.6/en/insert.html
You cannot use WHERE
clause in an INSERT
statement.
However, you may use INSERT IGNORE
if in your targer table you define nUserId or vEmail as unique keys.
More info about INSERT syntax: https://dev.mysql.com/doc/refman/5.6/en/insert.html
answered May 13 '15 at 15:35
Jehad KeriakiJehad Keriaki
2,6631813
2,6631813
1
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."
– ypercubeᵀᴹ
May 13 '15 at 15:53
@Jehad Keriaki Thanks man it's working nowINSERT IGNORE INTO
users` SETnUserId
='$entity_id',vLoginName
='$name',vFirstName
='$firstname',vLastName
='$lastname',vEmail
='$email'`
– Ashraf Hefny
May 13 '15 at 15:59
As an advice, read my comment above and if you care for your data don't useINSERT IGNORE
. Either useINSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.
– ypercubeᵀᴹ
May 13 '15 at 16:02
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
add a comment |
1
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."
– ypercubeᵀᴹ
May 13 '15 at 15:53
@Jehad Keriaki Thanks man it's working nowINSERT IGNORE INTO
users` SETnUserId
='$entity_id',vLoginName
='$name',vFirstName
='$firstname',vLastName
='$lastname',vEmail
='$email'`
– Ashraf Hefny
May 13 '15 at 15:59
As an advice, read my comment above and if you care for your data don't useINSERT IGNORE
. Either useINSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.
– ypercubeᵀᴹ
May 13 '15 at 16:02
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
1
1
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."– ypercubeᵀᴹ
May 13 '15 at 15:53
INSERT IGNORE
can also have unwanted side effects in other cases (values not good for the columns, etc.) It may not be the best choice. In your link: "Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort."– ypercubeᵀᴹ
May 13 '15 at 15:53
@Jehad Keriaki Thanks man it's working now
INSERT IGNORE INTO
users` SET nUserId
='$entity_id', vLoginName
='$name', vFirstName
='$firstname', vLastName
='$lastname', vEmail
='$email'`– Ashraf Hefny
May 13 '15 at 15:59
@Jehad Keriaki Thanks man it's working now
INSERT IGNORE INTO
users` SET nUserId
='$entity_id', vLoginName
='$name', vFirstName
='$firstname', vLastName
='$lastname', vEmail
='$email'`– Ashraf Hefny
May 13 '15 at 15:59
As an advice, read my comment above and if you care for your data don't use
INSERT IGNORE
. Either use INSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.– ypercubeᵀᴹ
May 13 '15 at 16:02
As an advice, read my comment above and if you care for your data don't use
INSERT IGNORE
. Either use INSERT ... ON DUPLICATE KEY UPDATE
or the query by @SQLHound.– ypercubeᵀᴹ
May 13 '15 at 16:02
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
If you don't believe me, read this answer by Bill Karwin: “INSERT IGNORE” vs “INSERT … ON DUPLICATE KEY UPDATE”
– ypercubeᵀᴹ
May 13 '15 at 16:05
add a comment |
I think the problem might be VALUES and I would write the statement as the following:
INSERT INTO `users`
(`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
SELECT
'$entity_id', '$name', '$firstname', '$lastname', '$email'
FROM dual
WHERE NOT EXISTS (SELECT *
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
The solution.
– Ring Ø
Sep 19 '18 at 3:11
add a comment |
I think the problem might be VALUES and I would write the statement as the following:
INSERT INTO `users`
(`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
SELECT
'$entity_id', '$name', '$firstname', '$lastname', '$email'
FROM dual
WHERE NOT EXISTS (SELECT *
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
The solution.
– Ring Ø
Sep 19 '18 at 3:11
add a comment |
I think the problem might be VALUES and I would write the statement as the following:
INSERT INTO `users`
(`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
SELECT
'$entity_id', '$name', '$firstname', '$lastname', '$email'
FROM dual
WHERE NOT EXISTS (SELECT *
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
I think the problem might be VALUES and I would write the statement as the following:
INSERT INTO `users`
(`nUserId`, `vLoginName`, `vFirstName`, `vLastName`, `vEmail`)
SELECT
'$entity_id', '$name', '$firstname', '$lastname', '$email'
FROM dual
WHERE NOT EXISTS (SELECT *
FROM `users`
WHERE `nUserId`='$entity_id'
AND `vEmail` = '$email')
edited May 13 '15 at 15:46
ypercubeᵀᴹ
78.6k11137221
78.6k11137221
answered May 13 '15 at 15:44
SQLHoundSQLHound
251213
251213
The solution.
– Ring Ø
Sep 19 '18 at 3:11
add a comment |
The solution.
– Ring Ø
Sep 19 '18 at 3:11
The solution.
– Ring Ø
Sep 19 '18 at 3:11
The solution.
– Ring Ø
Sep 19 '18 at 3:11
add a comment |
you can try something like
delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from users where username = 'something') THEN
update users set id= 'some' where username = 'something';
ELSE
insert into users (username) values ('something');
END IF;
end $$
delimiter ;
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
add a comment |
you can try something like
delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from users where username = 'something') THEN
update users set id= 'some' where username = 'something';
ELSE
insert into users (username) values ('something');
END IF;
end $$
delimiter ;
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
add a comment |
you can try something like
delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from users where username = 'something') THEN
update users set id= 'some' where username = 'something';
ELSE
insert into users (username) values ('something');
END IF;
end $$
delimiter ;
you can try something like
delimiter $$
create procedure select_or_insert()
begin
IF EXISTS (select * from users where username = 'something') THEN
update users set id= 'some' where username = 'something';
ELSE
insert into users (username) values ('something');
END IF;
end $$
delimiter ;
answered May 13 '15 at 16:17
Bill N. VarelliBill N. Varelli
5091417
5091417
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
add a comment |
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
Good solution: easy to understand and read
– Julian
Sep 12 '16 at 9:44
add a comment |
No need to store them in php.
Creates a table excactly like the one specified, Note: copies only columns
CREATE TABLE tbl_name LIKE db_name.tbl_name;
If you want specific column names:
CREATE TABLE tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
Then if you want to copy all the data do
INSERT INTO tbl_name SELECT * FROM db_name.tbl_name;
Or specific column data do
INSERT INTO tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
If you want specific data add a WHERE clause.
add a comment |
No need to store them in php.
Creates a table excactly like the one specified, Note: copies only columns
CREATE TABLE tbl_name LIKE db_name.tbl_name;
If you want specific column names:
CREATE TABLE tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
Then if you want to copy all the data do
INSERT INTO tbl_name SELECT * FROM db_name.tbl_name;
Or specific column data do
INSERT INTO tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
If you want specific data add a WHERE clause.
add a comment |
No need to store them in php.
Creates a table excactly like the one specified, Note: copies only columns
CREATE TABLE tbl_name LIKE db_name.tbl_name;
If you want specific column names:
CREATE TABLE tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
Then if you want to copy all the data do
INSERT INTO tbl_name SELECT * FROM db_name.tbl_name;
Or specific column data do
INSERT INTO tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
If you want specific data add a WHERE clause.
No need to store them in php.
Creates a table excactly like the one specified, Note: copies only columns
CREATE TABLE tbl_name LIKE db_name.tbl_name;
If you want specific column names:
CREATE TABLE tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
Then if you want to copy all the data do
INSERT INTO tbl_name SELECT * FROM db_name.tbl_name;
Or specific column data do
INSERT INTO tbl_name SELECT column_name, column_name FROM db_name.tbl_name;
If you want specific data add a WHERE clause.
answered Jan 15 '16 at 13:25
Martin CzechMartin Czech
112
112
add a comment |
add a comment |
$existeEmail=$mysqli->query("SELECT * FROM tb_users WHERE email = '$email'");
if(!$existeEmail=mysqli_fetch_array($existeEmail))/si existe en la tabla tblreseteopass/
{
}else{
$email = $existeEmail['email'];
// Direccionado hacia el registro con la Alerta 001
// ya existe una cuenta asociada a este email, si no recuerda la contraseña, solicite una nueva
header("Location: https://www.yourpage.com/b/?m=f_lg);
}
New contributor
add a comment |
$existeEmail=$mysqli->query("SELECT * FROM tb_users WHERE email = '$email'");
if(!$existeEmail=mysqli_fetch_array($existeEmail))/si existe en la tabla tblreseteopass/
{
}else{
$email = $existeEmail['email'];
// Direccionado hacia el registro con la Alerta 001
// ya existe una cuenta asociada a este email, si no recuerda la contraseña, solicite una nueva
header("Location: https://www.yourpage.com/b/?m=f_lg);
}
New contributor
add a comment |
$existeEmail=$mysqli->query("SELECT * FROM tb_users WHERE email = '$email'");
if(!$existeEmail=mysqli_fetch_array($existeEmail))/si existe en la tabla tblreseteopass/
{
}else{
$email = $existeEmail['email'];
// Direccionado hacia el registro con la Alerta 001
// ya existe una cuenta asociada a este email, si no recuerda la contraseña, solicite una nueva
header("Location: https://www.yourpage.com/b/?m=f_lg);
}
New contributor
$existeEmail=$mysqli->query("SELECT * FROM tb_users WHERE email = '$email'");
if(!$existeEmail=mysqli_fetch_array($existeEmail))/si existe en la tabla tblreseteopass/
{
}else{
$email = $existeEmail['email'];
// Direccionado hacia el registro con la Alerta 001
// ya existe una cuenta asociada a este email, si no recuerda la contraseña, solicite una nueva
header("Location: https://www.yourpage.com/b/?m=f_lg);
}
New contributor
New contributor
answered 1 min ago
jorge mario saldarriaga r.jorge mario saldarriaga r.
1
1
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f101413%2finsert-if-not-exists-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown