Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying CodeIgniter Web Application Blueprints
  • Table Of Contents Toc
  • Feedback & Rating feedback
CodeIgniter Web Application Blueprints

CodeIgniter Web Application Blueprints

By : Robert Foster
3.8 (6)
close
close
CodeIgniter Web Application Blueprints

CodeIgniter Web Application Blueprints

3.8 (6)
By: Robert Foster

Overview of this book

If you are a PHP programmer or developer looking for a framework to quickly develop your applications, this book is for you. The prerequisites needed would be prior experience with CodeIgniter.
Table of Contents (11 chapters)
close
close
10
Index

Creating the model


There is only one model in this project, image_model.php. It contains functions specific to creating and resetting passwords.

Create the /path/to/codeigniter/application/models/image_model.php file and add the following code to it:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Image_model extends CI_Model {
  function __construct() {
    parent::__construct();
  }

  function save_image($data) {
    do {
      $img_url_code = random_string('alnum', 8); 

      $this->db->where('img_url_code = ', $img_url_code);
      $this->db->from('images');
      $num = $this->db->count_all_results();
    } while ($num >= 1);

    $query = "INSERT INTO `images` (`img_url_code`, `img_image_name`, `img_dir_name`) VALUES (?,?,?) ";
    $result = $this->db->query($query, array($img_url_code, $data['image_name'], $data['img_dir_name']));

    if ($result) {
      return $img_url_code;
    } else {
      return flase;
    }
...
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
CodeIgniter Web Application Blueprints
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon