drjohn 56 Posting Pro in Training

Don't do this.

Calculate the value after you extract it from the database and before you display it to the user. There is no need to store derived values. As you can see , it is causing you problems already.

Whenever anyone changes a mark, you will have this problem using your approach.

What is some course uses a different grading scheme? If you calculate the grade after extracting it from the table, you can use an if or case select to decide which grading scheme to apply.

drjohn 56 Posting Pro in Training

http://www.sqlmanager.net/products/mysql/manager

And the lite version is free to use.

drjohn 56 Posting Pro in Training

PS w3schools has absolutely no connection what so ever with w3c, the people who set web standards.

w3schools cashed in on the name and have fooled beginners for many years into thinking their tutorials are somehow w3c approved tutorials. Most professionals with a little bit of experience know this.

Don't believe me? Do a whois check on them both.

drjohn 56 Posting Pro in Training

http://www.sitepoint.com/books/html2/

Also Css Mastery by andy budd.

The difference between a book and a web site is that any fool can throw up a tutorial. And no-one has to approve it before it goes on line, no-one has to check that it is correct, that it reliable and accurate, that it has enough variations to cover most of the things you will do, that it is up to date, that it matches modern standards (much of w3schools doesn't, although they are now, finally, trying to upgrade it).

A book however takes a bit longer to write (unlike a five minute tutorial), then goes to a publisher, where it may get rejected or examined in more detail. If provisionally accepted, it gets examined by technical editors for accuracy and quality, by proof-readers looking for typos and inconsistancies. Then the publisher has to decide if it is good enough and will go down well in the current market, when placed up against other similar books. Then the publisher has to invest in printing thousands of copies. So publishers prefer professional experts.

Online tutorials - well you could write one if you liked as your first web site, couldn't you.

drjohn 56 Posting Pro in Training

Only the first condition should refer to the variable, the rest should really be along the lines of

AND tablename2.id=tablename1.id
AND tablename3.id=tablename2.id

etc

And you have to check your ERD to chain the tables in the correct order.

Although JOIN terminology is the preferred way to express things, WHERE will do exactly the same thing (although using the JOIN syntax makes some things easier to express)

Not sure why you're getting so many more rows, but for a cross join you'd get rows in tableA X rows in TableB X etc.

drjohn 56 Posting Pro in Training

it is correct.

you can have as many conditions as you wish in the WHERE

drjohn 56 Posting Pro in Training

The real question is why have you designed a database where you need to do this, and what are you trying to achieve - ie show the table schemas, and what you are looking for in the output.

drjohn 56 Posting Pro in Training

The reason auto-increment doesn't reuse values is to avoid the same id number being used more than once, I.E. to guarentee unique values.

drjohn 56 Posting Pro in Training

sorry, but that's how auto-increment works.

live with it.

drjohn 56 Posting Pro in Training

Only IE can read conditional statements, so you do not put the default css file in there, you put if before the conditional statement, and then bits in the css file loaded by IE will override the same bits in the default file.

<link href="../styles/main.css" type="text/css" rel="stylesheet" />

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="../styles/main-ie6.css" /><![endif]-->

Every other browser will get main.css, and ie6 alone will get main-ie6.css

simples.

drjohn 56 Posting Pro in Training

What a dreadful page - no doctype for a start, so it is designed in quirks mode! then it refers to IE5 and Netscape 4.5, and Flash 5 !!!
That page is an antique from a previous century - actually it says 2001, which makes it even worse, as css had been around for about five years by then, yet it uses tables for layout and in-line styles.

so just open IE and view it.

drjohn 56 Posting Pro in Training

You need to learn PHP programming and MySQL databases to do this properly. It is not a simple fix. You then need to secure each and every page that is for logged in people to exclude those who are not authorised. The action part of the form has to call a script (program) that you write to process the data input.

Alternatively, you can use the .htaccess file to secure a folder, but be aware that you might just lock yourself out as well.

drjohn 56 Posting Pro in Training

Tables for layout are a bad idea. Do try to learn about divs.

Google on son of suckerfish to learn how most people make menus with sub-menus. It's very simple to use.

drjohn 56 Posting Pro in Training

looks like a phone number.
so it's NOT a number, it's a string.
Any other data-type is wrong.

drjohn 56 Posting Pro in Training

does the tag field contain one tag eg blue
or do you have multiple tags in it eg blue, sky, clouds

If it's the second one, start by redesigning your database! Because the second means you have to rebuild it and have a threads table and a tagged table
thread---<tagged
where tagged contains thread id and the actual tag.

If it was the second one, your database is not even in first normal form. And hence you are doomed.

drjohn 56 Posting Pro in Training

www.cssplay.co.uk

Lots of examples of this there, usually under slideshow.

drjohn 56 Posting Pro in Training

transfer your pages using ftp - it may be built in to your web design software, or it may require a separate ftp program.

drjohn 56 Posting Pro in Training

NOT with PHP - this would require a call to the server every time the mouse moved over the area. Use javascript. This executes in the client's browser and so saves all the back and forth info flow between the client and the server.

Or use css. Make the area a link (to anchor="") Set the background to be plain white with text and change to an image on hover, or set an image as the background and change the image on hover. If you ignore early IE , then you can set hover on any item on the page.

drjohn 56 Posting Pro in Training

The solution to this is blindingly simple, as I use this a lot.
The user is NOT allowed to enter dd-mm-yyyy
Instead have a form with a field for day, a field for month, a field for year.
Then YOU take the year, the month and the day and build the MySQL required format. So exceedingly simple. so exceedingly fool-proof.
As we say in aviation - "you have control".

If you have designed a form where someone enters dd-mm-yyyy as a string in a single data entry box, I'm sorry but you have made a design error, an error that then causes you problems. Sort the data input form.

If the date comes not from a form but somewhere else, use explode and reconstruct the date in the correct format.

When you retrieve the date,, you have lots of formatting options in php in how you display that date. Again, you have control.

drjohn 56 Posting Pro in Training

This is NOT properly normalised
tbl_prim_pres_elect
state
state_id
date
cand_id
cand_name
party_id
numb_votes


Because cand_id dictates cand_name and party_id
SO you should have a candidate table containing that data.

next state and state_id - will there be two states with the same name??? No, so the true primary key for state is state.

Oh, and will there be two parties with the same name but a different party_id??? No, so party is the true key for that item.

There is a tendency for beginners to assume that all tables must have a numeric id as the primary key THIS IS WRONG. Use the natural key were ever appropriate. If the natural key was a triple composite key, yes, adding a numeric key does make life a bit easier, of course.

drjohn 56 Posting Pro in Training

one to many

drjohn 56 Posting Pro in Training

$name=$_POST('name');
echo $name;

is the standard way, as you can get access to the $_POST array values and then process them eg trim leading/trailing spaces, addslashes, remove html, convert to a date, check for illegal characters, etc, etc from the variable you pass the value to. You shouldn't get into the habit of using $_POST values directly. It's dangerous.

PS name is a reserved word, so it is a bad idea to use it as a variable name - use something different eg fname for first name, theName for enire name or whatever you want. But not name="name".

drjohn 56 Posting Pro in Training

it's been php as the main web programming language for about ten years now - where have you been? ;)

drjohn 56 Posting Pro in Training

include('deliverycosts.php');

then have your calculation rules in deliverycosts.php as a function and call that function after getting total order.

in the function, you could have a switch case to detect which outlet it was, and then have all the costs defined in each case.

drjohn 56 Posting Pro in Training

The order of the columns in the database is totally and utterly unimportant. You set the order you wish them to be displayed in in your sql query or in your php code that handles the result.

eg SELECT sname, fname, membnum, age FROM

or SELECT membnum, fname, sname, age FROM

or SELECT membnum, age, sname, fname FROM

And from any of these queries, you could use the php to display as
age, fname, sname, membnum

there is absolutely no need to have the columns in some "order" in the database.

drjohn 56 Posting Pro in Training

If you are using php,

/* assuming your query returns to $result

$numRows = mysql_num_rows($result);

There is an online manual for php...

If at the command line, it is returned at the end of the query output

Or in mysql, you can select count(*) as the only thing returned by your query, with your usual conditions (WHERE, etc) after it.

drjohn 56 Posting Pro in Training

You wouldn't

drjohn 56 Posting Pro in Training
ALTER TABLE tablename
MODIFY columnname VARCHAR(50)

Or if you have phpMyAdmin, select the database, the table, and Structure, then click on the edit icon (the pencil thingy) for the column and just set the new value.

drjohn 56 Posting Pro in Training

re by category - yes just substitute the category bits for the manufacturer bits.

drjohn 56 Posting Pro in Training

Okay it looks like the ERD is manufacturer--< vehicles >--products
Ie a manufacturer makes many vehicles, and a product is used by many vehicles

That means this might be what you are after

SELECT m.manufacturer_name, v.vehicles_model, v.vehicles_year, v.vehicles_engine_size, v.vehicles_fuel_type, p.products_ID
FROM manufacturer as m
JOIN vehicles as v on m.manufacturer_ID = v.FK_manufacturer_ID
JOIN products as p on p.products_id = v.FK_products_ID
WHERE manufacturer_name = "ALFA ROMEO"
LIMIT 0 , 30;

But that is possibly not what you really, really want. It implies from your table design that one product is used in many vehicles, but each vehicle uses only ONE product. Is that right?

Are you sure there isn't a linking table, as a more normal (sic) structure would be that a vehicle uses many products and a product is used in many vehicles ie vehicles>--<products
which would then require the linking table vehicleproducts, with the following relationship
vehicles--<vehicleproducts>--products

and vehicleproducts (vehicle_ID, product_id) with a joint primary key.
Unless of course this is a very special product and a vehicle only uses one eg one model of turbocharger is used, and the web site is to sell the one model they make that suits a given car perfectly. (I saw a site just like that two days ago).

davidjennings commented: Excellent help & feed back from drjohn +1
drjohn 56 Posting Pro in Training

It is normal to set the css for body first, as these are going to be global styles that you will then alter later for specific ids and classes.

Using tables for layout is soooo last century. Literally.

drjohn 56 Posting Pro in Training

If you are at the mysql command line, enter SHOW TABLES .This lists all your tables

To see the fields you have created, try SHOW COLUMNS FROM tablename.

To insert data into a table at the command line
INSERT INTO tablename (list of its fields)
VALUES (list of the values, in th esame order as the fields above).

I really think you should get a good intro level book on MySQL as these are very basic things, and so you need to read up on th etopic before doing anything else.

This one will suit you http://www.sitepoint.com/books/sql1/

If you are using something like XAMPP Lite, it has phpMyAdmin which youwill also find helpful. It's an interface to MySQL.

drjohn 56 Posting Pro in Training

Suggest you go read up on the son of suckerfish way of making menus. Your way will fail with javascript disabled and requires you to write lots of code for each link.

Suckerfish is sooooo much easier to use. just add the twelve line script via an external javascript file to the head, and make unordered lists of your dropdown menu. so easy to read and find errors in as well.
www.htmldog.com is where you'll find it.

drjohn 56 Posting Pro in Training

you'd really have to show us the table schemas before we can answer which fields to use in the join.

also it gets a bit easier to read if you use table aliases eg

SELECT m.fname, m.sname, s.game, l.league
FROM membership as m
JOIN gameplayed as g ON m.mid=g.mid
JOIN leaguetype as l ON g.gid=l.gid
WHERE.....
drjohn 56 Posting Pro in Training

The likeliest reason you see no error is because you are not asking to see any errors...

so alter the end of your query code

mysql_query("INSERT INTO iin_users (username, first_name, last_name, email, birthday, street_address, apt_number, city, state, zip_code, password)

VALUES ( '$username', '$first_name, '$last_name', '$email', '$birthday', '$street_address', '$apt_number', '$city', '$state', '$zip_code', '$password')") or die ("This bit didn't work"). mysql_error();

When you get it working it is often suggested you should remove any error reprots as it might help hackers.

drjohn 56 Posting Pro in Training

IE6 currently has about 10% of the market in browsers, so you may not need to worry about this for very long.

drjohn 56 Posting Pro in Training

Of course you can do it in dreamweaver, it's a web design program.

But you may have to expand on what your form does for a better answer, and you may have to write some php to process your form's input and output (forms are actual dead, lifeless items unless their content is fed into a script of some sort).

drjohn 56 Posting Pro in Training

The above suggestion is probably not valid html.
What you have to do is fake the appearance of a div, or rather a block of text as that is probably what you want to do.
And yo also want to start with plain html, rather than wrapping it up in php as your first attempt at getting it to work.

I can guarantee that this code will work, as I've used it on a couple of sites. It makes the link into a block and applies styles that look like a div with borders to it. Adapt as necessary to suit your code.

And practice with it in a plain html page, not in php, because if you can't get it to work on a plain html page, you'll mess up how to make it work with php

the html

<p>
	<a class="mySites" href="http://www.colorschemer.com/online.html">
	<img src="images/colorschemer-1.jpg" >
	<span class="linker">ColorSchemer</span> starts from a color picker grid of standard colors, or a hex or RGB value, and generates a set of 12 related colors. You can then lighten or darken the entire scheme by repeated clicking. There is an online scheme gallery where you can save your scheme and view others efforts. There is a blog about the site and related products, and you can download a 15 day trial of their professional offline color studio product.</a>
	</p>

and the css

.mySites img {float:left; border:0; margin-right:10px;}

a:link.mySites, a:visited.mySites {

	text-decoration:none; 
	display:block;
	color:#333;
	padding:10px; …
drjohn 56 Posting Pro in Training

The html files belong in the folder htdocs, which should have been created when you installed the wamp. Each site you create should have its own folder inside htdocs.

If you are hosting your own site on your own computer, you need a static ip address, but as your link worked, I assume that you have that already. However, as web hosting is so cheap, and there are even free hosts to use, you have to be pretty sure you are doing everything right to avoid security problems.

drjohn 56 Posting Pro in Training

margin:0;
padding:0;

drjohn 56 Posting Pro in Training

PHP is executed at the server, javascript is executed in the browser. Like html, javascript is plain text. So of course it loads as fast as html - it is simply sent directly to your browser, just like html. Your browser or computer might be slow at using the script and there's nothing you can do about that, apart from upgrading.

If you use external javascript files, as you should do most of the time, the file will be cached on the user's PC, and so when needed a second time, it will not be retrieved from the server.

You can't convert javascript to html - it is a script that is designed to be executed and alter existing html, to provide effects in the browser, to provide user interaction without the user having to reload the page from the server. PHP interactions however always require a call to the server and the page to be resent. So trying to do the same thing in php that javascript can do would be a slower process as the server would be involved at every stage and new pages would have to be sent to the user.

So I think you should start by asking yourself what exactly you think you are trying to do and whether you actually need javascript or PHP at all.

drjohn 56 Posting Pro in Training

goto is a throw-back to the 1960s and is generally considered a bad thing. It generated what is called spaghetti code and programmers are advised to avoid using it. It was a much loathed method of causing problems and has been expunged from almost all programming languages due to endless mis-use and abuse.

Use if, as suggested earlier or call a function rather than jumping to it and then returning. Or a switch / case set. Or anything else you can think of.

drjohn 56 Posting Pro in Training

re Friend_ID, Reg_ID, Reg_ID_2 as fields

Friend_ID is not needed, the joint key of Reg_ID, Reg_ID_2 would be unique, AND you'd have to declare it unique if you did it your way, otherwise someone could be listed two or three times as friend of the same person. But using the joint primary key immediately gets round this problem.

Many people have a bad habit of automatically adding a field called ID when there is a perfect natural key available. Then they have more work to do to avoid problems such as the one I mentioned. And they also often need extra joins to get at the data they need.

wes_solar commented: thanks for the reminder about using natural keys when available. +0
drjohn 56 Posting Pro in Training

html 4.01 was published in December 1999, and the last errata to the published details was may 2001
according to http://en.wikipedia.org/wiki/HTML

So it covers the current version that we all use.

XHTML is a dead end that offers nothing of use beyond HTML, because it is almost always served as HTML ! So using it is a waste of time.

CSS level 2 was developed by the W3C and published as a Recommendation in May 1998, according to
http://en.wikipedia.org/wiki/CSS2#CSS_2

As no browser fully supports CSS3 AND, more importantly, CSS3 is no where near being finalised for several years, then the CSS will still be valid. Using CSS3 is risky as the commonest browsers simply do not support it! So your book will not teach you anything that is not supported any more.

The only problem might be if it uses code to get round problems in older browsers that no-one uses any more eg code to fix IE5.5 or earlier (yes, IE6 is still being used by about 10-15% of the population, so you have to support that as well). Removing a hack might make another hack break down.

But to learn html and css, it is as up to date as you need.

The only thing it may do differently is use techniques that have been improved upon.

The standard advice is avoid using tables for layout - tables are for showing tables of data, not …

drjohn 56 Posting Pro in Training

You can only select the second row, or any other row, for a table in any meaningful way if you first sort the table on a given attribute.

For example, you make a database of existing club members, adding them in this order of membership no.

F2
F4
F6
F10
F21
F23
F31
and lots more (ie some previous members have left

Then member F2 leaves the club and you add two new members, F11 and F3.
Who is second in the table? - F6. Second in the data file anyway.
Who did you actually want from the table???

what if old member F2 now rejoins - where does he go in the table? Does his old data get marked as now to be used, or is he stuck on at the end of the table? He is at the end of the table, unless you have an attribute such as currentMember y/n, in which case he is now back where he was. The physical storage position in the database file is meaningless. The method of storage and place of storage is also not of interest, it is the data itself that should determine who or what you retrieve.

But wait, if you use a currentMember y/n field, then when F2 leaves, he is STILL at the top of the data file, so the second in the table is still F4, even though F2 is not …

drjohn 56 Posting Pro in Training

Unicode is not a font, it is a character set.
Fonts are on-screen shapes applied to the characters present in the character set.
The character set controls the number and type of characters you can use. (the alphabet(s) it can use)

To change the character set of a given column, a quick visit to the manual gives this little bit of sql

ALTER TABLE t1 MODIFY
    col1 VARCHAR(5)
      CHARACTER SET latin1
      COLLATE latin1_swedish_ci;

so you just have to insert the appropriate table and column names (and data type), and set the character set and collation as required. the collation would be utf8_unicode_ci, probably.

drjohn 56 Posting Pro in Training

You could use a google calendar and save yourself a bit of effort. Only problem there is that people can jump the queue by deleting someone if the list is full.

So I too suspect that overall you want a simple MySQL database and some PHP programming to allow people to add their names to the list, a secure login for the admin to enter the dive location and date, and to count the number of names for a given date and either display the data entry form or a sorry boat full message. Members might need a secure login to keep out troublesome scammers. Not difficult to do at all, if you play with databases and php regularly.

You might want to look at the business exchange part of the forum.

As I'm new here, I don't want to break any rules by making an offer to do paid work until I'm more familiar with the way the forum runs.

drjohn 56 Posting Pro in Training

check you have a doctype and are not forcing IE into quirks mode.
Check what is actually being presented by the web site via View source. if that's different to what your original template had, not sure what to suggest.

drjohn 56 Posting Pro in Training

shouldn't let them store two items in one field!!!
one field for things like dj1, another of things like band2
databases with two or more things in the same field are not normalised.
you may need a link table to hold a series on event, band links, the design of which depends on the rest of your tables.

drjohn 56 Posting Pro in Training

Or instead of concatenating, do this in your programming language which handles the web page layout, probably PHP. This gives you a bit more control as you can then do things with the individual dates, but still display then on the page the way you want.