Jump to content
Stef's Super Nerd Coding Community
StormGazer

database/PHP/Scripts - Not sure which way to go,

Recommended Posts

I 'll try to explain this as best as I can. Please be patient with me as I'm very new to all of this

 

I have a large list of links and am looking for the easiest way to keep them up to date on the website.

 

So far I've been keeping them listed in an excel sheet and have been manually re-entering the codes into a webpage.

I would update them, copy all into a notepad document and remove all the extra spaces and then paste into the html page the sections I knew had changed. As you can imagine this is becoming a much longer and time consuming task and I know there has to be an easier way!

 

In Excel the table looks like

 

code____| Link address | middle code | link # | end code

< a href=" | http://link.com'>http://link.com | " > ________| Link 1 | < /a >

 

etc....

 

I also have a seperate Excel sheet with only the http: links listed and without all the a href coding

 

What I would like to be able to do is have Link 1 - Link 10 of these links show up on page 1 of my website and then have Link 11- Link 20 show up on page 2

 

as it is right now I have to edit them individually

I would like to be able to learn the best way for handling these links. It's been suggested I learn about Databases and mySQL. But as I'm looking over these Googled tutorials I'm feeling very overwhelmed and I'm not entirely certain it's what I want.

 

I'd like to be able to just update the main list of addresses(http://link) and have it auto update quickly on the website.

I don't need someone to be able to search for specifics or to log in. I just want the information presented in the box I designed for it on my website.

 

The way I'd like it to appear on the website would look something like

 

(Page1)

 

Link 1 Link 2 Link 3 Link 4 Link 5

Link 6 Link 7 Link 8 Link 9 Link 10

 

 

(Page 2)

 

Link 11 Link 12 Link 13 Link 14 Link 15

Link 16 Link 17 Link 18 Link 19 Link 20

 

I'm a Beginner in this... only used HTML and some CSS and even that was really basic

I have Dreamweaver CS5 which I've been told could be used - but have been googling tutorials on that as well

I have no knowledge of databases

I have Microsoft Access 2010 which I've seen is also useful

Are there other programs I should consider using instead of these?

 

Can someone please help me look in the right direction? Can you be very detailed as possible, I'm embarrassed about how much of a newb I am at this. But as I mentioned previously I'm desperate for an easier way to keep my website up to date and running!

Share this post


Link to post
Share on other sites

In my job I am constantly taking excel sheets full of data, parsing the information and inserting into database tables.

 

I operate in the Zend Framework (PHP), with MySql databases, so Im not sure if my example is much help.

 

first make script that allows you to upload your excel file. html looks something like:

 

  
<form enctype="multipart/form-data" action="" method="post">
   <input type="hidden" name="MAX_FILE_SIZE" value="" />
   <label for="file">Upload your file:</label>
   <input type="file" name="file" id="file" /><br/>
   <button id="btn">Upload</button>
</form>

 

Then Create a PHP a script that takes this file and reads though each line (each column per row)

 

if ($this->getRequest()->isPost()) {
//this is where a Zend plug helps me out, but PHP will offer similar librarys for accepting files
set_time_limit(0);
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Extension', false, 'xls');
$upload->receive();
$path = $upload->getFileName();
$excel = PHPExcel_IOFactory::load($path); //now excel contains my spreadhseet info

$infoArray = array();

while (true) {
    $row = 1; //set the row number to start on
    $value = $excel->getActiveSheet()->getCellByColumnAndRow(0, $row)->getValue(); //gets the value of row

    if ($value == null) {
        break; //exit from loop if were at the end of the file
    }
    $infoArray[$row] = array(
          'column1' => $excel->getActiveSheet()->getCellByColumnAndRow(0, $row)->getValue()
          'column2' => $excel->getActiveSheet()->getCellByColumnAndRow(1, $row)->getValue()
          'column3' => $excel->getActiveSheet()->getCellByColumnAndRow(2, $row)->getValue()
          //etc...
          );

   //now you should have an array filled with values that were in the spreadsheet, insert them into your database and you normally would
  // ex. foreach ($infoArray as $row) { //insert array data into DB }
} else {
  echo $this->view->render('script/updatestationery.phtml'); //again this is probably more zend specific, the way it renders the view script
}

 

I apologize if i missed anything in my example, i didnt want to copy / paste an actual example as my code is company owned, and it's also much larger and doing a lot of different things that I have omitted.

 

Hope this helps get you started, message me if you'd like any further info or assistance with this project

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...