LITTLEBLACKDOG.COM Forum Index LITTLEBLACKDOG.COM

 
LWD LWD   FAQ FAQ   Memberlist Memberlist   Usergroups Usergroups   Active Topics Active Topics   Register Register  
  Profile Profile   Log in to check your private messages Log in to check your private messages   Log in Log in  
  Who is Online Who is Online   Image Gallery Image Gallery   Chat Chat   Search Search  
  LWDGear       LBDGear  

View next topic
View previous topic
Post new topic     Reply to topic   LITTLEBLACKDOG.COM Forum Index » Code Warriors
Author Message
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 184
Location: Portland, OR

Post Posted: Wed Aug 22, 2007 5:20 pm   Post subject: Need help getting dB working Reply with quote Back to top  

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:
Code: Select all
$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:
Code: Select all
$sql="select * from xlsdata where year='2007' and month='August'";
?>

And call data like this:
Code: Select all
<?=$month?> <?=$year?> <?=$day1?><?=$day2?><?=$day3?>

Yet nothing displays Confused

Does anyone have any ideas what I'm doing wrong?

dB is here: http://1leachfamily.com/cabin.csv

Any help is greatly appreciated Laughing

[edit]I changed the call to this and added an array but still no go
Code: Select all
<?
$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]

_________________
View user's profile Send private message
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

Post Posted: Thu Aug 23, 2007 5:03 pm   Post subject: Reply with quote Back to top  

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>
View user's profile Send private message AIM Address Yahoo Messenger
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 184
Location: Portland, OR

Post Posted: Thu Aug 23, 2007 7:39 pm   Post subject: Reply with quote Back to top  

The link works fine for me... And the file is there as a csv...

Here's the basic file (snipped + alignment slightly off here):
Code: Select all
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

_________________
View user's profile Send private message
gregw
Tail-Wagger
Tail-Wagger


Joined: 25 May 2003
Posts: 2490
Location: About 2000 miles south of where I want to be.

Post Posted: Thu Aug 23, 2007 8:59 pm   Post subject: Reply with quote Back to top  

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.
View user's profile Send private message
drums
Toilet Drinker
Toilet Drinker


Joined: 19 Jun 2003
Posts: 184
Location: Portland, OR

Post Posted: Thu Aug 23, 2007 9:10 pm   Post subject: Reply with quote Back to top  

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 Confused

_________________
View user's profile Send private message
Skookum
Butt Sniffer
Butt Sniffer


Joined: 26 Oct 2001
Posts: 1535
Location: I dunno, I lost my Mommy

Post Posted: Mon Sep 17, 2007 3:47 am   Post subject: Reply with quote Back to top  

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
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic     Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours

Help us keep advertisements off this site. Donate today!