scarface83 Posted March 26, 2007 Share Posted March 26, 2007 Hi, what would query would i need to use to get php to check if the value set in a variable exits in the database and it if did echo the info otherwise go to another page ? Thanks Link to comment https://forums.phpfreaks.com/topic/44328-mysql-help/ Share on other sites More sharing options...
desithugg Posted March 26, 2007 Share Posted March 26, 2007 //database connection here $query = mysql_query("SELECT count(*) as id from table where something = '$whatever'") or die(mysql_error()); $row = mysql_fetch_array( $query ); $exists = $row["id"]; if($exists == "" OR $exists == "0") { echo "not found"; } else { return exists; } hope that helps Link to comment https://forums.phpfreaks.com/topic/44328-mysql-help/#findComment-215275 Share on other sites More sharing options...
scarface83 Posted March 26, 2007 Author Share Posted March 26, 2007 thanks Link to comment https://forums.phpfreaks.com/topic/44328-mysql-help/#findComment-215282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.