Results 1 to 4 of 4

Thread: CRM.. Building.. Step By Step..

  1. #1
    Web Extraordinaire
    Join Date
    Aug 2004
    Posts
    301
    Thanks
    0
    Thanked
    0 times in 0 posts

    CRM.. Building.. Step By Step..

    Hi,

    Right if you read my other post you will know i wanted to build a CRM. So basically i am going to to it but with only basic knowledge of PHP and SQL i wanted a bit of help. This is not only so i can build a CRM but advance my skills also. First of all i have created the following:

    db.config.php

    Code:
    <?php
    
    
    	$dbconfig[host] = "localhost";			// Server the databse is hosted on "localhost" for this server
    	$dbconfig[username] = "***";	// Username for the database
    	$dbconfig[password] = "***";	// Password for the database
    	$dbconfig[database] = "***";	// database the information is in
    
    ?>
    db.class.php
    Code:
    <?
    	
    
    	include("db.config.php");
    
    	class database {
    
    
    		function init() {
    			GLOBAL $dbconfig;
    			$this->config = $dbconfig;
    			$this->connection=mysql_connect($this->config[host], $this->config[username], $this->config[password]);
    		 	mysql_select_db ($this->config[database], $this->connection);
    		}
    
    		function selects($select) {
    			$this->result = mysql_query($select,$this->connection);
    		}
    
    		function inserts($insert) {
    			mysql_query($insert,$this->connection);
    		}
    
    		function deletes($delete) {
    			mysql_query($delete,$this->connection);
    		}
    
    		function countrows() {
    			$rows = mysql_num_rows($this->result);
    			return $rows;
    		}
    
    		function unbbcode($script) {
    			$this->bbcode1 = array(	"",
    									"",
    									"",
    									"",
    									"",
    									"",
    									"",
    									"",
    									"[LI]",
    									"[li]"
    									);
    			$this->bbcode2 = array(	"<B>",
    									"</B>",
    									"<B>",
    									"</B>",
    									"<i>",
    									"</i>",
    									"<i>",
    									"</i>",
    									"<li>",
    									"<li>"
    									);			
    
    			$this->completeText = str_replace($this->bbcode1,$this->bbcode2,$script);
    			return $this->completeText;
    		}
    
    
    	}
    
    
    
    
    ?>
    I was told to set these both up as it would be easier to back up the database etc.

    Then i want to setup a table so that i can add my users ect

    so i set-up tables.php

    Code:
    <?php
    
    require 'db_config.php';
    require 'db_class.php';
    
    $table = "CREATE TABLE users (
    id int(10) DEFAULT '0' NOT NULL auto_increment, 
    username varchar(40),
    password varchar(50), 
    regdate varchar(20),
    email varchar(100),
    website varchar(150),
    location varchar(150),
    show_email int(2) DEFAULT '0',
    last_login varchar(20),
    PRIMARY KEY(id))";
    
    $create = $db_object->query($table);	//perform query
    
    if(DB::isError($create)) {
    	die($create->getMessage());
    } else {
    	echo 'Table created successfully.';
    
    }
    
    $db_object->disconnect();
    
    ?>

    But this is not working any reason why?

  2. #2
    Registered User
    Join Date
    Jan 2006
    Location
    Wakey/Sheffield
    Posts
    2
    Thanks
    0
    Thanked
    0 times in 0 posts
    Error message would be useful next time!

    You haven't created you DB object. Try adding this before "$create = $db_object->query($table);"

    PHP Code:
    $db_object = & new database(); 
    PS - That's a nasty DB abstraction layer.

  3. #3
    HEXUS.net Webmaster
    Join Date
    Jul 2003
    Location
    UK
    Posts
    3,108
    Thanks
    1
    Thanked
    0 times in 0 posts
    If you're doing this to advance your skills start with something a lot easier than a CRM system as they are massively complex pieces of work. Look at building an application to manage your DVD collection or manage a football team or something smaller. You'll at least be setting yourself an achievable goal.

  4. #4
    Web Extraordinaire
    Join Date
    Aug 2004
    Posts
    301
    Thanks
    0
    Thanked
    0 times in 0 posts
    Cheers for that i realised what i had done after i posted this. Well i need a CRM system and want it to meet my needs so might as well. I am a fast learner so will pick it up fine as i have learn't hell of a lot already in a couple of days. All i want it to do is add users/customers and also be able to add notes to each customer. I have already sorted the users section out just need to complete the customer section out.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. step by step guide to updating sn41g2 bios?
    By micovwar in forum PC Hardware and Components
    Replies: 1
    Last Post: 27-08-2003, 06:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •