Jump to content

neo926

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by neo926

  1. That did the trick! That's fantastic, thank you very much! On a side note, would my problem have anything to do with whether my site is running php4 or php5? Right now it's running php4, but I believe I have the option to change to php5. Again, thanks a lot.
  2. No, I don't think it's a short tag issue. I've enable short tags in php.ini, as well as tries just using regular <?php tags, doesn't seem to matter.
  3. I have an RSS feed for my site that pulls data from my MySQL database, so since it's an XML file and uses PHP in it, I have added AddType application/x-httpd-php .xml So that the XML file displays properly. Well, that's been working fine until about a month ago. Our server crashed and our web host had to rebuild it. Well, when they rebuilt it, the XML file no longer displays properly. We actually just moved to a new webhost, but I still seem to be having the same problems. Basically the PHP code in the file isn't being parsed at all. For example: http://secondcitysaint.com.s60090.gridserver.com/rss2.php Here's the code with a .php extension. Works fine. http://secondcitysaint.com.s60090.gridserver.com/rss2.xml But when I change it to a .xml extension, it doesn't work at all. My .htaccess file is correct as far as I know, and as I've said, it used to work, for years, I didn't change anything, but clearly something got screwed up somewhere, and I don't have a clue what it could be. I know that ultimately I could just change my RSS feed to point to the .php extension, but all of my readers already subscribe to the .xml file, so I'd rather not do that if at all possible. Any help would be appreciated.
  4. Well, I'd be more than happy to just pull the year from my submitted column, but I don't know how to do that, since it's in DATE_TIME format.
  5. It works fine without the WHERE clause, it's just when I add it in
  6. I did, the second code box. Here's the full message: Error SQL query: Documentation SELECT DISTINCT ( DATE_FORMAT( submitted, '%M' ) ) AS mymonth, DATE_FORMAT( submitted, '%Y' ) AS myyear, title FROM secondcitysaint WHERE myyear = '2007' ORDER BY submitted DESC LIMIT 0 , 30 MySQL said: Documentation #1054 - Unknown column 'myyear' in 'where clause'
  7. Sorry, I'm using SQL 4.1
  8. SELECT DISTINCT(DATE_FORMAT(submitted,'%M')) AS mymonth , DATE_FORMAT(submitted,'%Y') AS myyear , title FROM secondcitysaint WHERE myyear = '2007' ORDER BY submitted DESC #1054 - Unknown column 'myyear' in 'where clause' I created this temporary column called 'myyear' with the AS function above, and I want to pull data based on a certain year that's listed in the 'myyear' column, but MySQL tells me the column isn't there. Is there a way I can fix this?
  9. [quote author=thorpe link=topic=101190.msg400407#msg400407 date=1153402486] [quote]Go here for RSS & XML reader source code..[/quote] He is creating a feed, not a feed reader. What file extension does this file have? In order to parse the php it'll either need the .php extension, or you'll need to setup your server to parse .xml as php. [/quote] I had it as an .xml file.  What do I need to do to parse .xml as php?
  10. Did I post this in the wrong forum?
  11. So, I'm creating an RSS feed for a site.  It includes PHP code, as it pulls all the latest articles from the site's MySQL database when creating the feed.  However, when I display the XML file, it hasn't processed any of the PHP code I have in the feed.  Basically, my code looks like this: [code]<?php header('Content-type: text/xml'); ?> <rss version="2.0"> <channel> <title>Title</title> <description>Description</description> <link>http://link.com/</link> <copyright>All material copyright 2006 their respective owners</copyright> <?php PHP code pulls data from db ?>     <item>         <title> <?php echo $myrow['title']; ?></title>         <description> <?php echo $myrow['teaser']; ?></description>         <link>http://link.com/index.php?id=<?php echo $myrow['id']; ?></link>     </item>    <?php } ?> </channel> </rss> [/code] Now, I know this feed works, as it's basically the same code I have on a different site, and there are no problems displaying the RSS feed.  On this site, however, when you click on the XML link, it takes you to the XML page, only all the PHP code is sitting there, completely unparsed. Is there something the site's server might not be capable of doing that is causing this problem?  Or am I not including something I should be?  Help!
  12. So, I have a sports writing site. I have a form set up for my writers so they can submit their columns (Title, Column content, etc.). The data input is processed and submitted to my MySQL database. The problem with this is that the writers can't see what the final product is going to look like on the mainpage, to make sure they have everything formatted properly. I want to add a button next to the 'submit' button that will open up a new page that will process the data and display it on a preview page, so they know how it's going to look on the mainpage. I don't know how to do this. I already have the form set up like this: [code]<form method="post" action="<?php echo $PHP_SELF ?>">[/code] So I don't know how I can redirect the form information into this new page to preview the data using a preview button instead of submitting the data to the database. Any help would be appreciated.
  13. You have totally just jumped about 1,000 spots up on my 'Cool' list. Outstanding! Thank you so much!
  14. What a fun topic name that is. Okay, this is the last big challenge for me and my site. As I've said in my earlier threads, I have a db that contains columns that are posted for a sports site. One of the fields in my table that contains the column information is the specific sport being written about. Another field contains the name of the author of the column. So, what I would like to do is query the db to achieve the following display result: Table contains: Sport Author NFL Mark MLB Joe NFL Matt NBA John MLB Steve Query displays: NFL Mark Matt MLB Joe Steve NBA John Now I know I can use the SELECT DISTINCT(sport) to display each sport individually. But can this be used in conjunction somehow with another function to get the names of the authors of said sport to display underneath? I would appreciate any help on this matter.
  15. Well, I actually had two problems. The first was, in fact, a query error. The other problem was due to the fact that the table I was trying to access was named 'columns', which I learned is a flagged word, and I had to put it in ' ' for the code to process properly.
  16. Okay, I don't know the proper way to query my db, and I'm not adept enough to find what I'm looking for in the MySQL Manual. So, I have a table that contains all my data for various sports columns that have been written. I have fields for author, sport, title, content, and date submitted. What I would like is to be able to query the db in a way so that it can recall the different sports that have been written about, but I don't want the same sport repeated. For example, let's say that there are currently 7 columns in the db, and if I were to recall the sports field on each column I would get the following list: football baseball football soccer hockey hockey basketball I want to be able to query the db and have it give me the following list instead: football baseball soccer hockey That way any duplicate entries aren't produced. Thanks in advance for any help.
  17. I'm not going to pretend to know what I'm talking about, but doesn't he need: [code]<form name="create_form" method="post" action="<?php echo $PHP_SELF ?>"> [/code] his form tag to look like that? Otherwise the form isn't sending the data anywhere.
  18. Thanks fenway. I ended up getting it figured out.
  19. Thanks for the help so far, fenway. 1. I'll do that, I wasn't aware that was bad. Thanks for the heads up. 2. Yeah, I should do that. 3. Thanks. Kind of obvious now that you mention it. 4. Okay, so I altered my code accordingly: [code]                if (!$id) {                 $result = mysql_query("SELECT *,DATE_FORMAT(date,'%M %e, %Y, %l:%i %p') AS mydate FROM sportatory ORDER BY date DESC",$dbh);                     if (mysql_num_rows($result)) {                         while ($myrow = mysql_fetch_array($result)) {                             printf("<table class=transparent cellpadding=0 cellspacing=2>                                 <tr>                                     <td><img src=\"images/%s.gif\"></td>                                     <td><font class=tiny color=#707070><b>%s</font></b><br>                                     <a href=\"%s?id=%s\">%s</a><font class=small> by %s</font></td>                                 </tr>                                 <tr>                                     <td></td>                                 </tr>                             </table>"                             , $myrow["sport"], $myrow["mydate"], $PHP_SELF, $myrow["id"], $myrow["title"], $myrow["author"]);                         }                     } else {                         echo 'There are no columns to display currently.  Please try back again later.';                     }                 } [/code] and now I get [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/******/public_html/sportsoratory/staff/index.php on line 167[/quote] I'm assuming I'm still missing a piece of the puzzle?
  20. I have a couple questions, my primary question is regarding my attempt to recall and load data already in a MySQL database into a form I have on a webpage. So, this is for a sports column site. I have fields in the table in the database for a unique column id, author's name, sport being written about, the title of the column, the date it was submitted, and the actual body of the column. Here is the code that I used to display the form and load the record from the database: [code]if ($id) { $sql = "SELECT * FROM columns WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); $sport = $myrow["sport"]; $title = $myrow["title"]; $content = $myrow["content"]; ?> <input type=hidden name="id" value="<?php echo $id ?>"> Category: <form method="post" action="<?php echo $PHP_SELF ?>"> <select name="sport"> <option value="<?php echo $sport ?>" selected><?php echo $sport ?> <option value="NFL">NFL <option value="NBA">NBA <option value="MLB">MLB <option value="NHL">NHL <option value="Soccer">Soccer <option value="Boxing-MMA">Boxing-MMA <option value="NCAA Football">NCAA Football <option value="NCAA Basketball">NCAA Basketball </select> <br> Column Title: <br> <input type="Text" name="title" value="<?php echo $title ?>" size=65><br> Column: <br> <textarea name="content" rows=30 cols=50 wrap="soft" value="<?php echo $content ?>"></textarea><br> <br> <input type="Submit" name="submit" value="Post/Edit Column"> <input type="reset" value="Clear Record"> </form> [/code] Now, everything displays fine, except for the $content, or the actual body of the column. For whatever reason, only a portion of the column gets displayed in the text area box. It's not even that the text gets cut off at a certain point, it doesn't display the first part of the column, just the end portion of it. I'm quite perplexed on why this is happening. I mean, if I'm posting a new column using this form, it all gets submitted to my database no problem, it's just when I recall it that I run into this problem. Any help would be appreciated. My second question is regarding displaying a list of records pulled from a database. So, the mainpage of this site has a list of the columns that are currently posted using the following code: [code]    if (!$id) { $result = mysql_query("SELECT *,DATE_FORMAT(date,'%M %e, %Y, %l:%i %p') AS mydate FROM columns ORDER BY date DESC",$dbh); while ($myrow = mysql_fetch_array($result)) { printf("<table class=transparent cellpadding=0 cellspacing=2>         <tr>             <td><img src=\"images/%s.gif\"></td>             <td><font class=tiny color=#707070><b>%s</font></b><br>             <a href=\"%s?id=%s\">%s</a><font class=small> by %s</font></td>         </tr>         <tr>             <td></td>         </tr>     </table>"         , $myrow["sport"], $myrow["mydate"], $PHP_SELF, $myrow["id"], $myrow["title"], $myrow["author"]);     } } [/code] Now, at the moment, since the site isn't up yet, there aren't any columns to post, so when this code is processed, I get this fun little error displayed: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/*****/public_html/sportsoratory/index.php on line 56[/quote] Now, I get why this error is displayed. My question is, how can I have it so that in the event that there isn't any data to pull when it goes to query the database, I can have an alternate message pop saying "No data was found" or something like that? Thanks in advance.
×
×
  • 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.