Jump to content

barniegilly

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

barniegilly's Achievements

Member

Member (2/5)

0

Reputation

  1. I tried that with the following code but this error XML Parsing Error: junk after document element Location: http://localhost/HorseEventsUk/events-feed2.php Line Number 2, Column 1:<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'> ^ <?php require_once("includes/connections.php"); require_once("includes/functions.php"); require_once("backend/includes/twd_functions.php"); function EchoRowItem($row,$item_name,$as_html,$row_item_name=null) { if ($row_item_name) $item_value=htmlentities($row[$row_item_name]); else $item_value=htmlentities($row[$item_name]); return EchoTag($item_name,$item_value,$as_html); } function EchoTag($item_name,$item_value,$as_html) { $s='<'.$item_name.'>'.$item_value.'</'.$item_name.'>'; if ($as_html) echo htmlentities($s).'<br />'; else return $s; } function FindVenueCountyName($venue_id) { $sql="SELECT county_id FROM `venue` WHERE ven_id='$venue_id' LIMIT 1;"; $county_id=FindMySQLResultValue($sql,'county_id'); return ucfirst(FindCountyName($county_id)); } function FindVenueCountyId($venue_id) { $sql="SELECT county_id FROM `venue` WHERE ven_id='$venue_id' LIMIT 1;"; return FindMySQLResultValue($sql,'county_id'); } function FindVenuePostcode($venue_id) { $sql="SELECT post_code FROM `venue` WHERE ven_id='$venue_id' LIMIT 1;"; return FindMySQLResultValue($sql,'post_code'); } function BuildEventURL($event_id,$county_id) { return 'http://horseeventsuk.com/event?url_countyid='.$county_id.'&url_eventid='.$event_id; } $output_as_html=false; if ($output_as_html) echo '<html><head><title>Events Feed</title></head><body><h1>Events Feed</h1>'; $xml='<events>'; $sql="SELECT * FROM `events` WHERE event_status='live' ORDER BY event_created DESC LIMIT 10;"; $result=mysql_query($sql); if ($result) { while ($row=mysql_fetch_array($result)) { $event_id=$row['event_id']; $venue_id=$row['ven_id']; $county_id=FindVenueCountyId($venue_id); //print("Found event ".$event_id.'<br />'); $xml.='<event>'; $xml.=EchoRowItem($row,'eventid',$event_id); $xml.=EchoRowItem($row,'title',$output_as_html); $xml.=EchoRowItem($row,'description',$output_as_html,'event_details'); $xml.=EchoTag('contact_email','gilly@rackfield.co.uk',$output_as_html); $xml.=EchoTag('county',FindVenueCountyName($venue_id),$output_as_html); $xml.=EchoTag('postcode',FindVenuePostcode($venue_id),$output_as_html); $xml.=EchoTag('website_address',BuildEventURL($event_id,$county_id),$output_as_html); $xml.=EchoRowItem($row,'startdate',$output_as_html); $xml.=EchoTag('category','Animals, Convservation',$output_as_html); $xml.=EchoTag('category','Sport',$output_as_html); $xml.=EchoTag('category','Exhibitions, Shows',$output_as_html); $xml.='</event>'; } } $xml.='</events>'; if ($output_as_html) echo '</body></html>'; else { // serve the xml file header("Content-type: text/xml"); echo '<?xml version="1.0" encoding="UTF-8"?>'; echo $xml; } exit; ?>
  2. I am working on a feed but am getting the nesting wrong, the </event> is appearing at the end of the whole feed and not at the end of the particular event. Here is a link to the feed http://www.horseeventsuk.com/events-feed-test.php and my code is ?> <?php :'( $output_as_html=false; if ($output_as_html) echo '<html><head><title>Events Feed</title></head><body><h1>Events Feed</h1>'; $xml='<events>'; $sql="SELECT * FROM `events` WHERE event_status='live' ORDER BY event_created DESC LIMIT 3;"; $xml.='<event>'; $result=mysql_query($sql); if ($result) { while ($row=mysql_fetch_array($result)) { $event_id=$row['event_id']; $venue_id=$row['ven_id']; $county_id=FindVenueCountyId($venue_id); //print("Found event ".$event_id.'<br />'); $xml.=EchoRowItem($row,'title',$output_as_html); //$xml.=EchoRowItem($row,'description',$output_as_html,'event_details'); $xml.=EchoTag('contact_email','gilly@rackfield.co.uk',$output_as_html); $xml.=EchoTag('county',FindVenueCountyName($venue_id),$output_as_html); $xml.=EchoTag('postcode',FindVenuePostcode($venue_id),$output_as_html); $xml.=EchoTag('website_address',BuildEventURL($event_id,$county_id),$output_as_html); $xml.=EchoRowItem($row,'startdate',$output_as_html); $xml.=EchoTag('category','Animals, Convservation',$output_as_html); $xml.=EchoTag('category','Sport',$output_as_html); $xml.=EchoTag('category','Exhibitions, Shows',$output_as_html); } } $xml.='</event>'; $xml.='</events>'; if ($output_as_html) echo '</body></html>'; else { // serve the xml file header("Content-type: text/xml"); echo '<?xml version="1.0" encoding="UTF-8"?>'; echo $xml; } exit; 18084_.php
  3. hi silly little question but if I want to bracket something inside PHP how do I do it eg my code is <th class="alignright"><?php echo $ass_descrip; ?> (<?php echo $ass_accro ; ?>) <?php echo FindTypeName ($type_id); ?></th> printing out British Eventing (BE) But the brackets at the moment are outside the PHP I want to put a conditional on it and include the brackets inside my conditional statement.?
  4. This is all the PHP <?php // 2. NEW USER REGISTRATION<br /> include_once ("../includes/form_functions.inc.php"); // START FORM PROCESSING FOR A NEW REGISTRATION if (isset($_POST['newvenue'])) { // Form has been submitted. $errors = array(); // perform validations on the form data $required_fields = array('ven_name', 'town', 'ven_website'); $errors = array_merge($errors, check_required_fields($required_fields, $_POST)); $fields_with_lengths = array('ven_name' => 100, 'street' => 60,'area' => 50, 'town' => 30, 'post_code' => 10, 'ven_website' => 100); $errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST)); $ven_name = trim(ucwords(mysql_prep($_POST['ven_name']))); $street = trim(ucwords(mysql_prep($_POST['street']))); $area = trim(ucwords (mysql_prep($_POST['area']))); $town = trim(ucwords (mysql_prep($_POST['town']))); $area = trim(ucwords (mysql_prep($_POST['area']))); $county_id = mysql_prep($_POST['county_id']); $post_code = trim(mysql_prep($_POST['post_code'])); $ven_contact = trim(ucwords(mysql_prep($_POST['ven_contact']))); $ven_email = trim(mysql_prep($_POST['ven_email'])); $ven_website = trim(strtolower(mysql_prep($_POST['ven_website']))); $ven_telno = (mysql_prep($_POST['ven_telno'])); $userid = $_POST['user_id']; if ( empty($errors) ) { $query = "INSERT INTO venue (ven_name, street, area, town, county_id, post_code, ven_contact, ven_email, ven_website, ven_telno, user_id) VALUES ('{$ven_name}', '{$street}', '{$area}', '{$town}', '{$county_id}', '{$post_code}', '{$ven_contact}', '{$ven_email}','{$ven_website}', '{$ven_telno}', '{$userid}' )"; $result = mysql_query($query, $connection); if ($result) { $message = redirect_to("controlpanel.php"); } else { $message = "I am sorry but the venue could not be created."; $message .= "<br />" . mysql_error(); } } else { /* this counts the number of errors and informs the user of how many fields were incorrectly entered*/ if (count($errors) == 1) { $message = "There was 1 error in the form."; } else { $message = "There were " . count($errors) . " errors in the form."; } } } else { // Form has not been submitted. $ven_name = ""; $street = ""; $area = ""; $town = ""; $area = ""; $county_id = ""; $post_code = ""; $ven_contact = ""; $ven_telno = ""; $ven_email = ""; $ven_website = ""; $userid = ""; } ?> This is the form <form id="newvenue" action="newvenue.php" method="post"> <?php if (!empty ($message)) {echo "<p class=\"message\">" . $message . "</p>";}?> <?php if (!empty ($errors)) {display_errors($errors); }?><br /> <table id="neweventdisplay" cellpadding="5" border="0"> <tr> <td></td> <td></td> <td><input type="hidden" name="user_id" value="<?php echo $url_userid ['user_id']; ?>" /></td> </tr> <tr> <td><span class="compuls">*</span></td> <td class="heading">Venue Name</td> <td><input class="input50px" id="ven_name" name="ven_name" type="text" value="<?php echo htmlentities($ven_name); ?>" /></td> </tr> </table> I have checked my CSS and cannot see any code that would be changing anything
  5. Hi I have the following for an input form, I was under the impression that ucwords would format the text into Initial Characters, but this does not do that? What have I done wrong? $ven_name = trim(ucwords(mysql_prep($_POST['ven_name'])));
  6. hi all thank you for your help this is the code that is working for me, thank you for your help <?php $website = $org_website; $link = 'http'; $weblink = strpos ($website,$link); if ($weblink !== FALSE ) { echo "<a href=\"$org_website\" target=\"_blank\"> $org_name </a>"; } else { echo FindOrganiserName($org_id); } ?>
  7. Hi I have a page pulling information from mysql table, it lists names, I have these inside a hyperlink so that where there is a website listed for that record then the user can click on the name and move to their website. Only thing is that what happens if there is not a website for that record. I wanted a script so that if there is a website address listed then it prints the hyperlink but where there is not a website address listed that only the name is printed and it is not a hyperlink. I understand that the strpos can be used for this I have written a script but it is only printing out the name even when there is a website address in the row. What is wrong? PHP Version 5.3.4 Any help very much appreciated <?php $website = $org_website; $link = 'http'; $weblink = strpos ($website,$link); if ($weblink === !false) { echo "<a href=\"$org_website;\"> FindOrganiserName($org_id); \"> FindOrganiserName($org_website); </a>"; } else { echo FindOrganiserName($org_id); } ?>
  8. Hi thanks for that, I think I will need to outsource this as beyond what I can do, just need to know which way to go so thank you for your help.
  9. Hi I have tried the mysql forum but have had no joy with an answer to my problem so wondered if php would be better. I want my users to be able to select from 5 different drop down lists where they can chose any combination from 1 up to all 5, I have attached the front end. These lists are being populated from mysql tables. Code for the drop down lists is as follows <form action="horse-events-devon.php?url_countyid=<?php echo urlencode ($url_countyid ['url_countyid']) ; ?>&go" method="POST"> <table id="searchtable"> <tr> <th>Find By Discipline</th> <th>Find By Venue</th> <th>Find By Championship</th> <th>Find By Organiser</th> <th>Equine Association</th> <th>Submit Your Selections</th> </tr> <tr> <td><select name="dis_id"> <?php $upcomingdis = upcomingdis($url_countyid); $upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis); ?> <?php do { ?> <option value="<?php echo $upcoming_dis_bycounty ['dis_id']; ?>" > <?php echo $upcoming_dis_bycounty ['dis_description']; ?></option> <?php } while ($upcoming_dis_bycounty = mysql_fetch_assoc ($upcomingdis)); ?></select></td> <td><select name="ven_id"> <?php $upvenbycounty_set = upcoming_venevents_bycounty($url_countyid); $upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_ven_bycounty ['ven_id']; ?>" > <?php echo $upcoming_ven_bycounty ['ven_name']; ?></option> <?php } while ($upcoming_ven_bycounty = mysql_fetch_assoc ($upvenbycounty_set)); ?></select></td> <td><select name="champ_id"> <?php $championship_set = findchampionships(); $champlist = mysql_fetch_assoc ($championship_set); ?> <?php do { ?> <option value="<?php echo $champlist ['champ_id']; ?>" > <?php echo $champlist ['champ_description']; ?></option> <?php } while ($champlist = mysql_fetch_assoc ($championship_set)); ?></select></td> <td> <select name="org_id"> <?php $uporgbycounty_set = upcoming_organevents_bycounty($url_countyid); $upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_org_bycounty ['org_id']; ?>" ><?php echo $upcoming_org_bycounty ['org_name']; ?></option> <?php } while ($upcoming_org_bycounty = mysql_fetch_assoc ($uporgbycounty_set)); ?></select> </td> <td><select name="ass_id"> <?php $upassbycounty_set = upcoming_assevents_bycounty($url_countyid); $upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set); ?> <?php do { ?> <option value="<?php echo $upcoming_assbycounty ['ass_id']; ?>" > <?php echo $upcoming_assbycounty ['ass_description']; ?></option> <?php } while ($upcoming_assbycounty = mysql_fetch_assoc ($upassbycounty_set)); ?></select></td> <td><input name="submit" type="submit" /><input name="countyid" type="hidden" value="<?php echo $url_countyid ['url_countyid']; ?>" /></td> </tr> </table> </form> My search processing is as follows <?php if (isset($_POST['submit'])){ if (isset($_GET['go'])){ $countyid = $_POST['countyid']; $ven_id = $_POST['ven_id']; $dis_id = $_POST['dis_id']; $champ_id = $_POST['champ_id']; $org_id = $_POST['org_id']; $event_id = $row['event_id']; $sql = "SELECT DATE_FORMAT (events.startdate, '%a, %d, %b') AS stdate, events.event_id, events.title, events.ven_id, events.org_id, venue.county_id, venue.ven_id, eventdisciplines.event_id, eventdisciplines.dis_id, county.county_id, discipline.dis_id \n" . "FROM events \n" . "LEFT OUTER JOIN eventdisciplines \n" . "ON events.event_id = eventdisciplines.event_id \n" . "LEFT OUTER JOIN discipline \n" . "ON eventdisciplines.dis_id = discipline.dis_id \n" . "LEFT OUTER JOIN venue \n" . "ON events.ven_id = venue.ven_id \n" . "LEFT OUTER JOIN county \n" . "ON venue.county_id = county.county_id \n" . "WHERE events.ven_id = ({$ven_id} OR events.org_id = {$org_id})\n" . "AND events.startdate > NOW()\n" . "AND venue.county_id = {$countyid} \n" . "ORDER BY startdate ASC"; $result = mysql_query ($sql, $connection); ?> How am I best to do this please? my OR within the mysql does not work, should I not be doing this with php in the search processing? someones help would really be appreciated, just to point me in the right direction. [attachment deleted by admin]
  10. This is the front end to my selection form, should I be using php instead of the mysql side? [attachment deleted by admin]
  11. I have worked on it a little more this is now my mysql query $sql = "SELECT DATE_FORMAT (events.startdate, '%a, %d, %b') AS stdate, events.event_id, events.title, events.ven_id, events.org_id, venue.county_id, venue.ven_id, eventdisciplines.event_id, eventdisciplines.dis_id, county.county_id, discipline.dis_id \n" . "FROM events \n" . "LEFT OUTER JOIN eventdisciplines \n" . "ON events.event_id = eventdisciplines.event_id \n" . "LEFT OUTER JOIN discipline \n" . "ON eventdisciplines.dis_id = discipline.dis_id \n" . "LEFT OUTER JOIN venue \n" . "ON events.ven_id = venue.ven_id \n" . "LEFT OUTER JOIN county \n" . "ON venue.county_id = county.county_id \n" [i] . "WHERE (events.ven_id = {$ven_id} AND events.org_id = {$org_id}) \n"[/i] . "AND events.startdate > NOW()\n" . "AND venue.county_id = {$countyid} \n" . "ORDER BY startdate ASC"; I want the user's form as shown on my screen print to be able to either have one or more choices entered, I am unsure of the correct mysql and believe the line that I need to change is as indicated. My code works with both variables entered but My query needs to be and 'AND' 'OR'.
  12. Hi am working on this script and need a little help with the MYSQL bit, The front end is a table with 4 choices where the user can choose either one choice or a combination of choices. I have it working where if they just choose the venue it returns the correct answer however am not coding the rest of the mysql correctly when multipule choices are entered. The database structure consists of multiple tables. My Mysql query is this so far $sql = "SELECT * \n" . "FROM events \n" . "LEFT OUTER JOIN eventdisciplines \n" . "ON events.event_id = eventdisciplines.event_id \n" . "LEFT OUTER JOIN discipline \n" . "ON eventdisciplines.dis_id = discipline.dis_id \n" . "LEFT OUTER JOIN venue \n" . "ON events.ven_id = venue.ven_id \n" . "LEFT OUTER JOIN county \n" . "ON venue.county_id = county.county_id \n" . "WHERE events.startdate > NOW()\n" . "AND events.ven_id = {$ven_id} \n"; The key search criteria is on the county_id and events >NOW from there on it needs to be so that if either of the selections of are made that it returns the records. The logic is that if events.county_id = 2 and events.startdate is greater then today with events.ven_id = 2 and / or events.dis_id = 3 then return the rows. Just missing that and or bit of the mysql I think, unless there is another way I should be doing it. PS JUST READ THE RULES!! MySQL client version: mysqlnd 5.0.7-dev - 091210 - $Revision: 304625 $ [attachment deleted by admin]
  13. Having a thick moment!! what is wrong with my if condition statement. I am looking to have a list of regions and then where the counties id = the regions id the counties show under the counties. Both counties and regions are in a mysql table. This is my php <?php $regions_set = findregion(); while ($regions = mysql_fetch_array ($regions_set)){ echo "<ul>"; echo "<li><a href=\"viewevents.php?url_regionid=" .urlencode ($regions ['region_id']) . "\">" . $regions ['region_description'] . "</a></li>"; $regioncounties_set = findregionscounties(); while ($regioncounties = mysql_fetch_array ($regioncounties_set)){ echo "<ul>"; if ($regioncounties ['county_region'] == 1); echo "<li>" . $regioncounties ['county_description'] . "</li>"; echo "</ul>"; } } ?> table `county` -- INSERT INTO `county` (`county_id`, `county_description`, `county_region`) VALUES (1, 'Cornwall', 1), (2, 'Devon', 1), (3, 'Somerset', 1), (4, 'Wiltshire', 18), region` ( `region_id` int( NOT NULL AUTO_INCREMENT, `region_description` varchar(40) NOT NULL, PRIMARY KEY (`region_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; -- -- Dumping data for table `region` -- INSERT INTO `region` (`region_id`, `region_description`) VALUES (1, 'South West'), (2, 'South East'), (4, 'Dorset'), (7, 'East Anglia'), (8, 'Home Counties'), (9, 'London & South East'), I have the id of 1 in at the moment but still am not getting the right output
×
×
  • 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.