sofia403 Posted May 31, 2011 Share Posted May 31, 2011 Hi i was wondering what im doing wrong, im trying to insert a query for submit button, it works if i run it straight in mysql, but not working when linked through php. Im just doing it for testing purpose right now only, so when i see that it works i will use another query. here it is <?php include('config.php'); if($_SESSION['username']){ if(isset($_POST['ASubmit'])){ $query3=("update country set Status='test1' where Uname='Mclovin'");} echo '<td><form name="test" method="post" form id="form1"><label for="test">Status</label> <select name="Status"> <option value="">-----</option> <option value="In process" '.(($row['Status']=='In process')?'selected="selected"':'').'>In process</option> <option value="Approved" '.(($row['Status']=='Approved')?'selected="selected"':'').'>Approved</option> <option value="Denied" '.(($row['Status']=='Denied')?'selected="selected"':'').'>Denied</option> </select><input name="ASubmit" type="submit" value="Update">'; echo $row{'Status'}.'</td></form>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/ Share on other sites More sharing options...
cunoodle2 Posted May 31, 2011 Share Posted May 31, 2011 You never actually execute the query. See the manual on this .. http://php.net/manual/en/function.mysql-query.php Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223042 Share on other sites More sharing options...
Pikachu2000 Posted May 31, 2011 Share Posted May 31, 2011 You never actually execute the query in that code with mysql_query. Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223043 Share on other sites More sharing options...
Drummin Posted May 31, 2011 Share Posted May 31, 2011 Looks like you are also missing the action=\"processingpage.php\" on your form. If Just checking things out on the same page you can use the # sign. <form name=\"test\" method=\"post\" form id=\"form1\" action=\"#\" /> You also have nesting issue by placing </form> tag outside </td>. Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223058 Share on other sites More sharing options...
sofia403 Posted May 31, 2011 Author Share Posted May 31, 2011 yes, i just inserted that $result3=mysql_query($query3); and the query worked! thanks! what is processingpage.php? i dont have that at all. Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223061 Share on other sites More sharing options...
Drummin Posted May 31, 2011 Share Posted May 31, 2011 what is processingpage.php? i dont have that at all.Read... what is the form supposed to do or where is it being processed. The action directs the form to the page where it is being processed. I said, you can use the # if being processed on the same page or you can put the actual page name in there. Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223062 Share on other sites More sharing options...
sofia403 Posted May 31, 2011 Author Share Posted May 31, 2011 ok cool, thanks ! i keep that in mind. Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223067 Share on other sites More sharing options...
Drummin Posted May 31, 2011 Share Posted May 31, 2011 Fixed this as well? '</td></form>' to '</form></td>' Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223070 Share on other sites More sharing options...
sofia403 Posted May 31, 2011 Author Share Posted May 31, 2011 yes, i moved that around thanks Quote Link to comment https://forums.phpfreaks.com/topic/238017-running-mysql-query-in-php/#findComment-1223071 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.