Jump to content

murfitUK

Members
  • Posts

    207
  • Joined

  • Last visited

Everything posted by murfitUK

  1. Not sure if this will help - but it says it works on DIVs so maybe worth a try:http://www.dynamicdrive.com/dynamicindex17/switchcontent.htmHaven't tried it myself so can't comment.
  2. I probably can work this out for myself but at the moment I'm going round in circles and can't see the wood for the trees.Once a query has been executed and I know how many results there are, I wish to display them 10 to a page with links for "Previous 10", "Next 10" etc.How is the best way of doing this? Maybe there is a simple tutorial someone could point me to.My main problem is working out what should go in the link to call the next (or previous) 10 and does it mean I have to re-run the query to get the next lot (maybe using the LIMIT function).Any help gratefully received.Thanks.
  3. You can use LIMIT to select a certain number of records from the database. The query will be something likeSELECT field_name1, field_name2 etc FROM table_name LIMIT 10;This selects the first 10 records. You can also use LIMIT x,y; This selects records starting at number x and the y says how many records you want. Eg LIMIT 12,4 will select records 12, 13, 14, 15
  4. Well, the first step is to select which fields you want (or use * for all of them). Your sql so far is:SELECT field1, field2,etc FROM table_nameORSELECT * FROM table_nameThen you have to make sure it is sorted correctly by using the order by command and then ASC or DESC for ascending or descending. As you want most recent first I think you should try DESC:SELECT * FROM table_name ORDER BY date_field DESCThen you want to limit the results to the first 8 rows so the LIMIT keyword seems a good one to use:SELECT * FROM table_name ORDER BY date_field DESC LIMIT 0,7This returns all rows between 0 and 7 (ie 8 rows). Don't forget that your first row is 0 (not 1).
  5. Have a look at this topic:http://w3schools.invisionzone.com/index.php?showtopic=5344The demo website shows what it looks like. You can work out from the css code and the form bit of the html how its done.
  6. Is it essential for you to define the height of the container? I think IE and FireFox handle things differently if the text is too long. IE stretches the container but FF doesn't. The other thing to remember is that your computer will be displaying font size based on your own default values but others might have a different size.You can change the font size easily - eg with a scroll mouse hold down ctrl and spin the wheel.For example, this is my usual font:usual sized fontbut I can make it bigger:larger sized fontI can also make it tiny (as you can see it fits well but looks ridiculous):tiny sized fontIf you remove the height attribute from the css it should size appropiately to fit the contentsAlternatively, if you really do want the box to be that exact size try changing overflow: visible to overflow: scroll and it should put in scroll bars to display the text that can't fit.
  7. Just a quick one.I've got a link to create an email:<a href="mailto:enquiries@address.com?subject=ENQUIRY">email</a> etcwhich opens up Outlook (or the default email client), creates a new email and sticks the address and subject in the proper fields. The cursor, however, stays at the beginning of the subject line.Any way of moving the cursor to the big message field so the user can start typing straight away.I know it's not a major problem but it would be handy to be able to do it.Thanks.
  8. Well, if you're using just html it would be:<p align="right">This text will be on the right</p>But if you're using CSS (I don't think you will be) you could set up a class for right-aligned text by doing something like this:p.right {text-align: right;}and then in your html have:<p class="right">This text will be right</p>
  9. There's a good tutorial here which I found helpful:http://css.maxdesign.com.au/floatutorial/index.htm
  10. murfitUK

    Php document?

    And another thing that I've found is really, really useful is when you include other files into your php document.You can have two files - say start.php and end.php. The start one has basically all your opening html statements - eg doctype, html and headers, meta tags and css doc, plus any standard menu that you want on all your pages.The end one has all the footers and html closing statements.Then all you need to do to create a new page is have:<?phprequire 'start.php';xxxxxrequire 'end.php';?>and the xxxxx bit is really just the main content of that particular page. It saves loads of time because you don't have to keep typing or copying & pasting all the boring stuff that's the same in each page.Its also handy because if you want to change your menu you only have to change the start.php or end.php (depending on where it is) and not each and every single page. But the biggest tip when it comes to php is to get to grips with double quotes and single quotes and escaping characters. Believe me, you can spend hours trying to debug when it all goes wrong and it turns out to be something so simple like you've put a " without escaping it first.My second biggest tip is to understand the three main bracket types () and [] and {}. Its guaranteed to cause problems.
  11. murfitUK

    Php document?

    Hi xlx_drag00n_xlx. Good luck - it'll be a good learning experience.Once you get over the initial shock of learning a new language you'll find that things are quite easy, and all of a sudden everything will fall into place.To give you an example.... ME!! I only started learning html, css, php and sql less than two months ago but already I have been able to create a website, put a database behind it and allow users to query the database. Never would have thought I'd be able to do it. (www.murfituk.com - since you ask.)Don't hesitate to ask questions here if you get really stuck. We're all really friendly.Little tip: don't look just at php on its own as you still need to understand how the php output gets from your server to a user's browser.
  12. Guilty as charged! I'll put it down to the late hour - way past my usual bedtime!serif = has the twiddly bits around the edges of the character.sans-serif = without the twiddly bits.
  13. Would it not be easier to divide by 300 and find the integer value:$number = intval ($sec/300);$number will then give you the number of complete 300s within the value of $sec.
  14. I'm experimenting with php and sql and all that. I think this question is more to do with the html output though.I've got a folder with 30 jpgs in it of varying sizes 01.jpg, 02.jpg etc. Using a php script I've got a left container with thumbnails by specifying width='50' in the img tag, and added a <a href ... for each pic. When clicked, the relevant picture opens up in the right container.Everything works fine but I would like to limit the main container picture to something like 500px to reduce the amount of scrolling that would be needed to view the larger pictures.Setting width='500' is fine for pictures of 500+ pixels, but if a pic is smaller then that it obviously enlarges the picture which results in pixellating.Is there a way to detect the size of an image when calling the file and somehow using it to determine if the width needs to be set egprint "<img src='{$picNum}.jpg' ";if (picWidth>500) print "width='500' ";print "/>";but I don't know how to find the width of the pic.Any suggestions? Is there an easier way of doing it?
  15. murfitUK

    sum

    You could use the COALESCE keyword:SELECT COALESCE (query, 0);It returns the first non-null value from the list inside the brackets. So if query returns null then coalesce will return 0 as 0 is the first non-null value from the list inside the brackets.This comes from: http://dev.mysql.com/doc/refman/4.1/en/com...-operators.htmlCOALESCE(value,...)Returns the first non-NULL value in the list, or NULL if there are no non-NULL values.mysql> SELECT COALESCE(NULL,1); -> 1mysql> SELECT COALESCE(NULL,NULL,NULL); -> NULLCOALESCE() was added in MySQL 3.23.3.
  16. You can put any font in the font-family tag but if the user's computer doesn't have that particular font their browser will just use a default one. Its simple to give a list of alternatives by putting them in a list: font-family: 'Comic Sans MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;The browser starts at the first font then moves down the line until it gets to one that's installed on the computer. You need to specify because what's installed on a Windows machine might not be installed on a Mac machine and vice versa.If you want to see your browser's default font , just leave out a font-family tag and see what it looks like.Generics are things like serif, san-serif, monospace, cursive and fantasy. If you use these terms the browser will use an installed font that resembles it:sans-serif -> resembles Times New Roman (windows) or Times (mac)serif -> resembles Arial (windows) or Helvetica (mac)monospace -> Courier New (windows), Courier (mac)cursive -> Zapf-Chanceryfantasy -> WesternWhile most computers have a standard set of fonts installed, you shouldn't assume it to be the case - and your web page which looks nice on your computer might look completely different on someone elses if they don't have similar fonts installed.
  17. Yeah - it works!!!!SELECT * FROM dict WHERE word REGEXP '^[A-E]';I knew there was a way to do it.Thanks.
  18. This should be so simple but my mind has gone blank and now I want to throw the computer out the window!I'm doing a "dictionary" which has two fields called "word" and "def".I want to do a list of words starting with letters A to E.This works:SELECT * FROM dict WHERE word LIKE 'A%' OR word LIKE 'B%' OR word LIKE 'C%' OR word LIKE 'D%' OR word LIKE 'E%';However, I am sure there is an easier way to do it, and I thought it was something like:SELECT * FROM dict WHERE word LIKE '[A-E]%';but it doesn't work. I've tried LIKE '{A-E}%' and '[AE]%' and every possible type of combination.Have I made this up? I'm sure I've seen it somewhere.Please help.
  19. Ah double quotes and single quotes. I knew it had something to do with.My solution (until I tried your suggestions) was to pull out the field first, modify it and then stick it into the table:$codelc=strtolower{$row["CODE"]};...print "\n\t<td>{$codelc}</td>" ....or something like that anyway. But now I know the correct way I shall go and change it again.Thanks folks.
  20. Thanks for the quick response. I have tried your suggestion but it doesn't work. I get this error message:Parse error: parse error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\Abyss Web Server\htdocs\newweb\results.php on line 91and line 91 is:print "\n\t<td>{strtolower($row["CODE"])}</td>" . (I've copied and pasted to make sure its correct.)The field CODE is type varchar(255).Thanks for your help.
  21. I'm sure some kind soul will help.I'm putting the results of a search into a table but I am trying to use the strtolower function without success - getting confused with round brackets, curly brackets, square brackets, single quotes and double quotes etc!This is a line of the code so far:print "\n\t<td>{$row["CODE"]}</td>" . "\n\t<td>{$row["TR"]}</td>" . etcI would like to use strtolower function so that the CODE field is printed in the table in lower case letters but just can't manage it.Could someone please let me know what the syntax should be. Thanks for your help.
  22. I have an Excel spreadsheet. One of the columns is headed "LENGTH" and stores the length of a song. The column is formatted using Time 13:30:55 in the number tab of the format cells box.I couldn't find a way of importing this data into a mysql database so tried the mysqlMigrationTool from php.net. Using the migration tool I could only find a way of migrating an Access database so converted the Excel sheet into Access using the "Convert to MS Access" in Excel.This seemed to work well except that the LENGTH field is formatted as text and a value of eg 00:04:30 (four and a half minutes) now appears as 0.003125 in Access.If I try to amend the data type of the field in Access to a time format it gives an error "...encountered errors while converting data ... 10008 fields will be deleted. Proceed?" I answer No to this!When I use the migration tool everything goes OK.The LENGTH field in the sql database now has type varchar(255) and displays as eg 0.003125.I have tried changing the type to TIME but the results all show 00:00:00.I would like to get it to display in the 00:04:30 format again but I don't know how. Not sure if the solution lies somewhere in 1) the initial Excel sheet, 2) in converting from Excel to Access, 3) in Access once the database has been created, 4) in the conversion process using the Migration Tool or 5) in the sql database.Would be grateful for any suggestions. Thanks.
  23. That's right. If I open FF or IE and type in the address & click Go, the page starts off fine but clicking the menu items opens the relevant page in the whole window and not the main frame.However, if I open the site by clicking on a link - eg the url in this thread - it all works fine. Clicking a menu item will display the relevant page in the main frame.Its exactly the same with FF or IE.
  24. That's funny. It doesn't work on mine. I've cleared the cache and all the usual stuff but it still doesn't work.
  25. I hope someone can help with a problem with frames.The site has a banner along the top, a contents menu down the left-hand side and a main frame. Its been created with FrontPage2000 and I have tested it with Firefox and Internet Explorer 6.When opened with FF or IE from my hard drive it works OK. Clicking on a menu item opens the page in the correct frame (the main frame).I've uploaded it to my webspace and this is where the problems start.If I access the index.htm page by clicking on a link it all works fine. But if I open the site by typing the address into the address bar it doesn't work - the initial page opens fine but clicking on a menu link will open the target page in the whole of the window. This happens with both FF and IE.The address is http://homepage.ntlworld.com/murfituk/shop/index.htmbut as I mentioned, if I click on this link it will work OK. I can't figure out why it works by clicking on the link but not if I type in the address manually.Please can someone point me in the right direction. Thanks for your help.
×
×
  • Create New...