Jump to content

The Praetorian

Members
  • Posts

    333
  • Joined

  • Last visited

Everything posted by The Praetorian

  1. A friend and I have been trying to figure this one out, but it still isn't working right. The script pulls out all the entries when I go to the base page, but when I try to send it to a specific entry (.php?s=entry) it still shows all of the entries. <?php $dbh=mysql_connect ("localhost", "****", "****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("author_localhost"); $result = mysql_query ("SELECT * FROM dictionary WHERE word LIKE '$_GET[word]%'") or die(mysql_error()); while($r = mysql_fetch_array($result)) { echo '<h2>'.$r['word'].'</h2>'; if ($r['category'] != "") echo '<span class="blue">Category</span> <b>:</b> '.$r['category'].'<br />'; if ($r['pronounce'] != "") echo '<span class="blue">Pronunciation</span> <b>:</b> '.$r['pronounce'].'<br />'; if ($r['definition'] != "") echo ''.$r['definition'].'<br />'; if ($r['definitiontwo'] != "") echo ''.$r['definitiontwo'].'<br />'; if ($r['related'] != "") echo '<span class="blue">Related Entries</span> <b>:</b> '.$r['related'].'<br />'; echo "<br />"; echo "<title>The Shattered Realms ~ Search: $r[word]</title>"; }?>
  2. I think I'm gonna need more information. Heh.For one thing I'm not sure that that's exactly what I want to do. The only thing I want to have in the database is a lot of text, an h1 tag, and some p tags. (Either that or figure out how to output those on their own.) These pages will have a lot of information contained on them, and I'd prefer to be able to pull them out of a database everytime someone clicks the appropriate link rather than having to create a different page for each block of information, or cramming it all onto a single page.Would what your suggesting work the same as that? If so, I definitely need more info please.If it helps, here's a website where the person is doing basically what I want done. I'm just not sure how they did it since I can't see their php.http://terrawin.net/tech.php?id=explosives
  3. I'm working on converting most of my html pages to php to make for easier navigation and I have some questions.I'm going to be storing all the info that goes on each page in my sql tables. Can I enter raw html into the fields of an sql table? The reason I ask is because I'm going to be having large blocks of text which will need to be broken up. Can I put header tags and p tags? Or do I need to code the php so that it parses a line break for every time I hit enter?I'm also not quite sure how exactly to code this. I know how to put all the information in and I know how to write the connection string, but as for getting it to do what I want... I don't expect anyone to write it for me but if anyone knew a good tutorial on how to do what I had in mind I'd appreciate it.Basically I just want the base page (whatever.php) to have a summary and a row of links that will lead to other information when clicked. So clicking the links would basically just go to (whatever.php?something=info). That way I don't have to code a different page for each bit of information but I also don't have to cram everything onto a single page.Again, any info anyone has on this would be greatly appreciated.
  4. Okay, adding that query gave me this error on that line.Parse error: syntax error, unexpected '.' in /home/author/public_html/dictionary.php on line 88
  5. Okay. That works great, thanks. Any ideas on the other one? The link is going through fine but the other script is still pulling out all the entries.
  6. I'm using the script someone gave me for a dictionary/encyclopedia of sorts. One page has a list of all the links matching that letter while the other page is where it goes to show the entry for the link they click. What I can't figure out is how to make the page that I point those links at work properly. At the moment all it does is spit out all the entries in the database. Here's the script for that page. <?php ob_start(); $dbh=mysql_connect ("localhost", "author_author", "****") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("author_localhost"); $result = mysql_query ("SELECT * FROM dictionary WHERE word LIKE '$_GET[word]%'") or die(mysql_error()); $r = mysql_fetch_array($result); while($r = mysql_fetch_array($result)) { echo '<h2>'.$r['word'].'</h2>'; if ($r['category'] != "") echo '<span class="blue">Category</span> <b>:</b> '.$r['category'].'<br />'; if ($r['pronounce'] != "") echo '<span class="blue">Pronunciation</span> <b>:</b> '.$r['pronounce'].'<br />'; if ($r['definition'] != "") echo ''.$r['definition'].'<br />'; if ($r['definitiontwo'] != "") echo ''.$r['definitiontwo'].'<br />'; if ($r['related'] != "") echo '<span class="blue">Related Entries</span> <b>:</b> '.$r['related'].'<br />'; echo "<br />"; echo "<title>The Shattered Realms ~ Search: $r[word]</title>"; }?> The problem I'm having with the other script is that, although the links all come out fine, when I click one and it switches pages, the php?s= part doesn't show the whole entry for multiple word entries. Instead of doing the+something it only shows "the" in the link. Here's the code for that one. <?php$dbh=mysql_connect ("localhost", "author_author", "*****") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("author_localhost");$letter = $_GET["letter"];$q = mysql_query("SELECT * FROM dictionary WHERE word LIKE '$_GET[letter]%'");while($row = mysql_fetch_array($q)) { echo "<a href=dictionary.php?s=$row[word]>$row[word]</a> <br /> ";}?>
  7. Hm. Then it could just be my computer... someone else looked at it and said they got the same problem but that was only one person. Very confusing. Vchris, you can view the page source, and I posted a link to the css in my first post.
  8. Well the problem appears on IE 6.Well I assume it's the selects, because I have forms on another page and don't get that problem.
  9. This script was working fine, (I think) then I went away for a while and now I can't seem to get it to work again. It won't pull out any of the search strings I enter, even the ones I know for sure are in there. Here's the code. <?php ob_start(); $dbh=mysql_connect ("localhost", "*****", "****") or die ('I cannot connect to the database because: ' . mysql_error());mysql_select_db ("author_localhost");$search_string = $_GET['s'];if ($search_string == ""){ echo "<p>There are no matches for the word you entered. Please make sure that the word is spelled correctly, and that you haven't left out any spaces or apostrophes. If your search still doesn't return a match, then we probably haven't added it yet.</p>";}else{ $result = mysql_query ("SELECT * FROM dictionary WHERE word") or die(mysql_error()); $r = mysql_fetch_array($result); if ($r['word'] != "") { echo '<h2>'.$r['word'].'</h2>'; if ($r['category'] != "") echo '<span class="blue">Category</span> <b>:</b> '.$r['category'].'<br />'; if ($r['pronounce'] != "") echo '<span class="blue">Pronunciation</span> <b>:</b> '.$r['pronounce'].'<br />'; if ($r['definition'] != "") echo ''.$r['definition'].'<br />'; if ($r['definitiontwo'] != "") echo ''.$r['definitiontwo'].'<br />'; if ($r['related'] != "") echo '<span class="blue">Related Entries</span> <b>:</b> '.$r['related'].'<br />'; echo "<br />"; echo "<title>The Shattered Realms ~ Search: $r[word]</title>"; } else { echo "<p>There are no matches for the word you entered. Please make sure that the word is spelled correctly, and that you haven't left out any spaces or apostrophes. If your search still doesn't return a match, then we probably haven't added it yet.</p>"; }}?>
  10. I posted this here before but no one seemed to have an answer. So I'll give it another shot with some more info.When viewing this page... Here ... on IE, some of the text disappears and flashes in and out when I scroll. I'm fairly certain it's the select tags, but I have no idea how to fix it other than removing them. Any suggestions?The css
  11. I understand. Changed it. Still having the problem.
  12. I don't have any images in that form, except the background images put there by the external style sheet. How can I tell those images not to have a border without canceling out the border I put around the text areas?
  13. It helps with page shifting. If you switch between a page with a scroll bar and a page without, the content shifts to make room or to make up for the room. Having a scroll bar on every page eliminates this shifting. It's not as intrusive as it may sound.
  14. First, to make sure I'm not seeing things...Could someone look at this page on IE please and tell me if there seems to be any visual problems?http://www.tsrealms.com/appmail.shtmlEvery time I look at it on IE parts of the text disappear as I scroll. Can't figure out why..
  15. I'm using this line..html { min-height: 100%; margin-bottom: 1px;}to add scroll bars to every page regardless of length. However, it doesn't work in Opera. I was just curious if anyone knew a work-around for this, so I could get the same effect for Opera. Thanks in advance.
  16. Okay thanks. That works great. Now just in case I change my mind later, how would I change that line if I want both similar results to come out?
  17. Okay what's the exact syntax for that? Because putting what you just gave me doesn't work.$result = mysql_query ("SELECT * FROM dictionary WHERE word='word'") or die(mysql_error());
  18. I'd rather it only display whichever one they entered.
  19. Okay. So what do I do? Remove the %? Remove the LIKE?
  20. I don't suppose you have the original version of the file, before you changed it? Can you remember what it was that you changed? Was in the php, or just the html?In any case, change this line...$con = mysql_connect("localhost","humane","password");to..$con = mysql_connect("localhost","humane","password") or die ('I cannot connect to the database because: ' . mysql_error());At the very least that should tell you why its not working.
  21. The Praetorian

    .cfg files

    I've been using phpbb a lot lately, and I was just curious if anyone could give me any information on how to build a website like that. Specifically, how would I go about creating cfg files for my website so that I could list all my images there, create variables for them, and then use the variables in the img tag.. (IE... src="{I_banner}"...)I may be completely misunderstanding the process, but if anyone could give me some info, tips, or point me in the direction of some good documentation about it, I'd greatly appreciate it. Thanks.
  22. Depending on what you want it to do when clicked, I think you're looking for javascript, not php. Specifically with javascript, the onclick function.
  23. Yea. I agree. No problem with using tables. As for xhtml, the only difference there is that all the tags are closed properly, things are nested, elements are lowercased etc... My site is built with tables and it validates as xhtml just fine. So I see no point in switching to divs.
  24. Hm. Alright. The problem I'm having now is that entries with similar words seem to be canceling each other out.So far it's only happened with two entries. The words are "tii al" and "the tii alu". Entering "tii al" brings out the entry for "the tii alu" even though the words are different. Even entering the link exactly (s=tii+al) still brings out the other entry...Here's the script I'm using. $search_string = $_GET['s'];if ($search_string == ""){ echo "<p>There are no matches for the word you entered. Please make sure that the word is spelled correctly, and that you haven't left out any spaces or apostrophes. If your search still doesn't return a match, then we probably haven't added it yet.</p>";}else{ $result = mysql_query ("SELECT * FROM dictionary WHERE word LIKE '%" . mysql_real_escape_string($search_string) . "%' ORDER BY word ASC") or die(mysql_error()); $r = mysql_fetch_array($result); if ($r['word'] != "") { echo '<h2>'.$r['word'].'</h2>'; if ($r['category'] != "") echo '<span class="blue">Category</span> <b>:</b> '.$r['category'].'<br />'; if ($r['pronounce'] != "") echo '<span class="blue">Pronunciation</span> <b>:</b> '.$r['pronounce'].'<br />'; if ($r['definition'] != "") echo ''.$r['definition'].'<br />'; if ($r['definitiontwo'] != "") echo ''.$r['definitiontwo'].'<br />'; if ($r['related'] != "") echo '<span class="blue">Related Entries</span> <b>:</b> '.$r['related'].'<br />'; echo "<br />"; echo "<title>The Shattered Realms ~ Search: $r[word]</title>"; } else { echo "<p>There are no matches for the word you entered. Please make sure that the word is spelled correctly, and that you haven't left out any spaces or apostrophes. If your search still doesn't return a match, then we probably haven't added it yet.</p>"; }}
  25. Oy. No. I must have copied over it. Works fine now. Thanks.
×
×
  • Create New...