Jump to content

daviddth

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by daviddth

  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).
  16. I thought move_uploaded_file used filename, new location (not the filename, just the location directory where you want it to go). You appear to be sending the original file location correctly, but the second part of the move_uploaded_file command seems to have the full name of the file i.e. 'posts/lemonade.jpg' instead of just 'posts/' Then again it's 6:12am and I just want to go to bed, so blame lack of sleep if I make no sence
  17. Yes it uses the LName index. Odd. Some more testing - if I use ? ? ? and A% and B% then it works, Adding C% stops it using an index. If I try ? ? ? and B & C then it works too. It seems as though doing all 4 together causes it not to use an index. It returns 470 items (Correct) out of 2359 items, but will not use the index when all 4 items are used. I have searches using 5 items (the letters V through Z) and they work fine, but they dont return as many hits. I wonder if, once you get to a certain number of items, it searches through all rather than using an index. A through D does the same - no index.... I can fix it by making the queries to smaller groups of letters, but that does not explain why...
  18. echo "<img src='$pic;' />"; That looks wrong to me, but it could be because it's 5:15am lol. Try this: echo '<img src="'.$pic.'" />';
  19. Do you have a link to the problem page at all? We might be able to see something in the source.
  20. If I remove the LName='? ? ?' then it says possible key LName and Key is LName, (which is the Last Name index, and thus is what is expected), but adding it back in there it says possible key is LName, but key is NULL
  21. I have built queries the same way, except swapping the ' and " about. echo '<img src="'.$searchcem.'/'.$imageid.'.JPG" height="100" width="100">'; If that does not help (I have always used " in html tags like this) then double check capatilisation of directories & filenames
  22. You are probably right, but there is no easy way to change the names as they marry into a lot of other queries, both shown and hidden, but this is the only one that searches just on LName, and thus has the speed issue. Without a lot of complex on the fly adding and then removing extra characters, I was hoping for an "easier" way. It's not a huge issue, but I was sitting here at work at 3:00am wondering why, so thought I'd ask the experts here
  23. I have a query that is searching a 2500 record mySQL database on one (indexed) field, but the query is running slow bcause of one particular search term. The query is: $sql = "SELECT * FROM graves WHERE ((LName='???') OR (LName like 'A%') OR (LName like 'B%') or (LName like 'C%')) ORDER BY LName, FName"; Yes one of the LName searches is ? ? ? (without the spaces - had to do that to stop it showing as ??? ), as that is the exact entry used in the LName field. That entry is used for unlknown surnames, usually because I know the married name of a female, but not the maiden name. The query takes 1.1 seconds to build the page, whereas a similar query takes less than 0.1 seconds for a similar number of returned names. I have tried removing the LName='? ? ?' and the query returns to 0.08 seconds, so why is it taking so long? I assume it's because of the ?'s but is there any way around it? As it is, it returns the right records, but just takes much longer than the other queries. I tried LName like '?%' and thats the same - long search time. The query can be seen in action at http://www.davidrawsthorne.com/familytree/people.php?alphindex=ABC and if you select http://www.davidrawsthorne.com/familytree/people.php?alphindex=DEF you will see a faster query that has no ? ? ?'s to search for.
  24. Assuming you dont want a CSS style setup, but plain html, then it is relatively easy. Here is the crux of a bit of my code that displays a variable across (in order) on a 4 column format. Is it elegant? Heck no, but it works and works really well. I'd love to have others pick it apart as my 2 week knowledge of php & mySQL is growing, but only to solve problems I encounter like this lol. I have added a few comments to the code to explain it. echo '<div align="center"><table border="1">'; $tcount=1; while ($row2 = mysql_fetch_assoc($result2)) { if ($tcount==1) echo('<tr><td>'); // start of line else echo('<td>'); // if it's not 1 then it's the next echo('<a href="index.php?pid=2&Shortname='.$row2["Shortname"].'">'.$row2["Shortname"].'</a></td>'); // DOnt be worried - just the required bit of info on the screen $tcount++; if ($tcount==5) { //i.e. if tcount is 1 greater than the number of columns you want in the table, reset it and put the end of row $tcount=1; echo ('</tr>'); } } //this bit fills in and blank table boxes with non blanking spaces at the bottom of the table just to make it nice & neat if ($tcount>1) { while ($tcount<5) { echo('<td> </td>'); $tcount++; } } echo ('</tr></table></div><br>'); // close the table
  25. Have you tried echoing the value of $t in a few places. i.e. <?php $t = $_GET['topic']; echo $t; and later... if ($t == '0') { echo $t; } I have exactly the same setup, except I dont close the php section and throw in html code - I just converted the html into php echo commands, so that way each if statement has a solid section of php between the { and } - I just prefer it that way lol
×
×
  • 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.