PHP and MySQL SELECT problem.

Posted by R.I.P.coalMINERS on Stack Overflow See other posts from Stack Overflow or by R.I.P.coalMINERS
Published on 2010-04-26T13:46:35Z Indexed on 2010/04/26 14:03 UTC
Read the original article Hit count: 190

Filed under:
|

Trying to check if a name is already stored in the database from the login user. The name is a set of dynamic arrays entered by the user threw a set of dynamic form fields added by the user. Can some show me how to check and see if the name is already entered by the login user? I know my code can't be right. Thanks!

MySQL code.

SELECT * 
FROM names 
WHERE name = '" . $_POST['name'] . "' 
AND userID = '$userID'

Here is the MySQL table.

CREATE TABLE names (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
userID INT NOT NULL,
name VARCHAR(255) NOT NULL,
meaning VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql