Re: [PHP] Re: repeating data from one column until data from another column changes
"Php" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Why not change the code back, then just add an article for the month of may > and see if it comes up? i am trying to automate this so I don't have to look at it againclient updates the pages and I won't be getting paid beyond this... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
Why not change the code back, then just add an article for the month of may and see if it comes up? > when i take out the WHERE clause, I get ALL 192 titles in the upper right > side and ALL 192 titles and descriptions in the main body..which is > almost what i want...minus about 180 titles and articles > > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Just for right now, go ahead a make the date change, or elimate the date > > range to get SOMETHING to come out. > > > > > > >> Just change the . date('m') to the actualy month you want if not the > > >> current month. > > > > > > > > > except if I have to specify the specific month I want, then every month > I > > > have to go in and change the codeI would rather be able to have the > > > code > > > "know" that it just needs to look for the most recent date in the > > > table...whatever that may becan that be done? > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
Good :-) You are narrowing the error down :-) Sounds like it's in the date section then. > when i take out the WHERE clause, I get ALL 192 titles in the upper right > side and ALL 192 titles and descriptions in the main body..which is > almost what i want...minus about 180 titles and articles > > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Just for right now, go ahead a make the date change, or elimate the date >> range to get SOMETHING to come out. >> >> >> >> Just change the . date('m') to the actualy month you want if not the >> >> current month. >> > >> > >> > except if I have to specify the specific month I want, then every >> month > I >> > have to go in and change the codeI would rather be able to have >> the >> > code >> > "know" that it just needs to look for the most recent date in the >> > table...whatever that may becan that be done? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
when i take out the WHERE clause, I get ALL 192 titles in the upper right side and ALL 192 titles and descriptions in the main body..which is almost what i want...minus about 180 titles and articles "Daniel Clark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Just for right now, go ahead a make the date change, or elimate the date > range to get SOMETHING to come out. > > > >> Just change the . date('m') to the actualy month you want if not the > >> current month. > > > > > > except if I have to specify the specific month I want, then every month I > > have to go in and change the codeI would rather be able to have the > > code > > "know" that it just needs to look for the most recent date in the > > table...whatever that may becan that be done? > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
* Thus wrote msa ([EMAIL PROTECTED]): > I didn't hand write much of thisdreamweaver writes a lot of it behind > the scenes.i'm not much of a code writer, just get into small needs here > and there...REALLY appreciate all of you trying to help me!!! dreamweaver writes buggy code, you'd be better off learning a little php than relying on dreamweaver. From all this time that people been spending on all these problems, you'd be a decent php programmer by now. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
* Thus wrote msa ([EMAIL PROTECTED]): > > "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > date('m') was not parsed by php as it was in the string. Syntax > > highlighting would help you see it. Try: > > > > "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND > > MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; > > Well, still not working...but maybe closer? Not getting an error message, > just not returning any data. You should pay attention to what your doing. select month('2004-02-02'); 2 echo date('m'); 02 Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
Just for right now, go ahead a make the date change, or elimate the date range to get SOMETHING to come out. >> Just change the . date('m') to the actualy month you want if not the >> current month. > > > except if I have to specify the specific month I want, then every month I > have to go in and change the codeI would rather be able to have the > code > "know" that it just needs to look for the most recent date in the > table...whatever that may becan that be done? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
"Php" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If you have no may articles then there will be no records returned. > > Just change the . date('m') to the actualy month you want if not the > current month. except if I have to specify the specific month I want, then every month I have to go in and change the codeI would rather be able to have the code "know" that it just needs to look for the most recent date in the table...whatever that may becan that be done? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
If you have no may articles then there will be no records returned. Just change the . date('m') to the actualy month you want if not the current month. - Original Message - From: "msa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 04, 2004 3:59 PM Subject: Re: [PHP] Re: repeating data from one column until data from another column changes > - Original Message - > > start code at top of document: > > > > > > > > mysql_select_db($database_jpike, $jpike); > > > $query_rsENews = 'SELECT * FROM NewsArchive WHERE YEAR(date) = ' . > > date('Y') > > > . ' AND MONTH(date) = ' . date('m') . ' ORDER BY sort DESC'; > > > $rsENews = mysql_query($query_rsENews, $jpike) or die(mysql_error()); > > > $row_rsENews = mysql_fetch_assoc($rsENews); > > > > The above line is already fetching the first row from the result. Is this > > what you want at this point of the script? If not put // in front to out > > ocmment it. > > > > > $totalRows_rsENews = mysql_num_rows($rsENews); > > > > Please print out $totalRows_rsENews and post the value. > > > > Have you checked if you have articles with a May date? > > > > Torsten > > > the above code is what dreamweaver writes when I create a connection to the > table in the database... > > there 192 records total and no may records as of yet. I do not understand > why that is pertinent...? there are 10 articles listed for aprilbut > every month varies. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
definitely "Daniel Clark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Netscape browser? > In your browser have you checked View Source to see it table data is there? > > > no. > > > > - Original Message - > > From: "Daniel Clark" <[EMAIL PROTECTED]> > > > > > >> Are you getting any output? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
Netscape browser? In your browser have you checked View Source to see it table data is there? > no. > > - Original Message - > From: "Daniel Clark" <[EMAIL PROTECTED]> > > >> Are you getting any output? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
no. - Original Message - From: "Daniel Clark" <[EMAIL PROTECTED]> Newsgroups: php.general To: "msa" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, May 04, 2004 5:02 PM Subject: Re: [PHP] Re: repeating data from one column until data from another column changes > Are you getting any output? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
Are you getting any output? > > mysql_select_db($database_jpike, $jpike); > $query_rsENews = 'SELECT * FROM NewsArchive WHERE YEAR(date) = ' . > date('Y') > . ' AND MONTH(date) = ' . date('m') . ' ORDER BY sort DESC'; > $rsENews = mysql_query($query_rsENews, $jpike) or die(mysql_error()); > $row_rsENews = mysql_fetch_assoc($rsENews); > $totalRows_rsENews = mysql_num_rows($rsENews); > ?> > > end top code > > start code in body of document: > > > > //this is where I would like to list the titles of the articles for > the > current month > > > > ?> > > > > E-News$theYear = substr($row_rsLatestDate['date'], 0, 4); > $theMonth = substr($row_rsLatestDate['date'], 5, 2); > $theDay = substr($row_rsLatestDate['date'], 8, 2); > $timestamp = mktime(0, 0, 0, $theMonth, $theDay, $theYear); > echo date('F j, Y', $timestamp); > >?> > //this is where i want the list to be title and article > for > the current month > > > > ?> > top > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
- Original Message - > > start code at top of document: > > > > > mysql_select_db($database_jpike, $jpike); > > $query_rsENews = 'SELECT * FROM NewsArchive WHERE YEAR(date) = ' . > date('Y') > > . ' AND MONTH(date) = ' . date('m') . ' ORDER BY sort DESC'; > > $rsENews = mysql_query($query_rsENews, $jpike) or die(mysql_error()); > > $row_rsENews = mysql_fetch_assoc($rsENews); > > The above line is already fetching the first row from the result. Is this > what you want at this point of the script? If not put // in front to out > ocmment it. > > > $totalRows_rsENews = mysql_num_rows($rsENews); > > Please print out $totalRows_rsENews and post the value. > > Have you checked if you have articles with a May date? > > Torsten the above code is what dreamweaver writes when I create a connection to the table in the database... there 192 records total and no may records as of yet. I do not understand why that is pertinent...? there are 10 articles listed for aprilbut every month varies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
Are you looping through the record set? >> "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND >> MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; > > Well, still not working...but maybe closer? Not getting an error message, > just not returning any data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
"Msa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Are you looping through the record set? > > i thought I was, but it isn't working!! > > here is the code with all of the latest suggestions. > > start code at top of document: > > mysql_select_db($database_jpike, $jpike); > $query_rsENews = 'SELECT * FROM NewsArchive WHERE YEAR(date) = ' . date('Y') > . ' AND MONTH(date) = ' . date('m') . ' ORDER BY sort DESC'; > $rsENews = mysql_query($query_rsENews, $jpike) or die(mysql_error()); > $row_rsENews = mysql_fetch_assoc($rsENews); The above line is already fetching the first row from the result. Is this what you want at this point of the script? If not put // in front to out ocmment it. > $totalRows_rsENews = mysql_num_rows($rsENews); Please print out $totalRows_rsENews and post the value. Have you checked if you have articles with a May date? Torsten > ?> > > end top code > > start code in body of document: > > > > file://this is where I would like to list the titles of the articles for the > current month > > > > ?> > > > > E-News$theYear = substr($row_rsLatestDate['date'], 0, 4); > $theMonth = substr($row_rsLatestDate['date'], 5, 2); > $theDay = substr($row_rsLatestDate['date'], 8, 2); > $timestamp = mktime(0, 0, 0, $theMonth, $theDay, $theYear); > echo date('F j, Y', $timestamp); > >?> > file://this is where i want the list to be title and article for > the current month > > > > ?> > top > > > > end code > > > I didn't hand write much of thisdreamweaver writes a lot of it behind > the scenes.i'm not much of a code writer, just get into small needs here > and there...REALLY appreciate all of you trying to help me!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
"Daniel Clark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Are you looping through the record set? i thought I was, but it isn't working!! here is the code with all of the latest suggestions. start code at top of document: end top code start code in body of document: //this is where I would like to list the titles of the articles for the current month E-News //this is where i want the list to be title and article for the current month top end code I didn't hand write much of thisdreamweaver writes a lot of it behind the scenes.i'm not much of a code writer, just get into small needs here and there...REALLY appreciate all of you trying to help me!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
"Daniel Clark" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Are you looping through the record set? > > >> "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND > >> MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; > > > > Well, still not working...but maybe closer? Not getting an error message, > > just not returning any data. Maybe there are no articles with a May date!?! Have you checked that - not you Daniel ;) Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
"Msa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > date('m') was not parsed by php as it was in the string. Syntax > > highlighting would help you see it. Try: > > > > "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND > > MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; > > Well, still not working...but maybe closer? Not getting an error message, > just not returning any data. Could you post the printed $query string? Thanks. Torsten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > date('m') was not parsed by php as it was in the string. Syntax > highlighting would help you see it. Try: > > "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND > MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; Well, still not working...but maybe closer? Not getting an error message, just not returning any data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: repeating data from one column until data from another column changes
"Msa" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > 'SELECT * FROM table WHERE YEAR(date) = ' . date('Y') . ' AND MONTH(date) > = > > ' . date('m') . ' ORDER BY SORT DESC' > > > > What column type is your date column of? I know that the above statement > > works with the MySQL date (-MM-DD) and datetime column types. > > > > Regards, Torsten > > > > > > > > does this help? > > My date format is as aboveI am getting the following error message: > > You have an error in your SQL syntax. Check the manual that corresponds to > your MySQL server version for the right syntax to use near 'Y') . ' AND > MONTH(date) = ' . date('m') . ' ORDER BY sort DESC' > > > I changed your code to fit my table name and "sort" to be lower case, as it > is in the database: > > "SELECT * FROM NewsArchive WHERE YEAR(date) = ' . date('Y') . ' AND > MONTH(date) =' . date('m') . ' ORDER BY sort DESC"; Sorry, my fault. Of course you have to assign this construct to a variable because PHP has to interpret the two date calls: $query = 'SELECT * FROM NewsArchive WHERE YEAR(date) = ' . date('Y') . ' AND MONTH(date) = ' . date('m') . ' ORDER BY sort DESC'; If you echo out $query it should look like: SELECT * FROM NewsArchive WHERE YEAR(date) = 2004 AND MONTH(date) = 05 ORDER BY sort DESC Use $query now in your mysql query command (probably mysql_query()) Hope this works, Torsten > > any ideas? > > thanks again!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: repeating data from one column until data from another column changes
msa wrote: My date format is as aboveI am getting the following error message: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Y') . ' AND MONTH(date) = ' . date('m') . ' ORDER BY sort DESC' I changed your code to fit my table name and "sort" to be lower case, as it is in the database: "SELECT * FROM NewsArchive WHERE YEAR(date) = ' . date('Y') . ' AND MONTH(date) =' . date('m') . ' ORDER BY sort DESC"; any ideas? thanks again!! date('m') was not parsed by php as it was in the string. Syntax highlighting would help you see it. Try: "SELECT * FROM NewsArchive WHERE YEAR(date) = '" . date('Y') . "' AND MONTH(date) ='" . date('m') . "' ORDER BY sort DESC"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php