SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 42 of 42
  1. #26
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a text character limit in MySql? One of the samples I have is over 450 characters?

    I found a way to set the width and height of the input boxes. Is there a way to provide word-wrap?
    Each day is a learning experience.

  2. #27
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cups,

    I have installed XAMPP on one of my Windows machines. I tried to use phpMyAdmin to create a table and this is what I have set:

    Field: id Type: INT Length/Value: 11

    I left Default, Collation, Attributes, and Null all blank.

    Index: UNIQUE A_I is checked

    I left Comments, MIME type, Browser transformation, and Transformation options all blank.

    I also created several other columns but could not figure out a way to set the primary key.

    Did I get close to correct?
    Each day is a learning experience.

  3. #28
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Why don't you explain what the data is that you are going to be storing?

    Post one or two samples.

  4. #29
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I will be storing the name of the store, category, itemName, itemCost, comments, a few links.

    store: Dollar General
    category: Three Day Sale 12/14/2010-12/16/2010
    itemName: Delmonte whole peaches
    itemCost: $25.00 per flat
    comments: This is the best deal this year. Best hurry before they are all gone.
    links01: Delmonte Whole Peaches coupon www.delmonte.com/peaches/

    Still trying to get my daughter to give me some more examples, but I made up what I have imagined to be what she wants.

    Since the links could apply to more than one store, should I have a table just for coupons? Can I even access multiple tables? Can I actually store HTML in a database (links)?
    Each day is a learning experience.

  5. #30
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If you know you are never going to have more than one product called "Delmonte whole peaches" then that would be a good candidate for the primary key.

    But I will guess that you could have more than one, so I would lead you down the traditional sql route of having an id in your table, making it an integer and selecting auto-increment when you create the table.

    table_name_here
    =============

    id int auto-increment
    category varchar 100
    itemName varchar 100
    itemCost varchar 30
    comments text
    links01 varchar 255

    ==============

    Although its very tempting I am not going to stray from your first spec until we come across reasons why each database field could be improved.

    Putting in an auto-increment id is a pretty good first start, read up on it and you will discover why.

    Add another couple of rows.

    Read up on this principle : database normalization.

  6. #31
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If you know you are never going to have more than one product called "Delmonte whole peaches" then that would be a good candidate for the primary key.

    But I will guess that you could have more than one, so I would lead you down the traditional sql route of having an id in your table, making it an integer and selecting auto-increment when you create the table.

    table_name_here
    =============

    id int auto-increment
    category varchar 100
    itemName varchar 100
    itemCost varchar 30
    comments text
    links01 varchar 255

    ==============

    Although its very tempting I am not going to stray from your first spec until we come across reasons why each database field could be improved.

    Putting in an auto-increment id is a pretty good first start, read up on it and you will discover why.

    Add another couple of rows (I mean a couple of other products)

    Read up on this principle : database normalization.

  7. #32
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cups View Post
    Read up on this principle : database normalization.
    Right! This is something I learned in one of my MBA classes. I should have thought of that. Coupons go in their own table, products have their own table, etc.

    I will build a new set of tables when I get home tonight.

    coupon_table
    ==============

    id int unique auto-increment <--- Does unique designate this as Primary Key
    coupon_name varchar 100
    coupon_description varchar 100

    ================

    Several tables one for each store.

    store_name_table
    ================

    id int auto-increment
    category varchar 100
    itemName varchar 100
    itemCost varchar 30
    comments text
    coupon01 varchar 255 <---- keyed to the coupon table using coupon name
    coupon02 varchar 255 <---- keyed to the coupon table using coupon name
    coupon03 varchar 255 <---- keyed to the coupon table using coupon name

    =================


    Am I on the correct path now?
    Each day is a learning experience.

  8. #33
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I created a database with phpMyAdmin. When I saved the information, this was displayed:
    Code:
    CREATE TABLE `test`.`iga_table` (
    `id` INT( 6 ) NOT NULL AUTO_INCREMENT ,
    `category` VARCHAR( 100 ) NOT NULL ,
    `itemname` VARCHAR( 100 ) NOT NULL ,
    `itemcost` VARCHAR( 30 ) NOT NULL ,
    `comments` VARCHAR( 500 ) NOT NULL ,
    `coupon01` VARCHAR( 255 ) NOT NULL ,
    `coupon02` VARCHAR( 255 ) NOT NULL ,
    `coupon03` VARCHAR( 255 ) NOT NULL ,
    `coupon04` VARCHAR( 255 ) NOT NULL ,
    `coupon05` VARCHAR( 255 ) NOT NULL ,
    PRIMARY KEY ( `id` ) ,
    UNIQUE (
    `id`
    )
    If this indicates that I completed it correctly, I will create the coupon database and start putting test data in the database.
    Each day is a learning experience.

  9. #34
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I am still working from your original spec, that you want to just get a list of products on a single page.

    It would be really easy to break off and make this a database design thread, but I understood your plea to be to help you a) get a database made (you've now done this) and then b) get PHP to query that database and display some products.

    So, what are you using to get PHP to talk to Mysql?

    PHPs native mysql_* functions
    PHPs native mysqli_* functions
    PDO

    Take a look at the output from
    PHP Code:
    phpinfo(); 
    and see which extensions are installed for you to do this. Now, this is important, on your LIVE server which extensions are installed permitting you to access Mysql?

    You want to create scripts which work flawlessly on both your dev machine and your live server.

    We can easily revisit your database design once the above has been established, and proven to be working.

  10. #35
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cups,

    Thanks for pointing me back to the track. It would be so easy to loose focus and try to do it all at once.

    I have just run phpinfo on my Live Server. I now have 19 pages of printout to look at.
    I see that I have PHP 4.4.9 on the Live Server.
    I do not find anything about PDO in the file.
    I found the following mysql_* entries in the file:
    MYSQL_MODULE_TYPE external
    MYSQL_SOCKET /var/run/mysqld/mysqld.sock
    MYSQL_INCLUDE -I/usr//include/mysql
    MYSQL_LIBS -L/usr//lib -lmysqlclient

    I did not find anything about mysqli_ in the file.

    When I get home later tonight, I will check the phpinfo for my local installation.
    Each day is a learning experience.

  11. #36
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by Cups View Post
    Thinking about my reply, just try this first if you like:

    insert.php

    PHP Code:
    <form action="insert.php" method="post">
    Store name: <input type="text" name="store" id="store"><br>
    Sale Dates: <input type="text" name="saledate" id="saledate"><br>
    Sale Item: <input type="text" name="saleitem"><br>
    Sale Price: <input type="text" name="saleprice"><br>
    <input type="Submit">
    </form>
    <?php  // note, use full php tags

    if( $_POST ){
    var_dump($_POST) ;
    }
    ?>
    Save it and run it, fill in the form, get any output?
    made it...

  12. #37
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    OK, I cannot see it so I will guess that server is using mysql_* functions (mysql_connect() etc).

    If your dev server has the same setup then you should be able to connect to mysql using code you will find in most of the PHP/Database tutorials on the web - or start in the manual

    Still, you need to get a test script working which proves this case.
    test_mysql.php
    PHP Code:
    <?php

           
    if(!is_callable("mysql_connect")){
            echo 
    "MySQL module for PHP not installed or loaded, please see php.ini" ;
            return;
          }else{
           echo 
    "Mysql module is installed" ;
    }

    print_r(get_loaded_extensions());

    ?>
    get_loaded_extensions

    Put that script on both servers and note any diffs when it comes to databases, or as I say, mysqli, PDO and maybe even sqlite.

  13. #38
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by axisaxis View Post
    made it...
    Er? sorry mate, right person, wrong thread? Good on you in any case.

  14. #39
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just ran that on the live server, and this is what I got:

    Mysql module is installedArray ( [0] => date [1] => libxml [2] => openssl [3] => pcre [4] => zlib [5] => bcmath [6] => bz2 [7] => calendar [8] => ctype [9] => curl [10] => dba [11] => dbase [12] => dom [13] => hash [14] => filter [15] => ftp [16] => gd [17] => gettext [18] => session [19] => iconv [20] => idn [21] => standard [22] => json [23] => mbstring [24] => mcrypt [25] => mhash [26] => mysql [27] => SimpleXML [28] => SPL [29] => PDO [30] => pdo_sqlite [31] => posix [32] => Reflection [33] => imap [34] => shmop [35] => pdo_mysql [36] => soap [37] => mysqli [38] => SQLite [39] => exif [40] => tidy [41] => tokenizer [42] => wddx [43] => xml [44] => xmlreader [45] => xmlwriter [46] => xsl [47] => zip [48] => cgi )

    Now I am off to read the link in your message. Sometime tonight, I will run this on my home server setup.
    Each day is a learning experience.

  15. #40
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    OK, so that shows your live server has lots of options for linking to Mysql, PDO drivers for sqlite and mysql, and native mysql_* functions too.

    Stick to the latter as you find your feet, so now to see what your home rig has got.

  16. #41
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The home setup has this information:

    Mysql module is installedArray ( [0] => date [1] => libxml [2] => openssl [3] => pcre [4] => zlib [5] => bcmath [6] => bz2 [7] => calendar [8] => ctype [9] => curl [10] => dba [11] => dbase [12] => dom [13] => hash [14] => filter [15] => ftp [16] => gd [17] => gettext [18] => session [19] => iconv [20] => idn [21] => standard [22] => json [23] => mbstring [24] => mcrypt [25] => mhash [26] => mysql [27] => SimpleXML [28] => SPL [29] => PDO [30] => pdo_sqlite [31] => posix [32] => Reflection [33] => imap [34] => shmop [35] => pdo_mysql [36] => soap [37] => mysqli [38] => SQLite [39] => exif [40] => tidy [41] => tokenizer [42] => wddx [43] => xml [44] => xmlreader [45] => xmlwriter [46] => xsl [47] => zip [48] => cgi )

    Looks like it has the same stuff installed. Now I need to get XAMPP to work properly here at home.
    Each day is a learning experience.

  17. #42
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cups,

    I now have XAMPP running. I am using VirtualHost and have setup the site for my daughter. I have setup a MySQL database, and I am read to finish setting up the input form to add data in the first table I have setup.

    Taking this slow (I think) you have already helped me with the input form and dumping it back to the display. I think my plan would be to:
    1. finish the input web page and start adding data to the database.
    2. once I am adding the data, build a web page that displays some of that data.
    3. With the data being displayed, verify that the current table has the proper fields.
    4. Start working on other tables and setting their relationships.

    Does this seem like a logical order of progression?

    My network access is spotty this week since we are on vacation and the wireless is not available in the units.
    Each day is a learning experience.


Bookmarks

Posting Permissions

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