Implementing a Basic CMS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bettor
    New Member
    • Jun 2007
    • 27

    Implementing a Basic CMS

    Hi all,

    I am new to PHP. I am trying to develop an html page that will list names of people and there will be some information corresponding to each name. What I am trying to achieve is to somehow incorporate those names under variables and/or arrays so I can change them from CMS. i will need to be changing the names as well as the number of names (sometimes there will be 10 other times 12...etc) Please advise me on how to proceed? What is the most effective way to code it?...with variables or arrays? I will appreciate any suggestions.

    Thanks in advance!
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    I'm not sure what you mean by CMS?

    When you'r dealing with information like this, you will need a good place to store it. A database would be ideal, but there are of course other, less sophisticated methods. PHP by it's self can not store data.

    I would use a MySQL database to store my information, which I would then use in my PHP code to display or edit the information as needed.

    If you are not sure how to do this, there are plenty of free tutorials online.
    And as always, we are more than happy to help you out.

    Comment

    • bettor
      New Member
      • Jun 2007
      • 27

      #3
      Originally posted by Atli
      Hi.

      I'm not sure what you mean by CMS?

      When you'r dealing with information like this, you will need a good place to store it. A database would be ideal, but there are of course other, less sophisticated methods. PHP by it's self can not store data.

      I would use a MySQL database to store my information, which I would then use in my PHP code to display or edit the information as needed.

      If you are not sure how to do this, there are plenty of free tutorials online.
      And as always, we are more than happy to help you out.
      Thank you for your advice. It is good help as a beginning. Now I need some advice on how to store the names and the info associated with them so I can change it and display it whenever I need to, from an admin panel (CMS). Since I will be using certain names of a group of people i was thinking to assign a variable for each name...but I will have to assign many variables. And every time i will need to display different names from that group (that's why i'm thinking variables could help) What would be my best option to store all the names so I can recall some of them at certain periods? Thanks for your advice

      Comment

      • bonski
        New Member
        • Jun 2007
        • 53

        #4
        Originally posted by bettor
        Thank you for your advice. It is good help as a beginning. Now I need some advice on how to store the names and the info associated with them so I can change it and display it whenever I need to, from an admin panel (CMS). Since I will be using certain names of a group of people i was thinking to assign a variable for each name...but I will have to assign many variables. And every time i will need to display different names from that group (that's why i'm thinking variables could help) What would be my best option to store all the names so I can recall some of them at certain periods? Thanks for your advice
        ei bettor,

        in mysql database.. you can make queries that will insert, edit, delete, search data.. you can add the data directly to database using mysql commands.. or you can use phpmyadmin... or you can make your own front end using PHP.. by having html forms where you input your data and a php scripts to process them the way you want... after adding you data to the database.. on you frontend.. you can make a script that will query them and display them... i suggest you read books about php and mysql... or look for tutorials... then if you had started coding and facing problems.. you can post it... so everybody here will have a chance to help you... ok

        ^____^... bonski..

        Comment

        • Atli
          Recognized Expert Expert
          • Nov 2006
          • 5062

          #5
          Well, if you were to use a database, you could set up a table where you can store all that data.

          You could set up a user table that looked similar to this:
          [code=text]
          Table: UserData
          ----------------------------------------------------------------
          ID UserName UserPassword UserEmail UserPhone
          ----------------------------------------------------------------
          1 User1 Randomness user1@domain.co m 1234567
          2 User2 KnockKnock user2@domain.co m 2234567
          3 User3 Who's ther? user2@domain.co m 3234567
          4 User4 You'r moma! user3@domain.co m 4234567
          [/code]

          Then you could use SQL queries to read and edit the data. For example, to list all data that belongs to 'User1' you could use this SQL:
          [code=sql]
          SELECT * FROM UserData WHERE UserName = 'User1';
          [/code]

          Which you could have PHP execute and fetch the results, and display them like this:
          [code=php]
          // Connect MySQL
          $DB = mysql_connect(" serverIP", "userName", "userPass") or die("MySQL connection failed:<br />". mysql_error());
          mysql_select_db ("yourDB", $DB) or die("Database could not be selected: <br />". mysql_error());

          // Query for the data
          $RESULT = mysql_query("SE LECT * FROM UserData WHERE UserName = 'User1'");

          // Loop through each row
          $rowIndex = 0;
          while($row = mysql_fetch_ass oc($RESULT))
          {
          // Show the row number
          $rowIndex++;
          echo "Row $rowIndex";

          // Show each column in the row
          foreach($row as $key => $value)
          {
          echo " - $key = $value";
          }
          }
          [/code]

          Which would print out somehting like this:
          [code=text]
          Row 1
          - UserID = 1
          - UserName = User1
          - UserPass = Randomness
          - UserEmail = user1@domain.co m
          - UserPhone = 1234567
          [/code]

          This will obviously need to be written to match your data but you get my point.

          Comment

          • pbmods
            Recognized Expert Expert
            • Apr 2007
            • 5821

            #6
            Changed thread title to better describe the problem.

            Comment

            Working...