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

  • Home
  • SEARCH
  • 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 9036389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:58:54+00:00 2026-06-16T08:58:54+00:00

This is my 2nd web app in CI. I am trying to grab a

  • 0

This is my 2nd web app in CI.

I am trying to grab a single value from a form (upon submit) and insert it into a database.

I have a controller “urlsubmission”:

<?php

class Urlsubmission extends CI_Controller{

    function index() {
          $this->load->model('domaincheckmodel');
          $this->domaincheckmodel->verifyduplicates();

    }
}
?>

a model (domaincheckmodel) – which searches the db for a any duplicates:

<?php

    class Domaincheckmodel extends CI_Model{

        function __construct(){
            // Call the Model constructor
            parent::__construct();
        }


        function verifyduplicates(){
            #PREPARE DATA
            $sql = "SELECT tld from ClientDomain WHERE tld = ?";
            $postedTLD = $_POST['urlInput'];    // Get unsanitized data
            $endquery = $this->db->query($sql,array($this->db->escape_str($postedTLD))); // Query db

            #CONDITION
            if($endquery->num_rows() > 0){
                $this->load->view('err/domainexists'); ##domain already used
                ## please login..
            } 

            else{ #number of rows must be 0, insert into db
                $newDomain = "INSERT INTO ClientDomain(tld) VALUES('".$this->db->escape_str($postedTLD)."')";
                $this->load->view('success/domainfree');
                ## please register
            }
        }    
    }

    ?>

and two silly views right now: domainexists and domainfree:

domainexists:

<h2>Domain Exists</h2>

domainfree:

<h2>Domain free</h2>

The problem is: when I run the script, there are no errors, but it is properly executing else{} block, but not inputting anything into the database.

I have setup config/autoload to autoload the db lib, like:

$autoload['libraries'] = array('database');

What am I doing wrong here?

  • 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-06-16T08:58:56+00:00Added an answer on June 16, 2026 at 8:58 am

    You aren’t running the SQL query. Do this.

    $newDomain = "INSERT INTO ClientDomain(tld) VALUES('".$this->db->escape_str($postedTLD)."')";
    $this->db->query($newDomain);
    

    or you can use simple_query()

    $newDomain = "INSERT INTO ClientDomain(tld) VALUES('".$this->db->escape_str($postedTLD)."')";
    $this->db->simple_query($newDomain);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to remove the 2nd commit to a repo. At this point I
I implemented single sign on by reading this article: http://www.codeproject.com/KB/web-security/aspnetsinglesignon.aspx However, I have a
My previous setup was a single web server and a single database server. I
I'm trying to create a small Web App to categorize certain type of YouTube
As part of a web app i am trying to build a registration process.
I don't get why it'd doing this with the 2nd feed (appearing as a
This is the example table: Column | 1st record | 2nd record | 3rd
Take a look at this: http://thebekker.dk/_skole/GFeksamen/ You can see the 2nd menu item show
For the 2nd <h3>World!</h3> in this sample scenario ( Please note <..> elements are
My code i use to parse HTMl is this below, and the 2nd code

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.