1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Newbie Needs Help Setting Up Tables

Discussion in 'Databases' started by VanceVP, Jan 12, 2017.

  1. #1
    I am trying to get a program to run on my website and it requires a database. Part of the installation requires setting up tables in the database and I have no clue how to do this.
    SEMrush
    Is this the right place to ask for help? Is there someone that can take me through setting up these few tables so I can get this program working?

    My thanks in advance . . .
     
    VanceVP, Jan 12, 2017 IP
    SEMrush
  2. sarahk

    sarahk iTamer Staff

    Messages:
    23,633
    Likes Received:
    3,191
    Best Answers:
    89
    Trophy Points:
    615
    #2
    Your hosting company should provide access to a page called phpMyAdmin and from there it's pretty intuitive. Is your question more about the types of columns you need to create and how to structure your tables so that they link together nicely?
     
    sarahk, Jan 12, 2017 IP
  3. VanceVP

    VanceVP Member

    Messages:
    107
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    33
    #3
    Actually, after some experimenting, I think I got the tables set up, but when I enter the program, I am getting what I think is an error:

    Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /web/sites/pimpdaddy/thecoolestgadgetz.com/sml15/admin/config.inc.php on line 134

    And I have no clue what it means.

    Below is the file in question:
    
    
    <?
    /*
    ----------------------------------------
    Simple Mailing List - Configuration file
    ----------------------------------------
    The variables below are used for
    configuring Simple Mailing List.
    ----------------------------------------
    */
    
    
    // ----------------------------------------------------
    // 1. Database configuration variables (All required)
    // ----------------------------------------------------
    
    // Your database server (usually localhost)
    $config['db_server'] = "localhost";
    
    // A user that has access to your database
    $config['db_user'] = "xxxxxxxxxx";
    
    // The password for the user that has access to your database
    $config['db_password'] = "xxxxxxxxx";
    
    // The name of the database
    $config['db_name'] = "xxxxxxxxxxx";
    
    
    // -----------------------------------------------
    // 2. List configuration variables (All required)
    // -----------------------------------------------
    
    // The name of your list. This will appear in the confirmation email body and subject line.
    $config['list_name'] = "Our Monthly Newsletter";
    
    // The email address of the list owner. Messages will be sent from this address.
    $config['owner_email'] = "newsletter@xxxxxxxxx.com";
    
    // 0 or 1. Make this a 1 if you would like to receive an email every time someone confirms their subscription.
    $config['notify_on_confirm'] = 1;
    
    // 0 or 1. Make this a 1 if you would like to receive an email every time someone unsubscribes.
    $config['notify_on_unsub'] = 1;
    
    // 0 or 1. Make this a 1 if you would like the user to receive an email after they confirm their subscription.
    $config['notify_user_on_confirm'] = 1;
    
    // 0 or 1. Make this a 1 if you would like the user to receive an email after they unsubscribe.
    $config['notify_user_on_unsub'] = 1;
    
    // URL to the page that contains your subscribe/unsubscribe form.
    $config['unsub_url'] = "http://xxxxxxxxxxxx.com";
    
    // Default message format (0=text, 1=html).
    $config['default_format'] = 0;
    
    
    // --------------------------------
    // 3. Queue configuration variables
    // --------------------------------
    
    // Using a queue sends your message to each member individually. Not using the queue builds a list of addresses
    // and sends your message to the list in the Bcc (blind carbon copy) field.
    $config['use_queue'] = true;
    
    // The number of email messages to send (per pass) when using the queue feature.
    $config['queue_size'] = 1000;
    
    
    // -------------------------------
    // 4. Bounce maintenance variables
    // -------------------------------
    
    // 0 or 1. Set to zero to disable bounce checking, 1 to enable.
    $config['check_bounces'] = 0;
    
    // Email address (account) of mailbox to check for bounces
    $config['bounce_mailbox'] = "";
    
    // Password for above mailbox (account)
    $config['bounce_password'] = "";
    
    
    // -------------------------
    // 5. Remote relay variables
    // -------------------------
    
    // 0 or 1. Set to zero to disable remote relay, 1 to enable.
    $config['allow_relay'] = 0;
    
    // An array of email addresses from which SML will relay messages. Leave empty to accept from any address.
    $config['allow_relay_from'] = array();
    
    // Email address (account) of mailbox to check for messages to relay
    $config['relay_mailbox'] = "";
    
    // Password for above mailbox (account)
    $config['relay_password'] = "";
    
    
    // -------------------------------
    // 6. SMTP configuration variables
    // -------------------------------
    
    // 0 or 1. Whether to use SMTP(1) or sendmail(0). The default is sendmail(0).
    $config['use_SMTP'] = 0;
    
    // The SMTP server. For secure connections use the format ssl://smtp.gmail.com
    $config['smtp_server'] = "smtp.xxxxxxxxxxx.net";
    
    // The domain you're sending from. Localhost is usually fine
    $config['smtp_domain'] = "localhost";
    
    // The email address associated with the SMTP account
    $config['smtp_from_address'] = "newsletter@xxxxxxxxxxx.com";
    
    // The SMTP username. Commonly the email address
    $config['smtp_username'] = "xxxxxxxxxx";
    
    // The SMTP password
    $config['smtp_password'] = "xxxxxxxxxxx";
    
    // The port to connect to your SMTP server on. Usually 25, 465, or 587
    $config['smtp_port'] = "25";
    
    /*
    ----------------------------------------
    That's it! Anything following this code
    should not be changed unless you are
    comfortable modifying PHP.
    ----------------------------------------
    */
    
    $connection = mysql_connect($config['db_server'], $config['db_user'], $config['db_password']) or die("Could not connect : " . mysql_error());
    mysql_select_db($config['db_name']) or die("Could not select database");
    
    require_once("lang.inc.php");
    define('SML_EOL', "\r\n");
    
    function insert_message($subject,$message,$curr_timestamp,$queue_timestamp,$sent_count,$texthtml)
    {
        if (((!empty($_GET) Or !empty($_POST)) And get_magic_quotes_gpc()) Or get_magic_quotes_runtime()) // Quotes in the message are automatically being escaped
        {
            $subject = strip_tags($subject);
        }
        else
        {
            $message = addslashes($message);
            $subject = strip_tags(addslashes($subject));
        }
        $query = "INSERT INTO mailinglist_messages (subject,message,created,queued,count,format) VALUES ('$subject','$message','$curr_timestamp','$queue_timestamp','$sent_count','$texthtml')";
        $result = mysql_query($query) or die("Query failed : " . mysql_error());
        return mysql_insert_id();
    }
    
    function get_confirmed_members()
    {
        $address_query = "SELECT address FROM mailinglist_subscribers WHERE confirmed = '1'";
        $address_result = mysql_query($address_query) or die("Query failed[gfm] : " . mysql_error());
        return $address_result;
    }
    
    function insert_recipients_into_queue($message_id,$address_row,$queue_timestamp)
    {
        $queue_insert_query = "INSERT INTO mailinglist_queue (message_id,address,send_after) VALUES ('$message_id','$address_row','$queue_timestamp')";
        $queue_insert_result = mysql_query($queue_insert_query) or die("Query failed[iriq] : " . mysql_error());
        return $queue_insert_result;
    }
    ?>
    
    Code (markup):
    I have obviously removed sensitive information such as user names and passwords as well as my service provider for the smtp info.

    Can someone take a look at this and tell me what the Deprecated thing means and based on the message I am getting, what I can do to fix it?

    Thanks again . . .
     
    VanceVP, Jan 12, 2017 IP
  4. mmerlinn

    mmerlinn Well-Known Member

    Messages:
    1,526
    Likes Received:
    163
    Best Answers:
    5
    Trophy Points:
    190
    #4
    Deprecated means old, no longer supported, and will eventually be removed. So, anything using deprecated code, even if it accidentally works today, will not work sometime in the future. The solution is to use more modern code which for the forseeable future will continue to work as expected.
     
    mmerlinn, Jan 28, 2017 IP
  5. vyctarpytar

    vyctarpytar Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    use mysqli_connect() instead of mysql_connect().
     
    vyctarpytar, Jun 19, 2017 IP
  6. GameO.Over

    GameO.Over Active Member

    Messages:
    45
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    65
    #6
    mysql_connect() is an old PHP function which is why you're getting this warning.

    I'm assuming you are using 3rd party software, if so, you probably shouldn't use it as it looks like it has not been updated for quite some time.

    However, you can disable this warning by adding the following code to the top of your PHP script

    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
    PHP:
    Not really recommended but it will hide the warning.

    If you have the experience you can alter the script to use mysqli_connect() or better yet PDO.
     
    GameO.Over, Jun 19, 2017 IP