whelpton Posted July 23, 2008 Share Posted July 23, 2008 Ok, I need to check my mysql database to check if referused=1 and if it does the user cannot continue. Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/ Share on other sites More sharing options...
revraz Posted July 23, 2008 Share Posted July 23, 2008 Read the field and do a check on it... Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-597994 Share on other sites More sharing options...
whelpton Posted July 23, 2008 Author Share Posted July 23, 2008 im not sure how to do that Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-597996 Share on other sites More sharing options...
dezkit Posted July 23, 2008 Share Posted July 23, 2008 phpmyadmin Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-597997 Share on other sites More sharing options...
whelpton Posted July 23, 2008 Author Share Posted July 23, 2008 I take it would be something along the lines of mysql_query("SELECT referused FROM Users WHERE id = '$refer'") or die(mysql_error()); but how do i stop the code from continueing if referused is 1? Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-597999 Share on other sites More sharing options...
dezkit Posted July 23, 2008 Share Posted July 23, 2008 <?php // conection mysql_query("SELECT referused FROM Users WHERE id = '$refer'") or die(mysql_error()); if($refer == "1"){ // watever } else { echo "you cannot continue"; } ?> Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598002 Share on other sites More sharing options...
revraz Posted July 23, 2008 Share Posted July 23, 2008 This is what I would suggest. Look up some tutorials on MySQL and PHP, read how to connect to the DB and how to do SELECT statements. Read how to get values from fields and then use PHP to compare them. Look up the mysql_fetch command to get the results you need. And Dez, that wont work because you are comparing the ID to 0, not the referused value. Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598006 Share on other sites More sharing options...
whelpton Posted July 23, 2008 Author Share Posted July 23, 2008 Thanks dez, I can alter that to what I need Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598008 Share on other sites More sharing options...
dezkit Posted July 23, 2008 Share Posted July 23, 2008 This is what I would suggest. Look up some tutorials on MySQL and PHP, read how to connect to the DB and how to do SELECT statements. Read how to get values from fields and then use PHP to compare them. Look up the mysql_fetch command to get the results you need. And Dez, that wont work because you are comparing the ID to 0, not the referused value. fixed edit: ya whel. Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598009 Share on other sites More sharing options...
revraz Posted July 23, 2008 Share Posted July 23, 2008 No, I mean you are comparing the wrong variable. $refer is the user's id, not the referused value. Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598012 Share on other sites More sharing options...
whelpton Posted July 23, 2008 Author Share Posted July 23, 2008 well then could you help me out and say what the right code is, I have no clue how to make a variable from a mysql database, Ive only started working with them this week . Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598030 Share on other sites More sharing options...
whelpton Posted July 23, 2008 Author Share Posted July 23, 2008 anyone? Link to comment https://forums.phpfreaks.com/topic/116294-one-last-question-about-mysql/#findComment-598038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.