Jump to content

shane85

Members
  • Posts

    128
  • Joined

  • Last visited

    Never

Everything posted by shane85

  1. I commented out all of the rss so it would echo $count, and whether "ticker" has text in it, or its empty, all $count displays is 1
  2. when I add that all it does is cause it to be feed code error, and not dispaly the page...here is the php again // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2' AND ticker IS NOT NULL")or die(mysql_error()); //$result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); $count = mysql_num_rows($result); echo $count ; if(@mysql_num_rows($result)==0){ die('No data available'); } header('Content-type: application/xml'); echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n"; ?>
  3. wow is this ever frustrating....I tried echoing result, and all it did was cause the page not to be displayed and say "feed code error"....what is wrong??? you will notice ive tried 3 different querys, I just commented out the ones im not using // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); //$result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2' AND ticker IS NOT NULL AND ticker <> ''")or die(mysql_error()); $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2' AND ticker IS NOT NULL")or die(mysql_error()); //$result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); echo "$result"; if(mysql_num_rows($result)==0){ exit('No data available'); } header('Content-type: application/xml'); echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "</item>\n"; } /echo "</channel>\n"; echo "</rss>\n"; ?>
  4. I used that code Mark and now the RSS page will not display...I get "Feed Code Error"
  5. Mark - it is a varchar type...sorry for the newbie question but how would I do that??
  6. im really sorry guys....still not working....below im posting the entire script for the page, except without the database connection details...it is as follows // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2' AND ticker IS NOT NULL")or die(mysql_error()); //$result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); if(mysql_num_rows($result)==0){ exit('No data available'); } header('Content-type: application/xml'); echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; echo "<link>http://www.website.ca</link>\n"; while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n"; ?>
  7. tried...oof..same thing happens...I dont see why it isnt exiting the page?? doesnt make sence??
  8. I took the @ out and it still displays the page and doesnt die...is it because im not specifically mentioning the ticker row in that statement??? sorry been trying to figure this out the whole weekend...still not working ahhh
  9. hey guys...I have this line in my code $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); if(@mysql_num_rows($result)==0){ die('No data available'); } and what I am trying to achieve is that if the row TICKER in host_locations is empty, to die and not load the rets of the page...however even with it being empty, the above code seems to do nothing except load the page (rss page) with just blank data but still setup like an rss page...whats wrong?
  10. CHANGE OF APPROACH im trying something different, which is loading the rss page, however not exiting when there is no data in the row ticker in the database...whats wrong...heres the lowerhalf of the code without the databse connectino details. What I am trying is if(@mysql_num_rows($result)==0){ die('No data available'); } but do I have to identify the ticker row in that statement? What im trying to say is if the ticker row is blank, dont load the page! // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); if(@mysql_num_rows($result)==0){ die('No data available'); } header('Content-type: application/xml'); echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; echo "<link>http://www.website.ca</link>\n"; while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "<description></description>\n"; echo "<pubDate></pubDate>\n"; echo "<link>http://www.website.ca/testing/rss/test.php?post=$row->location_id</link>\n"; echo "<atom:link href=\"http://www.website.ca/testing/rss/test.php?post=$row->location_id\" rel=\"self\" type=\"application/rss+xml\"/>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n";
  11. sorry to ask such a newbie question I just cant think right now....how would I define it ??? its in the table host_locations and the row is called ticker ... normally on my pages I have a session created and I use $ticker= $_SESSION["SESS_TICKER"]; but im not using a session on this page...this one will be strictly so that the software can point to it
  12. I have this rss file that works perfectly however I put in an IF statement so that if the row ticker in my database is empty, I dont want it to display the rss page, rather just die and display txt saying "ticker is empty or not set" what happens when the if statement is in is it doesnt display the rss page, it says ------------------ The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click refresh button, or try again later. Invalid at the top level of the document. Ticker is empty or not set ^ ------------------ however, the row ticker in my database is not empty and does have text. when I remove the if statement, it works perfectly. The php file is as follows <?php header('Content-type: application/xml'); $dbhost = 'localhost'; $dbuser = 'username'; $dbpass = 'password'; $dbname = 'name'; // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); If (empty($ticker)){ die("Ticker is empty or not set"); //Display an error and kill page. } else { // begin to display the rss for the if statement echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; echo "<link>http://www.website.ca</link>\n"; $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "<description></description>\n"; echo "<pubDate></pubDate>\n"; echo "<link>http://www.website.ca/testing/rss/test.php?post=$row->location_id</link>\n"; echo "<atom:link href=\"http://www.website.ca/testing/rss/test.php?post=$row->location_id\" rel=\"self\" type=\"application/rss+xml\"/>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n"; } // end the if statement for ticker ?> again, if I remove everything to do with that IF statement, it displays the rss page correctly without any problems
  13. wont let me do var dump...maybe because its an xml file? seems like any kind of code I put in just seems to screw up the file
  14. HA! it works!! Thank you very much...again, this board is great...great members
  15. sorry guys....last time...whats wrong??? now its displaying in kinda in a style sheet but saying The XML Page Cannot Be Displayed Cannot view XML using style sheet ..... and heres the bottom half of my code again..its also saying "ticker is empty or not set" however I do have text in my ticker field in the database // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); If (empty($ticker)){ die("Ticker is empty or not set"); //Display an error and kill page. } else { echo "Page is valid."; // Write code here if $ticker is valid echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; echo "<link>http://www.fireshock.ca</link>\n"; $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "<description></description>\n"; echo "<pubDate></pubDate>\n"; echo "<link>http://www.fireshock.ca/testing/rss/test.php?post=$row->location_id</link>\n"; echo "<atom:link href=\"http://www.fireshock.ca/testing/rss/test.php?post=$row->location_id\" rel=\"self\" type=\"application/rss+xml\"/>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n"; } ?>
  16. I SOMEWHAT got it to work...it takes it out....I have it like <?php if ($SESSION['$_SESSION['SESS_LOCATION_ID']' == false) { echo ' <div id="login_box"> <form id="loginForm" name="loginForm" method="post" action="login-exec.php"> <fieldset> <p>Username:</p> <input name="login" type="text" class="png_bg" id="login" /> </fieldset> <fieldset> <p>Password:</p> <input name="password" type="password" class="png_bg" id="password" /> </fieldset> <fieldset> <button id="login_btn" type="submit"></button> </fieldset> </form> </div> ';// Whatever HTML your login form has } else { echo ""; // if its logged in, I dnot want it to display anything in this area } ?> but am getting this error Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/content/website/_include_login.php on line 3
  17. oni-kun - thanks alot for reply to both of my threads...your going above and beyond! hate to bug you again, I tried it, and have it displayed like so in the login_include file <?php if ($SESSION['loggedin'] == false) { echo ' <div id="login_box"> <form id="loginForm" name="loginForm" method="post" action="login-exec.php"> <fieldset> <p>Username:</p> <input name="login" type="text" class="png_bg" id="login" /> </fieldset> <fieldset> <p>Password:</p> <input name="password" type="password" class="png_bg" id="password" /> </fieldset> <fieldset> <button id="login_btn" type="submit"></button> </fieldset> </form> </div> ';// Whatever HTML your login form has } else { echo ""; // if its logged in, I dont want it to display anything in this area } but what I log in, it is still there...what do I need to include in my login script for this to work? I have included a snipit from my login script that registers variables into the session....what do I need to change? again...thank you session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_LOCATION_ID'] = $member['location_id']; $_SESSION['SESS_COMPANY_NAME'] = $member['company_name']; $_SESSION['SESS_ADDRESS'] = $member['address']; $_SESSION['SESS_CITY'] = $member['city']; $_SESSION['SESS_PROVINCE'] = $member['province']; $_SESSION['SESS_POSTAL_CODE'] = $member['postal_code']; $_SESSION['SESS_FIRST_NAME'] = $member['contact_firstname']; $_SESSION['SESS_LAST_NAME'] = $member['contact_lastname']; $_SESSION['SESS_CONTACT_PHONE'] = $member['contact_phone']; $_SESSION['SESS_CONTACT_EMAIL'] = $member['contact_email']; $_SESSION['SESS_COMPANY_LOGO'] = $member['company_logo']; $_SESSION['SESS_TICKER'] = $member['ticker']; session_write_close(); header("location: venue.php"); exit();
  18. I took out the IF statement and currently have it like this <?php header('Content-type: application/xml'); $dbhost = 'localhost'; $dbuser = 'user'; $dbpass = 'pass'; $dbname = 'name'; // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; echo "<link>http://www.website.ca</link>\n"; $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "<description></description>\n"; echo "<pubDate></pubDate>\n"; echo "<link>http://www.website.ca/testing/rss/test.php?post=$row->location_id</link>\n"; echo "<atom:link href=\"http://www.websote.ca/testing/rss/test.php?post=$row->location_id\" rel=\"self\" type=\"application/rss+xml\"/>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n"; var_dump($ticker); and it displays http://www.website.ca http://www.website.ca/testing/rss/test.php?post=2 NULL ahhhhhh I had this working before...just without the IF ... lol
  19. I just want to say thanks in advance...this website has been EXTREMELY helpful in getting me through everything...im new to this but quickly learning and agian, thnx in advance. I have attatched an image of my login/pass fields....the html is as follows <div id="login_box"> <form id="loginForm" name="loginForm" method="post" action="login-exec.php"> <fieldset> <p>Username:</p> <input type="text" id="user" class="png_bg"/> </fieldset> <fieldset> <p>Password:</p> <input type="password" id="pass" class="png_bg" /> </fieldset> <fieldset> <button id="login_btn" type="submit"></button> </fieldset> </form> <!--#login--></div> very straight forward... what I would like to do is once the user is logged in and the session is created, to kill that text...I had a website done in the past which used a template file and I was able to put a tag before the above html like <!-- BEGIN login --> and after i twas done, end it with <!-- END login --> it was very easy and straight forward...what would the best way to achieve this be without using this template file? Basically I want it so when a user is logged in, the login fields arent there to see, or to re-login...might as well just take them out thanks again [attachment deleted by admin]
  20. but if I take out that IF statement, it displays correctly...only when the IF statement is in does it not display the page properly
  21. thank you for your help...I tried that, but it didnt work...perhaps it is because it is an rss file??? I have posted the code below would you mind telling me what I have done wrong? I get "feed code error" on title of page, and nothing displays <?php header('Content-type: application/xml'); $dbhost = 'localhost'; $dbuser = 'my_user_name'; $dbpass = 'my_password_name'; $dbname = 'my_database_name'; // make a connection to mysql here $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ("I cannot connect to the database because: " . mysql_error()); mysql_select_db ($dbname) or die ("I cannot select the database '$dbname' because: " . mysql_error()); // begin IF statement for ticker If (empty($ticker)){ die("Ticker is empty or not set"); //Display an error and kill page. } else { echo "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n"; echo "<channel>\n"; echo "<title>RSS Feed</title>\n"; echo "<link>http://www.mywebsite.ca</link>\n"; $result = mysql_query("SELECT location_id, ticker FROM host_locations WHERE location_id='2'")or die(mysql_error()); while ($row = mysql_fetch_object($result)) { echo "<item>\n"; echo "<title>$row->ticker</title>\n"; echo "<description></description>\n"; echo "<pubDate></pubDate>\n"; echo "<link>http://www.mywebsite.ca/test.php?post=$row->location_id</link>\n"; echo "<atom:link href=\"http://www.mywebsote.ca/test.php?post=$row->location_id\" rel=\"self\" type=\"application/rss+xml\"/>\n"; echo "</item>\n"; } echo "</channel>\n"; echo "</rss>\n"; // end of IF statement for ticker }
  22. hey guys....im trying to do an if/then statement involivng my mysql db... basically what I want to achieve is IF $ticker (a row in my database) is blank, die, and do not load the page, however IF $ticker has any sort of text in the row, continue loading the page...I was thinking something like if ($ticker='') { die; but obvioustly thats not correct...im a newbie so any help would be appreciated
  23. actually I guess I need just the title field to be displayed...I setup the script exactly like that tutorial showed and when I point my software to the link it displays it and scrolls it as Title 3 -- Title 2 -- Title 1 -- doesnt show any of the content oranything....so I guess I just need to display the title field...how can I achieve this? Again, this webpage wont even need to be accessed by anyone online, rather just have the software pointed at it so it can scroll on the screens....is there a way to set it up so it doesnt have tables with "RSS FEED" in yellow at the top and all of it done in tables....ideally I would just like to display just the text on the page, nothing else what so ever
  24. I followed the tutorial and was able to create the rss feed...however is there a way to create a feed with just a description??? I dont need title or anything, I just need the software to read the page and just display the title.
×
×
  • 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.