Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6383489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:39:20+00:00 2026-05-25T02:39:20+00:00

Am pulling out my hairs trying to figure this out… <?php include(‘connection.php’); $template =

  • 0

Am pulling out my hairs trying to figure this out…

<?php
include('connection.php');

$template = $_GET['templateID'];
$campaign = $_GET['campaignID'];

// Grab everything in the campaign manager
$cm = mysql_query("SELECT * FROM campaign_manager WHERE campaign ='$campaign'") or die(mysql_error());

while($temp = mysql_fetch_array($cm)){
    //Checks if Template is already attached
    if($temp['paragraph'] == $template){
        echo 'Template is already attached - <a href="http://general:8888/templates">Back</a>';
    } else {
        if($temp['paragraph'] == '0' || $temp['paragraph'] == null ){
            mysql_query("UPDATE campaign_manager SET paragraph = '$template' WHERE campaign = '$campaign'") or die(mysql_error());
        }
        else {
            $geo = $temp['geo'];
            $list = $temp['list'];
            mysql_query("INSERT INTO campaign_manager(campaign,paragraph,geo,list) VALUES('$campaign','$template','$geo','$list')");
        }
    }
} 
?>

My first IF is checking for a DUP. If it isn’t it, it then checks if the field is either 0 or NULL. If THAT CHECK outs THEN it should add a new record into the ‘campaign manager’. Although currently its displaying the echo of the first IF & its adding the duplicate record into the campaign manager. Why & HOW is this happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:39:21+00:00Added an answer on May 25, 2026 at 2:39 am

    Wow, so after rethinking my code over the weekend. I came up with this…

    <?php
    include('connection.php');
    
    $template = $_GET['templateID'];
    $campaign = $_GET['campaignID'];
    
    // Grab everything in the campaign manager
    $cm = mysql_query("SELECT * FROM campaign_manager WHERE campaign ='$campaign'") or die(mysql_error());
    $match = 0;
    
    while($temp = mysql_fetch_array($cm)){
        if ($temp['paragraph'] == $template){
            echo 'Template is already attached - <a href="http://general:8888/templates">Back</a>';
            $match = 1;
        }
    }
    
    $geo = $temp['geo'];
    $list = $temp['list'];
    
    if ($match == 0){
        mysql_query("INSERT INTO campaign_manager(campaign,paragraph,geo,list) VALUES('$campaign','$template','$geo','$list')");
        header('Location: http://general:8888/templates/');
    }
    
    ?>
    

    It works finally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been pulling my hair out this morning trying to figure this out. I
I am pulling the hair out of my head trying to figure this one
I've been pulling my hair out for hours trying to figure this out. I
after pulling my hair out for two days trying to figure this issue out
I have been pulling out my hair trying to figure out why this is
I am pulling my hair out trying to figure this out because I had
I have been pulling my hair out trying to figure out what I can't
I have been pulling my hair out trying to solve this. What I am
This one has had me pulling out my hair. I've been trying to deserialize
Pulling my hair out on this one: I'm trying a simple redirect to home

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.