drjohn 56 Posting Pro in Training

That stands for EVERYTHING.
It's a reset to get rid of any different default settings in different browsers, which can differ by a couple of pixies here and there and make your design look different in other browsers. You then have to set every margin and every padding for every other tag as and when you feel you need them, rather than use the default settings.

drjohn 56 Posting Pro in Training

OMG!!!

It's a miracle anything shows up in a browser!

You really, really need to read up on the absolute basics of html, as your code has some major errors - like no doctype, no html tag, no head tag, no body tag, for starters. And it uses tables (and nested tables at that) for layout.

Try to read Build your website the right way by Ian Lloyd, as a minimum, and the tutorials at www.htmldog.com. Then start all over again building your site.

drjohn 56 Posting Pro in Training

Did you actually upload it to your site? It is not embedded in the page and has to be uploaded separately.

Can you give us a live url to look at?

Also you don't have a doctype in your code, and that is a very risky way to build your pages.

PS I agree that it is a bad idea to use a reserved word like body for anything purpose other than its intended reserved purpose. It's just good working practice in all computing to treat reserved words with respect.

drjohn 56 Posting Pro in Training

Put it in a div, give the div a width, and centre the div.

drjohn 56 Posting Pro in Training

no idea, as no web page url to look at.

drjohn 56 Posting Pro in Training

When you zoom in the text gets bigger and the confines of the div the main text is in make it wrap, as you'd expect. Your logo on the other hand just gets bigger, and as the div it is in has no constraint on size, that two gets bigger. Try applying a max and min width to the header div, the same as the container div.

drjohn 56 Posting Pro in Training

typical inaccurate stuff from w3schools !

have a quick look at www.w3fools.com and learn why you should treat that site's lessons with care.

What your code does is just a typical way to style your menu, which you should create as an unordered list.

Arkinder commented: Very nice link. +1
drjohn 56 Posting Pro in Training

I use tab delimited files, not csv, so much easier, as I too have a comma in the middle of some fields. I also use some software (SQL Manager Lite for MySQL, from EMS or HeidiSQL) for remote connection, so I don't even have to upload the file in advance.

load data local infile "C:/Documents and Settings/dr john/My Documents/logpile/AccountDataExport_2011-01-29.txt" into table accounts;

the keyword local tells it to take the file from my PC's drive.

csv is overrated, tab delimited is so much easier to work with. Spreadsheets can save as tab delimited if that's where your data comes from, mine comes from an extraction app running on a desktop's database.

drjohn 56 Posting Pro in Training

that makes more sense now

drjohn 56 Posting Pro in Training

Go on, someone send him a 600mb file of plain text...
Might fill and close his mail box...

Ah, just noticed he wanted it to gmail, so it wouldn't.
unless we ALL sent him a file

drjohn 56 Posting Pro in Training

It would be interesting to see some typical values for movie_title, to see how that gives you movie_release_year

drjohn 56 Posting Pro in Training

this bit is weird

WHERE movie_title IN (SELECT * FROM (SELECT movie_title FROM movie_temp) AS TEMP);

You are using a sub-sub-query to select movie_title, then using a sub-query to select * from the sub-sub-query, which will give you the exact same result as the sub-sub query - every single movie_title in the entire database
Why????

WHERE movie_title IN (SELECT movie_title FROM movie_temp);
will give you the exact same result.

you've also used an alias for the result of the sub-sub-query, then made no use of it what so ever.

and there is one final itty bitty thing - the entire line five
WHERE movie_title IN (SELECT * FROM (SELECT movie_title FROM movie_temp) AS TEMP);
is not needed anyway....

you've already told it to use movie_temp on the opening line on the first line

UPDATE movie_temp

So then all you have to do is tell it the field to be updated and how to work out the new value,
SET movie_release_year = (
SUBSTRING_INDEX(movie_title,')',1)
)

which reduces the overall query to just

UPDATE movie_temp
SET movie_release_year = (
SUBSTRING_INDEX(movie_title,')',1)
);

you would only use a WHERE condition when only some of the records were to be updated, but you are updating them all. So no need for the WHERE.

smantscheff commented: I smelled some fishy here, too, but you pinpointed it exactly. +1
drjohn 56 Posting Pro in Training

If you give the first item in each drop-down a class of .first and set the styles
.first {margin-top:10px;}
it will move that item down a bit for you.

If you try applying it to the hpmenu ul, it makes a gap between ALL the items in the drop-down, which is not good. Remember it is perfectly legal to give something two classes, so change the first item in each drop-down (the one below the one with class="top") from class="item" to class="item first"

If this helps, why not visit my sites, I need visitors

drjohn 56 Posting Pro in Training

The number of warnings strongly suggests that your text file is loaded with errors, which makes it skip many rows until it gets back to correct code to insert - usually it's one less or one more attribute than in the table you're inserting into, or a date in the wrong format, or an extra comma in a text field.

I regularly insert from text files of 1 - 2 MB, but using software that can connect remotely from my PC, not phpmyadmin - I use HeidiSQL, and mysql manager lite from ems. I found comma delimited failed very often (my data included text fields with a comma in them sometimes) so I changed to tab delimited and that has worked well.

drjohn 56 Posting Pro in Training

The order of rows in the actual database is totally irrelevant (and that is part of relational database theory - there is NO sequence). You determine the order rows are displayed when you query the database, IF the display order matters.

How big is your huge text file?

drjohn 56 Posting Pro in Training

this works on your tables and sample data.

SELECT concat(customer_name,' ', customer_surname) as FullName, customer_id, customer_email
FROM customer INNER JOIN orders ON order_customer_id = customer_id 
WHERE concat(customer_name,' ', customer_surname) LIKE '%andr%'
ORDER By customer_surname ASC

It seems you can't use an alias in a conditional statement in MySQL. Hence the concat() is repeated as the condition.
Edit - actually it seems standard SQL doesn't allow aliases as part of a condition either, not just MySQL. It's because the where may be evaluated before the alias is applied, so it gets confused in the relational algebra and can't do it's thing as no such column exists. This suggests that the alias is probably only applied at the final output stage of the query.

Notice the total lack of a sub query.

If you're happy, visit one of my websites.

PS A better set of test data would have had a third row in the orders table, placed by Joe or Jill, so you could check that it wasn't returned when not needed.

drjohn 56 Posting Pro in Training

The easiest way to tackle a problem is to reduce it to a much simpler problem, then expand it gradually.

Start by just running a join on the two tables, without the concatenation (which you could do in your PHP anyway) and with a simple LIKE '%a%', but listing every field you want returned in the query and see what you get. Then remove the customer_name and customer_surname, and replace them with the concat I gave above - you should get an identical result.

Then try instead of your current LIKE '%a%' using a name that was returned by the first query.

Eventually at some point you will have to make it use whatever variable is passed by the form, but if you can't get the simpler examples above to work, something else is going wrong.

drjohn 56 Posting Pro in Training

The concat does not need a second select.
also if you use Select *, it pulls up everything, but then you are asking it for more individually named fields, so several fields will appear twice!

so let's make a start on things.

Replace this

`fullName` FROM ( SELECT CONCAT( `customer_name` , ' ', `customer_surname` ) 
AS `fullName` ,

with this just this

CONCAT( `customer_name` , ' ', `customer_surname` ) 
AS `fullName` ,

But you seem to have other errors in the code. imho, so yes, post the tables and some sample data, so your over-complicated query can be re-written properly.

I can't really understand why you have in your sub query a call to concatenate customer_name with customer_surname, followed by a call for customer_name and customer_surname!

And whatever happens, it looks like you are trying to get all rows where someone has an 'a' anywhere in their first name or their surname - not exactly a useful query by any stretch of the imagination.

drjohn 56 Posting Pro in Training

No, he means his knowledge of SQL isn't the best, not the dbms called MySQL isn't the best. As we can tell from the lack of a primary key restriction on column A ;)
There should only be one row for each value of A. Full Stop. You should not allow a second row to be added.

Once you have identified and deleted the offending rows, alter the table to make column A the primary key.

drjohn 56 Posting Pro in Training

Use an ecommerce package which can handle this for you. They tend to create a link that is stored in their database and triggers the formation of the page, but the code is timestamped to expire after a day or three. I also think they tend to mark it as having been used, to prevent sharing.

Cubecart can do this. The older version 3, which is free to download, can do this for you. You'd simply have a shop with only one product in it (or perhaps a couple of products)

drjohn 56 Posting Pro in Training

DON'T use absolute positioning.

Create a wrapper div first, give it a width, and then set margin:auto for it in the css. That will center it.

Inside that div create a header div and inside that put the content that is your header image (probably better as the background image to the header) and the menu (created using an unordered list, styled by css).

Also inside the wrapper div, create your content div and give it the image we can see your text sitting on as the background to it.

Then enter your content inside that div.

Alternatively and possibly better, set the entire image we can see as the background to the wrapper div. (Remembering to set the background color of the body itself to the blue we can see.)

DO NOT use absolute positioning because, as you have just discovered, it is not the correct solution the vast majority of the time, and should only be used in some odd occasions. Do not use drag and drop to position things.

PS Layers was a word invented by Netscape, the correct term has always been div.

drjohn 56 Posting Pro in Training

That means that the data entered into the database had a <br /> in it (and <br /> is the code for a line break). It is VERY likely that your input script is first converting the newline into a <br /> then inserting it into the databsae.

What I do is input the content unaltered, but when it comes to displaying it on a web page, via php, I run the only bits that will have newlines through the php function nl2br() - see the manual. nl2br() produces a <br />, so what I actually did just recently was write my own function to make it insert <br> instead, just to keep the validation tool happy and to exercise my brain. (Because I don't use xhtml, as it is a dead-end and most browsers can't read it, so they convert it to html first!) I don't run it through the function when it is displayed in a textarea for editing, however. So no <br />, just the newline.

drjohn 56 Posting Pro in Training

Missing from the above answers is the css3 styles for up to date browsers, so the full code would look like this

.yourdiv [
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px; /* the css3 code */
}

Always use all three bits of code when you want rounded corners.

Next, you face the problem of IE, which doesn't recognise these styles at all (until IE9 comes out, I think). I use dd_roundies.js for IE. So you Do not need to use images and lots of extraneous code for IE.

All you do is add it in a conditional statement with DD_roundies in it, which only IE can read, and use it as described on it's web page
http://www.dillerdesign.com/experiment/DD_roundies/

This combination is very easy to use. The only snag pops up when you use rounded corners AND drop-shadows on the same div, as DD gets confused a bit by IE's special filters. So it's round corners or shadows for IE, while you can use both for all other browsers

drjohn 56 Posting Pro in Training

Easiest way is to do a normal join, ordering by student_id, then process the output in code - PHP or whatever you are using.

However, unless everyone is taking the very same subjects, and you include subject name and sort on that too, there will be no relationship between any given pair of students and their hismark1, hismark2, etc.

So if all you wanted was a set of marks, join student to the marks table; but if you have everyone taking the same subjects and want some meaning to the vertical columns of hismark1, hismark2, you'd have to join student to mark and then mark to subject, and sort by student_id, then subject, then post process the output.

PS Merry Xmas, I like people to visit my sites.

vedro-compota commented: ++++++ +1
drjohn 56 Posting Pro in Training

Hi Shanenin,

I see in css that for most of the text containing tags font-size is not defined in the first place, and where it is defined, it's in relative values (small, 90%) so pretty much everything about sizing is left to browsers to decide, and we all know IE...

So try defining some precise font-size in px.

If that doesn't help try using IE conditional comments (easy to google out, even easier to use) to give IE specific instructions on how to handle fonts.

There is nothing wrong with defining font sizes in percentages and it works very well. Defining font sizes in pixels, which you are suggesting, creates a large problem - the user can't make the text bigger when using view > zoom, as IE (quite rightly in my opinion) regards the font size declared in pixels as a fixed size, so does not enlarge it (unlike other browsers which seem to think changing the defined pixel size is a good idea). If you wish to make the site accessible to users with poor eyesight, users who are liable to have the text zoomed to a larger size, then you have to use percentage or ems for your font sizes. Most experts advise against setting a font size in pixels for this reason. A less accessible site will loose you users who, if they can't read the content easily, will try elsewhere.

Arkinder commented: Accurate information. +1
drjohn 56 Posting Pro in Training

Read this very carefully

You can not put one style definition nested inside another one!!!!

So CSS that looks anything like this

.something {

.someotherthing{

}

}

is AUTOMATICALLY wrong and totally ignored.

Each style has to be defined separately

.something {

}

.someotherthing{

}

.anotherthing {

}

Is that clear enough? In other words your styles as given above are totally and utterly wrong.

drjohn 56 Posting Pro in Training

Try putting a few spaces into that monster long "word" and you'll soon see things are okay! It's your test "word" that is the problem!!! Not the code. Never test a layout with a word like that.

drjohn 56 Posting Pro in Training
#wrapper{
    background: #ffffff url('../images/axis-y_bkgrd.jpg') repeat-y fixed center top;
    margin:0 auto;
    overflow:visible;
    width:710px;
}

Should have overflow:hidden;

overflow:visible means that you can see it overflowing from the div, with the div itself stopping where its own content stops.. hidden means that it doesn't overflow out of the div, but stays inside it and forces the div to expand. Hence the border will then be around all the content.
Simples.

drjohn 56 Posting Pro in Training

First, use an external stylesheet.
Then give the name a class - whatever name makes sense to you. eg .myCode
Give the div a width and a border, in the external style sheet.

Suggest you read up on css.

drjohn 56 Posting Pro in Training

Like this

<pre><code>//Do a bit of code debugging     ||-- Check Array vals
  document.write ("&lt;ul&gt;");
  for (i=1;i&lt;array.length;i++)
   {
      str += "&lt;li&gt;Value of array " + i + " is: " +array[i] + "&lt;/li&gt;";
   }
  document.write(str);
  document.write ("&lt;/ul&gt;");
</code></pre>

<pre> is for pre-formatted stuff and retains the white space that html normally just discards. The numbers are just added by THIS forum. toggle to plain text view, to see how it looks in your own code.

NewOrder commented: Awesome it worked +0
drjohn 56 Posting Pro in Training

Short words are ignored, the default minimum length is 4 characters. You can change the min and max word length with the variables ft_min_word_len and ft_max_word_len

according to http://www.petefreitag.com/item/477.cfm

so try 'SOM ' - note the space after som

drjohn 56 Posting Pro in Training

And never use reserved words as your tag ids or classes!
eg body is a reserved word in html, and you use it as an id.
It is VERY bad practice to do that.

You can set the background-color to anything - to the body, an h1, h2, p, ul, you name it.

Oh, and do use a doctype, or you will trigger quirks mode, which is also a bad thing, as it is different in different browsers.

drjohn 56 Posting Pro in Training

To center a page, first it must have the entire content inside the outermost div, which must have a width applied in the css. Then you add margin:auto to that div's css and that's it done.
eg assuming like most people your outermost div has the id = "wrapper" (it's just traditional to call it wrapper, it doesn't matter what it's called)

#wrapper{
width:960px; /* or whatever you're using, but not the size of your own personal screen! */
margin:auto;
rest of your css styles for wrapper follow.

}

PS as for saying display:block - divs ARE block automatically...

drjohn 56 Posting Pro in Training

Normally you would export the data from your spreadsheet first. Most people say use a csv file, but as your data can easily include a comma in a text field, this is not the best format. Use tab delimited text instead, available as a file type option in Excel.

Then you have to either use some database management program to connect to your server and use the load data in file command to import the data. At least that's what I do every week with MySQL.

But Google will probably help you if there is a different method for SQL Server.

drjohn 56 Posting Pro in Training

You can set up your own test bed server on your home computer, using XAMPP Lite, for free, and have MySQL and PHP running under Apache within minutes. This enables you to reliably create and test your PHP/MySQL code. It also matches what you are being taught at college, and gives you a copy of PHPmyAdmin to ease the creation of your databases and tables.

drjohn 56 Posting Pro in Training

Normally you will have one file which holds the connection details for the database (host, database name, username, password). This should be present as an include file. So you just change the appropriate bits of that file to match what the online provider has given you. (I keep one copy called local-filename.php and another called remote-filename.php and copy these over the filename.php when working on the local or remote version, rather than type the details in by hand each time I switch from working online and local.)

To get the actual tables and data online, you use your local copy of phpmyadmin or whatever other program you are using to look at the local database to make an extract of the table definitions and the data. Then you copy that and paste it into the equivalent program you use to look at the online database and execute the extract. The extract is actually an sql query to build the tables and to insert the data.

drjohn 56 Posting Pro in Training

Because I believe that some processing takes place on Google's server to make it work. I think (but I might be wrong) that you having the font on your server is not going to work. I haven't played with these fonts on google because when first looked there were only a very small number to choose from. But if you read the bit where google tells you how it works, it might say what they are doing in more detail and explain things. I was under the impression that to make it work you had to use the google link.

drjohn 56 Posting Pro in Training

no comma required after StoreName) in the first table definition

drjohn 56 Posting Pro in Training

as above ^

Your table is not normalised and forces you to use bad code to find the children. Imagine checking to see if fred has a child called jimmy - you'd have to query each column via an or, whereas with a proper;y normalised database, you'd just search on user=fred and child = jimmy.

table = users - their data
table userkids - user and childname, that's all (unless you need to store more about each child)

Then your select for the drop down is just child where username = whatever.

drjohn 56 Posting Pro in Training

Just edit your PHP script to send it to two destinations.
Normally you build up the message in steps from each field, so just add a bit for a cc as well or if you don't want to do that, repeat the entire code in the same script, but with a different destination.

drjohn 56 Posting Pro in Training

You are linking to folders with your code. Without an index page, your system is returning instead a file listing, which always does what you don't like.

So make an index.htm page for each folder, listing the files and linking to them. And make the link not to the folders, but the index pages.

drjohn 56 Posting Pro in Training

order by is ordering it in alphabetical order in your opening post.

that's why you need a different approach, using the date data type and then getting at the year and month. (which are stored as numbers)

drjohn 56 Posting Pro in Training

change float:left to float:right on line 197

diafol commented: He asked for it. Ha ha ha. +6
drjohn 56 Posting Pro in Training

<h3><span>content in here</span></h3>

h3 span{css in here}

You do know you can give the h3 tag a width...

Also <span class="h3"> </span> is probably invalid, as h3 is reserved as a tag name.

drjohn 56 Posting Pro in Training

Because you told it too...

#nav > li:hover { top:5px; background-color:#3d3f44; -moz-border-radius:10px; -webkit-border-radius:10px; border:1px Solid #999; }

top:5px; is pushing it down by 5px. change it to zero or delete it and it will stop moving.

drjohn 56 Posting Pro in Training

http://reference.sitepoint.com/html/base

It's something I've never seen used, but the above explains it. I'm surprized you're seeing it, as I haven't seen it in the ten years I've been working on web pages.

drjohn 56 Posting Pro in Training

i would say CSS and if you want extra stuff added to it to make it look a little more 'cool' then you should use jquery or java.

I strongly suggest to never use a pure jav menu as some people have java turned off and they won't be able to use the menu properly meaning they wont see the rest of your site.

Never, ever, ever, use Java for a menu - it is total overkill. And when Java does an update and then your browser detects the menu was written in an older version, the user gets asked if they wish to continue - every single time a bit of Java runs!

Use CSS, with some Javascript to enhance it, as suggested by several others (and using Jquery makes the script very easy to write, and there are many good free examples you can borrow). But never use Java, it's a high end full-on programming language for making applications.

cguan_77 commented: thank you drjohn :) +0
drjohn 56 Posting Pro in Training

give the links in your main nav a class or more normally, give the <ul> containing all the <li>s a class or id, and then stick the class/id name in front of your style declarations.

eg <ul id="nav"><li>your nav links in here...

then make the css like this first example, for each declaration

#nav a:link{
font-family:"Berlin Sans FB Demi";
text-align:center;
color:black;
text-decoration:none;
}

Some people put the nav in its own div, and give that an id or class instead

PS There is no way you can be sure that your site visitors have the font Berlin Sans FB Demi (I certainly don't) so some random font will be substituted instead and wreck your layout/ideas. Start by using a font-family, with your desire3d font first, then a close substitute for windows next, then a close sub that might be for a Mac, then perhaps a more general windows font, and finally a generic type (serif or sans serif)

drjohn 56 Posting Pro in Training

It looks as if your query is giving you exactly the correct results.

If you want a count(*) then you need to use a group by condition, and also, amazingly, include count(*) in the original query.

But in case you haven't noticed, the count for the two desired rows you have given is wrong - there is ONE title1 with name1, one title1 with name2, one title2 with name3 and one title3 with name4.

Do you really want, instead, a count of how many rows title1 is associated with in the second table, and how many rows title2 is associated with in the second table?

Onisutra commented: thanks +2
drjohn 56 Posting Pro in Training

yes, that is standard sql

If you wish to query on multiple columns, you just add them with their WHERE conditions, and using ( ) to guarantee the correct priority of the ANDs and ORs

(although why someone would enter the author as the title...)

PS LIKE '% higgins %' will only detect higgins as a single word,
while LIKE '%higgins%' will also return thiggingson, but you probably know that.