PHPlandman Posted February 15, 2011 Share Posted February 15, 2011 Hello there i need a little help as im very new to php and i need a little help on something. I need some code that will display an error message or a html form depending on what is or isnt in the `value` feild of a table in a mysql database and these are the values i have to use in the table of the mysql database. Well the ones i wish to use anyway `user_id``value``created_at` these are the total that can be used `id``field_id``user_id``value``created_at` What it is i want to do is if the value of `value` is empty show a html form and if the value of `value` has data in it then show/echo an error message that i can use a CSS <DIV> class in saying "Sorry you already have `value` that you created on `created_at` Thanks for the help in advance! Quote Link to comment https://forums.phpfreaks.com/topic/227706-need-a-little-help-with-some-code-from-a-more-experienced-php-coder/ Share on other sites More sharing options...
jankidudel Posted February 17, 2011 Share Posted February 17, 2011 $query = "SELECT `value` FROM your_table WHERE ......."; $query_result = mysql_query($query) or die(mysql_error().' on line '.__LINE__); if(mysql_num_rows($query_result) > 0) echo "error"........................... else echo "<input type............... Quote Link to comment https://forums.phpfreaks.com/topic/227706-need-a-little-help-with-some-code-from-a-more-experienced-php-coder/#findComment-1175576 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.