| Author |
Message |
drums
Toilet Drinker


Joined: 19 Jun 2003 Posts: 188
Location: Portland, OR
|
Posted:
Wed Aug 22, 2007 5:20 pm Post subject: Need help getting dB working |
|
I hired someone to do this for a client and I'm now trying to apply it to another site for populating a calendar. Basically it's a MySQL dB that reads the data from an excel (csv) spreadsheet. I am not getting any errors (except in MySQL it says I don't have an index) but no data is going through. The php is being parsed through html.
http://1leachfamily.com/calendar.html
The csv file has a header row of date, month, Day1-31 and 2 notes fields.
I call the dB like so:
$url=$_SERVER['PHP_SELF'];
mysql_connect("localhost","user","password") or die("Error Connecting to server ".mysql_error());
mysql_select_db("cabin") or die("Error Connecting to db : ".mysql_error());
Query like this:
$sql="select * from xlsdata where year='2007' and month='August'";
?>
And call data like this:
<?=$month?> <?=$year?> <?=$day1?><?=$day2?><?=$day3?>
Yet nothing displays
Does anyone have any ideas what I'm doing wrong?
dB is here: http://1leachfamily.com/cabin.csv
Any help is greatly appreciated
[edit]I changed the call to this and added an array but still no go
<?
$query=mysql_query("select * from xlsdata where year='2007'");
while($record=mysql_fetch_array($query))
{
$yearname = $record['year'];
$monthname = $record['month'];
$day1name = $record['day1'];
$day2name = $record['day2'];
$day3name = $record['day3'];
$day4name = $record['day4'];
$day5name = $record['day5'];
$day6name = $record['day6'];
$day7name = $record['day7'];
$day8name = $record['day8'];
$day9name = $record['day9'];
$day10name = $record['day10'];
$day11name = $record['day11'];
$day12name = $record['day12'];
$day13name = $record['day13'];
$day14name = $record['day14'];
$day15name = $record['day15'];
$day16name = $record['day16'];
$day17name = $record['day17'];
$day18name = $record['day18'];
$day19name = $record['day19'];
$day20name = $record['day20'];
$day21name = $record['day21'];
$day22name = $record['day22'];
$day23name = $record['day23'];
$day24name = $record['day24'];
$day25name = $record['day25'];
$day26name = $record['day26'];
$day27name = $record['day27'];
$day28name = $record['day28'];
$day29name = $record['day29'];
$day30name = $record['day30'];
$day31name = $record['day31'];
$note1name = $record['note1'];
$note2name = $record['note2'];
}
?>
<?=$monthname?> <?=$yearname?> [/edit] |
_________________
|
|
|
|
|
fatbotgw
Stray Dog

Joined: 13 Dec 2003 Age: 26 Posts: 29
Location: The middle of nowhere...wait....I mean the middle of nowhere in Idaho
|
Posted:
Thu Aug 23, 2007 5:03 pm Post subject: |
|
FYI, the Excel file has this:
<HTML>
<HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD>
<BODY>
<H1>Not Found</H1>
The requested URL was not found on this server.
<P>
<HR>
<ADDRESS>
Apache Server at 1LEACHFAMILY.COM
</ADDRESS>
</BODY>
</HTML> |
|
|
|
|
|
|
drums
Toilet Drinker


Joined: 19 Jun 2003 Posts: 188
Location: Portland, OR
|
Posted:
Thu Aug 23, 2007 7:39 pm Post subject: |
|
The link works fine for me... And the file is there as a csv...
Here's the basic file (snipped + alignment slightly off here):
Year Month Day 1 Day 2 Day 24 Day 25 Day 26 Day 27 Day 28 Day 29 Day 30 Day 31 Note1 Note2
2007 August Janet Janet Janet Janet Janet Janet Janet
2007 September
2007 October
I know the data is being written to the dB. The problem the data is not populating the webpage.
Here's a view of the upload:
http://1leachfamily.com/xls/view.php |
_________________
|
|
|
|
|
gregw
Tail-Wagger

Joined: 25 May 2003 Posts: 2595
Location: About 2000 miles south of where I want to be.
|
Posted:
Thu Aug 23, 2007 8:59 pm Post subject: |
|
Why don't you use a program like Navicat to populate your MySQL database from your CSV file? |
_________________ Some people are like slinkys... not really good for anything but they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
|
drums
Toilet Drinker


Joined: 19 Jun 2003 Posts: 188
Location: Portland, OR
|
Posted:
Thu Aug 23, 2007 9:10 pm Post subject: |
|
Thanks for the tip but I have it working on other sites and just can't figure WTF I'm doing different; need another set of eyes and all that |
_________________
|
|
|
|
|
Skookum
Butt Sniffer


Joined: 26 Oct 2001 Posts: 1541
Location: I dunno, I lost my Mommy
|
Posted:
Mon Sep 17, 2007 3:47 am Post subject: |
|
If you're receiving a no index, do you have a primary key setup and working?
First thing you should do is to echo your query out and run that through what ever DB admin program you have, whether it just be the MySQL command prompt, HeidiSQL or the PHP MySQL Admin thingy.
With the no index error I doubt the query will run, but if it does, then try stepping through your code one piece at a time. Change your query to a simple select * from and see if you get results.
Most likely the problem is with the query.
Hope this helps. |
_________________ "Paranoia is no longer a mental illness it is a way of life" - Me
|
|
|
|
|
|
|