bombardos Posted September 20, 2005 Share Posted September 20, 2005 Hi, First time here, long time geek. I've been mulling over a problem for the last couple of days, and thought it was time to look for a little help in the right direction. Basically, I have an admin page with a list of registered users details in a dynamic table. In one of the fields, called "status", I have 2 buttons each in their own form that when one is clicked, goes to a mailer1.php and is supposed to send the email in mailer1.php to the user in the row of the dynamic table and update the status field in the mysql database. And when the other is clicked, goes to mailer2.php and does the same. The forms with the buttons is here http://croc.ftw.net.nz/extras/form.txt and works as far as going to the mailers.php The mailers.php of which there are 2 different versions (out of the many that I have tried :/ ) are here http://croc.ftw.net.nz/extras/2.txt and here http://croc.ftw.net.nz/extras/3.txt They both disply no errors when initiated, but then they both do nothing, niether send the email, nor update the database. Any directional help would be appreciated. Am I going in the right direction? Can you see any huge errors? Is there lots of code missing? Need any more info? Quote Link to comment Share on other sites More sharing options...
bombardos Posted September 20, 2005 Author Share Posted September 20, 2005 Also, Ive tried adding the Dreamweaver recordset to the page which adds <?php require_once('../Connections/dbcon.php'); ?> <?php mysql_select_db($database_dbcon, $dbcon); $query_Recordset1 = "SELECT * FROM users"; $Recordset1 = mysql_query($query_Recordset1, $dbcon) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> to the top of the page, and <?php mysql_free_result($Recordset1); ?> to the bottom, but then I get the error "Warning: mysql_free_result(): 7 is not a valid MySQL result resource in /home/croc/public_html/admin/mailerApprove.php on line 64 Line 64 is the mysql_free_result($Recordset1); Quote Link to comment Share on other sites More sharing options...
Mattyspatty Posted September 21, 2005 Share Posted September 21, 2005 *slap* name="Submit" on your mailing.php but on mailing1 and 2 u used $_POST['submit'] CAPITALS MATTER!! Quote Link to comment Share on other sites More sharing options...
bombardos Posted September 21, 2005 Author Share Posted September 21, 2005 Yes I noticed that after posting and changed it in the form from capital S to lowercase. Made no difference, so reshuffled it a little and am now here: <? // Update info on the Database. mysql_connect($myhost,$myusername,$mypass); @mysql_select_db($dbname); $sql = mysql_query("UPDATE users SET approved='No' WHERE 'userid' = '$userid'") or die (mysql_error()); // Define post fields into simple variables. $userid = $_POST['userid']; $username = $_POST['username']; $name = $_POST['name']; $email = $_POST['email']; $approved = $_POST['approved']; if(!$sql){ echo 'error....blah.'; } else { if(isset($_POST['submit'])) { $userid = $_POST['hiddenField']; // Email the user! $subject = "subject in here"; $message = "Hi $username, blah blah blah with the following information: Username: $username Real Name: $name Email: $email Clan: $clan Body of messege. blah blah blah This is an automated response, please do not reply!"; mail($email, $subject, $message, "From: Me <me@me.com"); } include 'admin.php'; } ?> which now gives me a "No Database Selected". So, that would explain it not updating the database O_o, but its confused me as to why its not selecting the database. Quote Link to comment Share on other sites More sharing options...
bombardos Posted September 23, 2005 Author Share Posted September 23, 2005 All fixed and working now. Quote Link to comment 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.