how do i check if a value is in my table?
like this:
INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)
and check if those values are in the table.
kishou
0
Junior Poster in Training
Recommended Answers
Jump to PostYou need to do a select query..
select * from table_name where column1="value1" and column2="value2" ...
The answers to these sort of questions are in php/mysql tutorials all over the internet.
Jump to Postthanks dude! So then it would look like this?
$res=mysql_query("SELECT * FROM registered_members=$_POST['Username']"); if (mysql_num_rows($res)>0) { echo "Username is already taken!"; } else {
ok then i get this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource.Thats because, you have your query wrong. Its …
Jump to PostCan you show us your script ?
Jump to Postyea dont copy it though. please.
Dude! I can write my own script.. :D Anyway, here is the error..
$res=mysql_query("SELECT * FROM mailing_list where Email=$_POST[email]");
This should have been$res=mysql_query("SELECT * FROM mailing_list where Email='".$_POST[email]."'");
You should put your variable name in single quote if its a string.Cheers,
…
Jump to PostOk. I see the error. Its your select_db string.
mysql_select_db("kishou_website", $connect);/
Its after your query. Put it above the query. :) This should fix it.
All 17 Replies
MickRip
0
Newbie Poster
vssp
-5
Junior Poster
kishou
0
Junior Poster in Training
kishou
0
Junior Poster in Training
vssp
-5
Junior Poster
kishou
commented:
Helped me alot with mysql!
+1
kishou
0
Junior Poster in Training
vssp
-5
Junior Poster
kishou
0
Junior Poster in Training
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
kishou
0
Junior Poster in Training
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
kishou
0
Junior Poster in Training
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
kishou
0
Junior Poster in Training
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
kishou
commented:
just keeps on helping!
+1
kishou
0
Junior Poster in Training
nav33n
472
Purple hazed!
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.