Jump to content

daviddth

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    Down Under

daviddth's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have been told that some search engines penalise you for the meta tag way. Based on one of my experiences, the site I had was removed from Google soon after the redirection in that manner. Did not take it long to be reindexed on the new domain, but stilll... A google ex-employee (Brother in law) told me they recommend something along the lines of this: <?php header( "HTTP/1.1 301 Moved Permanently" ); header( "Status: 301 Moved Permanently" ); header( "Location: despertn.html" ); exit(0); ?> Where the Location points to the file, or whole url - your choice. This wont get you penalised on search engines and works great on .php files (or .htm/html if you tell them to be parsed through the php engine). I am currently working on a massive site upgrade and have set a bunch of these files up to point to the newly named files and in testing it's a seamless renaming to the new page - no delay at all. Apparently it's similar to the htaccess way.
  2. It does not mean you cant do what you need. I use meta tags from the database here & they work fine, but the work is done in the <head> section of the page, not the <body> i.e. In the header of each page I have the following: <head> <?php $bookname='geraldgm'; include 'dbconnect.php'; ?> </head> then in dbconnect.php it has the following bit of code: $sql = "SELECT * FROM booklist where ShortName='$bookname'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); // bits cut out echo '<title>'.$row['HeaderName']."</title>\n"; echo '<meta name="description" content="'.($row['MetaDescription']).'">'."\n"; echo '<meta name="keywords" content="'.($row['MetaKeywords']).'">'."\n"; It gives me the info I need for the whole page and also throws in the title, and meta tags as a bonus
  3. OK an unusual question. I need some ideas on how to design and query a particular group of things. The best way is to explain what I am trying to search. I run a website and part of that site is currently a list of common ties (character names) between the authors books. At the moment I have static pages showing: Book 1 name Book 2/Short story name - List of common characters (Between Book1 & 2) Book 3/Short story name - List of common characters (Between Book1 & 3) Book 2 Name Book 1 - List of common characters (Between Book1 & 2) etc etc Basically I now want to automate the retrieval of those lists, as well as make it easier to update them in the future. At the moment there are a lot of items on each of 5 pages, but that could change as it could take a lot of queries depending on how I do it. Initially I was thinking of 4 fields - ID, Book1, Book2, List of common ties but that still takes work to update, cross link etc as the same person might be in between 2 and 10 different books. That setup is easy to do using my current abilities, but I want to do it better and smarter. Ideally I'd love to have 3 fields - ID, Persons name, "a list of the books that they appear in" and then run a query looking for the current book in that list, and build a page for the individual book and all it's links. Problem is I really dont know how to get started on this, how to store a different number of items in that 3rd field (All items there are 9 character or less alphanumeric and no spaces, making that, at least, a little easier), and how to search and build up the output in some sort of order I'd really appreciate some help with this.
  4. Out of interest, in the end I found a few more pages that had issues, not just using the ? ? ? surnames, but with queries that ended up returning about 15 to 20% of the records - they defaulted to using no index. The end fix was to look at the page and realise "Darn thats a LOT of info on one page....." and split the page up into smaller (200 records) results The "SELECT * FROM graves WHERE ((LName='???') OR (LName like 'A%') OR (LName like 'B%') or (LName like 'C%')) ORDER BY LName, FName" ended up having ' LIMIT '.$perpage.' OFFSET '.$offsetnum appended to it, where $perpage is a defineable limit, currently 200, per page, and offset number is the current page number multiplied by $perpage and minus 1 (as the offset starts at 0, but I prefer record 1 lol) This will eventually filter to all pages, so thanks heaps for all your input. It works really well in the test page (which is used to add/view/edit the live data) so moving it to the public pages should be real easy to do. I still have to "tidy" the code, but I blame my 'newness' to PHP for its horrid design
  5. Probably not a bad idea to start a bit of study on how php and html work. I guess this is code you have sourced from elsewhere, and you are trying to adapt it to your page. I guess this is a good (but steep) learning curve for you lol
  6. Thats because you HAVE to close off the php section with ?> before the html section starts. I have been coding html for 12 or so years, but started php about 3 weeks ago - been a massive learning curve getting the site updated, but thanks to the books I have purchased, google, and also help from people in here, I have managed to end up with what I think is a reasonably functioning site, but I am still learning HEAPS, and have a lot more to learn.
  7. This is php code // some php function ParseInTrades ($data) { global $db_to_desc_send; if (!count($data)) return; global $facebook; } and this is HTML. <table border="0" colspacing="2" colpadding="2"> <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th> </tr> You can put html in a php section of code, but not like that. you have 2 options. This one closes the php tag, puts the html code, and then reopens it <?php //all your code was in here, but cut to make it easier to understand // some php function ParseInTrades ($data) { global $db_to_desc_send; if (!count($data)) return; global $facebook; } ?> <table border="0" colspacing="2" colpadding="2"> <tr> <th width="100"> <h3 class="subtitle">Date</h3> </th> <th width="120"> <h3 class="subtitle">Name</h3> </th> <th width="120"> <h3 class="subtitle">You Get</h3> </th> <th width="120"> <h3 class="subtitle">They want</h3> </th><th width="80"> <h3 class="subtitle">Action</h3> </th> </tr> <?php //any more php code goes here ?> or, my preference, simply use echo to write the html code. <?php //all your code was in here, but cut to make it easier to understand // some php function ParseInTrades ($data) { global $db_to_desc_send; if (!count($data)) return; global $facebook; } echo '<table border="0" colspacing="2" colpadding="2">'; echo '<tr><th width="100"><h3 class="subtitle">Date</h3></th><th width="120"><h3 class="subtitle">Name</h3></th><th width="120">'; echo '<h3 class="subtitle">You Get</h3></th><th width="120"><h3 class="subtitle">They want</h3></th><th width="80">'; echo '<h3 class="subtitle">Action</h3></th></tr>'; //any more php code goes here ?>
  8. At least an hour sorry. It's only 5:30 pm here in Australia.
  9. I'll look when I get home as the iPhone browser will not let me scroll a text box like that grrrrrr
  10. Can you post 10 or so lines up to the error point and the same after. At a guess that's in a php section as above
  11. your opening another <?php section while still IN one.
  12. Might be an idea to post a bit more of the code prior to the error - are there any php sections before it that are not closed properly etc? <?php // some php } //<<<<<<<<<<<<< Why are you closing a bracket thats not opened, unless it's opened in a previous section? function ParseInTrades ($data) { global $db_to_desc_send; if (!count($data)) return; global $facebook; } ?>
  13. I do get it, thanks. Now to work out how to convert it to code LOL. Then again I have been awake for 36 hrs which is not helping LOL
  14. OK another quick question on inserting values. I have a database that contains various bits of info, but some items can have a NULL value, such as, in the example below DOD, POD, DOB & POB (Dates & places of birth). When I create a new entry, the null value is not set - I want it set IF the entry is empty. <?php $DOB = $_POST['DOB']; $POB = $_POST['POB']; // etc... Gets roughly 18 seperate values. If they are empty I tried to se them to null using if (!$DOB) $DOB=NULL; if (!$POB) $POB=NULL; //but that did nothing when inserted - the items just contain nothing $query = "INSERT INTO graves (FName, LName, DOB, POB, DOD, POD, SFName, SLName, S2FName, S2LName, S3FName, S3LName, DOBur, CemLocation, Image, Cemetery, ImageLoc, Female) VALUES ('$FName', '$LName', '$DOB', '$POB', '$DOD', '$POD', '$SFName', '$SLName', '$S2FName', '$S2LName', '$S3FName', '$S3LName', '$DOBur', '$CemLocation', '$Image', '$Cemetery', '$ImageLoc', '$Female')"; if(mysql_query($query)) echo '<h1>Updated</h1>'; else echo '<h1>FAILED</h1>'; ?> I am sort of stumped, but obviously theres an issue with the way I try and tell the value it is NULL (I sort of think it's the ' around the $POD values). I have the same issue with the update query, but if this gets fixed the update one will be similar I guess If I leave the items out of the query then the Null value is there (Because it's not putting '' in there), so is there a way I can "Build" a query based on if the value of each possibly NULL cell is not empty? Dave
  15. The union worked, thanks. Because you need to display something for a surname, rather than no value (Null), most sources suggest (Unknown) or ? ? ?, as this makes understanding (by humans) much easier. When starting the family tree webpage some 12 years ago I chose ? ? ?, and changing now is simply not an option as the ? ? ?'s are spread throughout static, and php pages, plus the family tree software, and it would be just too big to change now (Close to 500 entries are like this, but only a small fraction are in the database I am currently working with).
×
×
  • 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.