Answer the question
In order to leave comments, you need to log in
How to move a field from one table to another SQL?
I have a db with a table. Let's take "un_names" as an example. Table "registered_names". Everything is clear so far. Someone registers, he is in the "un_names" table, after validation in " registered_names ". This is the query I use, to determine who has registred, we take a request for a random sample.
Insert into "registered_names" 1 a random name from "un_names" :
INSERT INTO registered_names SELECT DISTINCT * FROM un_names WHERE un_name.name = name ORDER BY RAND( ) LIMIT 1
Display who has registered:
echo $row["name"]." Moved " ;
And delete from the old table:
DELETE FROM un_names WHERE id = un_name.name = name
$stmt = $db->query('
echo $row["name"]." Moved";
$stmt = $db->query(' DELETE FROM names WHERE names.name= name ');
Please tell me why it doesn't work? - SQLSTATE[HY000]: General error - basically knocks out this error.
Answer the question
In order to leave comments, you need to log in
Well, for starters, post a request through phpmyadmin, see where it crashes, if it doesn’t crash, the issue with requests will disappear and you need to dig in the direction of connection and other trim.
Step by step:
- launch the first request (look or passed, take the value returned.)
- launch the second request with the received parameter.
- if everything works from requests - dig the connection, there is no implementation description here, so think for yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question