Jump to content

Need to make my data entry file read top down instead of left-right


drums

Recommended Posts

Sorry if this is a repeat because the first didn't like the CSV attachment but when I switched it it said I aleready posted but didn't see it...

This is hard to explain so please bear with me. I have a program that updates a dB with a CSV file so all the data is imported in a straight line or row of the CSV file. Called thusly:

<? 
$query = mysql_query("select * from xlsdata where page='calendar'") or die("SQL error: " . mysql_error());if (FALSE === ($record = mysql_fetch_array($query))){    
} ?> 

I then display the data this way (only showing 2 of 5):

<h2><?php echo $record['header1']; ?></h2>
<p><?php echo $record['para1']; ?>
<blockquote>
<?php if(!empty($record['bullet1'])) echo "<li>".$record['bullet1']."</li>"; ?>
    <?php if(!empty($record['bullet1-2'])) echo "<li>".$record['bullet1-2']."</li>"; ?>
    <?php if(!empty($record['bullet1-3'])) echo "<li>".$record['bullet1-3']."</li>"; ?>
    <?php if(!empty($record['bullet1-4'])) echo "<li>".$record['bullet1-4']."</li>"; ?>
    <?php if(!empty($record['bullet1-5'])) echo "<li>".$record['bullet1-5']."</li>"; ?> 
    <?php if(!empty($record['bullet1-6'])) echo "<li>".$record['bullet1-6']."</li>"; ?>
    <?php if(!empty($record['bullet1-7'])) echo "<li>".$record['bullet1-7']."</li>"; ?>
    </blockquote>
<?php echo $record['para1-end']; ?></p>

<h2><?php echo $record['header2']; ?></h2>
<p><?php echo $record['para2']; ?>
<blockquote>
<?php if(!empty($record['bullet2'])) echo "<li>".$record['bullet2']."</li>"; ?>
    <?php if(!empty($record['bullet2-2'])) echo "<li>".$record['bullet2-2']."</li>"; ?>
    <?php if(!empty($record['bullet2-3'])) echo "<li>".$record['bullet2-3']."</li>"; ?>
    <?php if(!empty($record['bullet2-4'])) echo "<li>".$record['bullet2-4']."</li>"; ?>
    <?php if(!empty($record['bullet2-5'])) echo "<li>".$record['bullet2-5']."</li>"; ?> 
    <?php if(!empty($record['bullet2-6'])) echo "<li>".$record['bullet2-6']."</li>"; ?>
    <?php if(!empty($record['bullet2-7'])) echo "<li>".$record['bullet2-7']."</li>"; ?>
    </blockquote>
<?php echo $record['para2-end']; ?></p>

This has worked fine as usually I make each row a page and call them that way. This time however, I just have one page that I'm updating (5 areas with 10 cells for each) and I want to make it easier for the user to fill out the spreadsheet. So I would rather that each row is one of 5 data entry points on that page. So I want the data pulled by row and column going down instead of across the same row (each header cell is uniquely named).

So in case I'm not being followed, I've attached the CSV file (as PDF because it won't allow a csv upload) so you can visualize (Row 1 is the header with A1 being the identifier, A2 data1, A3=data2 and so on to A11), then I repeat that 4 times in the same row for all the data entry cells.

Instead I would like the header row to be just the identifier and the 10 header cells and then have the rows below the header row the 5 different entry points on the page (1st - 5th). This way it is a little more visible appealing to the user filling out this spreadsheet and since they are going to be moving things up (each event on the page has a date starting in its header) by deleting the data in the first row then moving all the others up and making a new one in the 5th row.

 

So I was thinking I could use AND but I don't think it will know where to put the data unless it fills top down until the EOF by nature.

<? 
$query = mysql_query("select * from xlsdata where placement='1st' AND placement='2nd' AND placement='3rd' AND placement='4th' AND placement='5th'") or die("SQL error: " . mysql_error());if (FALSE === ($record = mysql_fetch_array($query))){    
} 
?>

So if I went this way would I have to have the query at each spot in the doc like this:

<? 
$query = mysql_query("select * from xlsdata where placement='1st'") or die("SQL error: " . mysql_error());if (FALSE === ($record = mysql_fetch_array($query))){    
} ?> 

 

<? 
$query = mysql_query("select * from xlsdata where placement='1st'") or die("SQL error: " . mysql_error());if (FALSE === ($record = mysql_fetch_array($query))){    
} ?> 

Then the data grab:

<h2><?php echo $record['header1']; ?></h2>
<p><?php echo $record['para1']; ?>
<blockquote>
<?php if(!empty($record['bullet1'])) echo "<li>".$record['bullet1']."</li>"; ?>
    <?php if(!empty($record['bullet1-2'])) echo "<li>".$record['bullet1-2']."</li>"; ?>
    <?php if(!empty($record['bullet1-3'])) echo "<li>".$record['bullet1-3']."</li>"; ?>
    <?php if(!empty($record['bullet1-4'])) echo "<li>".$record['bullet1-4']."</li>"; ?>
    <?php if(!empty($record['bullet1-5'])) echo "<li>".$record['bullet1-5']."</li>"; ?> 
    <?php if(!empty($record['bullet1-6'])) echo "<li>".$record['bullet1-6']."</li>"; ?>
    <?php if(!empty($record['bullet1-7'])) echo "<li>".$record['bullet1-7']."</li>"; ?>
    </blockquote>
<?php echo $record['para1-end']; ?></p>

Then for the next position and so on:

<? 
$query = mysql_query("select * from xlsdata where placement='2nd'") or die("SQL error: " . mysql_error());if (FALSE === ($record = mysql_fetch_array($query))){    
} ?> 

Then the data grab:

<h2><?php echo $record['header1']; ?></h2>
<p><?php echo $record['para1']; ?>
<blockquote>
<?php if(!empty($record['bullet1'])) echo "<li>".$record['bullet1']."</li>"; ?>
    <?php if(!empty($record['bullet1-2'])) echo "<li>".$record['bullet1-2']."</li>"; ?>
    <?php if(!empty($record['bullet1-3'])) echo "<li>".$record['bullet1-3']."</li>"; ?>
    <?php if(!empty($record['bullet1-4'])) echo "<li>".$record['bullet1-4']."</li>"; ?>
    <?php if(!empty($record['bullet1-5'])) echo "<li>".$record['bullet1-5']."</li>"; ?> 
    <?php if(!empty($record['bullet1-6'])) echo "<li>".$record['bullet1-6']."</li>"; ?>
    <?php if(!empty($record['bullet1-7'])) echo "<li>".$record['bullet1-7']."</li>"; ?>
    </blockquote>
<?php echo $record['para1-end']; ?></p>

So assuming you are following what I'm trying to do, does anyone know how to accomplish this?

 

Thanks in advance for your time/help.

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.