Menu

HOWTO: Add custom field

Help
amprantino
2010-04-06
2012-06-07
  • amprantino

    amprantino - 2010-04-06

    !!!ATTENTION!!!

    The following commands will delete your database! If you dont want to delete
    your database use the followind command as appropriate:

    ALTER TABLE addressbook ADD jdesc VARCHAR(255);

    drop table addressbook;

    CREATE TABLE addressbook (

    id int(9) unsigned NOT NULL auto_increment,

    firstname varchar(255) NOT NULL,

    lastname varchar(255) NOT NULL,

    jdesc varchar(255) NOT NULL,

    company varchar(255) NOT NULL,

    address text NOT NULL,

    home text NOT NULL,

    mobile text NOT NULL,

    work text NOT NULL,

    internal text not NULL,

    fax text NOT NULL,

    email text NOT NULL,

    email2 text NOT NULL,

    homepage text NOT NULL,

    bday tinyint(2) NOT NULL,

    bmonth varchar(50) NOT NULL,

    byear varchar(4) NOT NULL,

    address2 text NOT NULL,

    phone2 text NOT NULL,

    notes text NOT NULL,

    created datetime default NULL,

    modified datetime default NULL,

    password varchar(256) default NULL,

    login date default NULL,

    role varchar(256) default NULL,

    PRIMARY KEY (id)

    ) DEFAULT CHARSET=utf8;

    ~~~~~~~~~~~~ EDIT FILES ~~~~~~~~~~~~~~~~~~

    inc/translation.xx.php

    $messages = 'job description';

    $messages = "Θέση";

    $messages = "descrizione del lavoro";

    index.php

    Add:

    echo "".ucfmsg("JOBDESCRIPTION")."";

    add around line 80:

    if($row == "jobdesc") echo "$jdesc";

    add around line 41:

    addRow("jobdesc");

    edit.php --> alter query:

    $sql = "INSERT INTO $table (firstname, lastname, jdesc, company, address,
    home, mobile, work, fax, email, email2, homepage, bday, bmonth, byear,
    address2, phone2, notes, created, modified)

    VALUES ('$firstname','$lastname', '$jdesc', '$company', '$address','$home','$m
    obile','$work','$fax','$email','$email2','$homepage','$bday','$bmonth','$byear
    ', '$address2', '$phone2', '$notes', now(), now())";

    $result = mysql_query($sql);

    add fields:

    <label><?php echo ucfmsg("JOBDESCRIPTION") ?>:</label>

    <input type="text" name="jdesc" size="35" value="&lt;?php echo $myrow?&gt;" &gt;<br=""/>

    Maybe additional changes are required....

     
  • amprantino

    amprantino - 2010-04-06

    !!!ATTENTION!!!

    The following commands will delete your database! If you dont want to delete your database use the followind command as appropriate:
    ALTER TABLE addressbook ADD jdesc VARCHAR(255); 
    drop table addressbook;
    CREATE TABLE addressbook (
      id int(9) unsigned NOT NULL auto_increment,
      firstname varchar(255) NOT NULL,
      lastname varchar(255) NOT NULL,
      jdesc varchar(255) NOT NULL,
      company varchar(255) NOT NULL,
      address text NOT NULL,
      home text NOT NULL,
      mobile text NOT NULL,
      work text NOT NULL,
      internal text not NULL,
      fax text NOT NULL,
      email text NOT NULL,
      email2 text NOT NULL,
      homepage text NOT NULL,
      bday tinyint(2) NOT NULL,
      bmonth varchar(50) NOT NULL,
      byear varchar(4) NOT NULL,
      address2 text NOT NULL,
      phone2 text NOT NULL,
      notes text NOT NULL,
      created datetime default NULL,
      modified datetime default NULL,
      password varchar(256) default NULL,
      login date default NULL,
      role varchar(256) default NULL,
      PRIMARY KEY  (id)
    ) DEFAULT CHARSET=utf8;
    
    ~~~~~~~~~~~~ EDIT FILES ~~~~~~~~~~~~~~~~~~
    
    inc/translation.xx.php
    $messages['JOBDESCRIPTION']['en'] = 'job description';
    $messages['JOBDESCRIPTION']['el'] = "Θέση";
    $messages['JOBDESCRIPTION']['it'] = "descrizione del lavoro";
    
    index.php 
    Add:
                            echo "<th>".ucfmsg("JOBDESCRIPTION")."</th>";
    
    add around line 80:
        if($row == "jobdesc")  echo "<td>$jdesc</td>";
    
    add around line 41:
                           addRow("jobdesc");
    
    edit.php --> alter query:
    $sql = "INSERT INTO $table (firstname,    lastname,   jdesc, company,    address,   home,   mobile,   work,   fax,   email,    email2,  homepage,   bday,  bmonth,   byear,    address2,    phone2,    notes,     created, modified)
                                VALUES ('$firstname','$lastname', '$jdesc', '$company', '$address','$home','$mobile','$work','$fax','$email','$email2','$homepage','$bday','$bmonth','$byear', '$address2', '$phone2', '$notes', now(),   now())";
            $result = mysql_query($sql);
    
    add fields:
    
                    <label><?php echo ucfmsg("JOBDESCRIPTION") ?>:</label>
                    <input type="text" name="jdesc" size="35" value="<?php echo $myrow['jdesc']?>" /><br />
    
    Maybe additional changes are required....
    
     
  • amprantino

    amprantino - 2010-04-06

    !!!ATTENTION!!!

    The following commands will delete your database! If you dont want to delete
    your database use the followind command as appropriate:

    ALTER TABLE addressbook ADD jdesc VARCHAR(255);

    drop table addressbook;

    CREATE TABLE addressbook (

    id int(9) unsigned NOT NULL auto_increment,

    firstname varchar(255) NOT NULL,

    lastname varchar(255) NOT NULL,

    jdesc varchar(255) NOT NULL,

    company varchar(255) NOT NULL,

    address text NOT NULL,

    home text NOT NULL,

    mobile text NOT NULL,

    work text NOT NULL,

    internal text not NULL,

    fax text NOT NULL,

    email text NOT NULL,

    email2 text NOT NULL,

    homepage text NOT NULL,

    bday tinyint(2) NOT NULL,

    bmonth varchar(50) NOT NULL,

    byear varchar(4) NOT NULL,

    address2 text NOT NULL,

    phone2 text NOT NULL,

    notes text NOT NULL,

    created datetime default NULL,

    modified datetime default NULL,

    password varchar(256) default NULL,

    login date default NULL,

    role varchar(256) default NULL,

    PRIMARY KEY (id)

    ) DEFAULT CHARSET=utf8;

    ~~~~~~~~~~~~ EDIT FILES ~~~~~~~~~~~~~~~~~~

    inc/translation.xx.php

    $messages = 'job description';

    $messages = "Θέση";

    $messages = "descrizione del lavoro";

    index.php

    Add:

    echo "".ucfmsg("JOBDESCRIPTION")."";

    add around line 80:

    if($row == "jobdesc") echo "$jdesc";

    add around line 41:

    addRow("jobdesc");

    edit.php --> alter query:

    $sql = "INSERT INTO $table (firstname, lastname, jdesc, company, address,
    home, mobile, work, fax, email, email2, homepage, bday, bmonth, byear,
    address2, phone2, notes, created, modified)

    VALUES ('$firstname','$lastname', '$jdesc', '$company', '$address','$home','$m
    obile','$work','$fax','$email','$email2','$homepage','$bday','$bmonth','$byear
    ', '$address2', '$phone2', '$notes', now(), now())";

    $result = mysql_query($sql);

    add fields:

    <label><?php echo ucfmsg("JOBDESCRIPTION") ?>:</label>

    <input type="text" name="jdesc" size="35" value="&lt;?php echo $myrow?&gt;" &gt;<br=""/>

    Maybe additional changes are required....

     
  • amprantino

    amprantino - 2010-04-06

    It doesnt appear as code/syntaxed well ... dont know why

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.