Jump to content

bombardos

Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Posts posted by bombardos

  1. 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.

  2. 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);

  3. Would be easiest to create new tables on your server, unless you can copy paste the mysql script used to create the tables into notepad and save them as tableName.sql. Then in phpAdmin there shold be and option there (I think under SQL option) to upload your sql files which will create them for you.

     

    Your host should have already given you a database to use, you would then just have to change you code in you Connections/dbconnect.php file to match the name of the database ($database_dbconnect = nameOfDatabaseOnPHPAdmin) and any other file containing a connection to the database (use Dreamweavers Find and Replace), usually the name of the $hostname in your dbconnect.php will remain as localhost. You'll know this when you log in to phpAdmin, it'll say MySQL 4.0.22 running on localhost as yourusername@localhost.

  4. 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?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.