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.

drjohn 56 Posting Pro in Training

There's nothing wrong when I view them in safari, chrome, firefox, IE5, IE6, IE7 and IE8, except for the Media page.

When i run just the media page through the validator it throws up 48 errors, including unable to determine parse model.

This might be becasue you only have half th edoctype declaration

it should be
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

but the page only has
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

So try editing the doctype to the full code. Also do this in some primitive text editor, as the validator mentions unicode as you have the outer page in charset=us-ascii" so try setting
ascii everywhere

drjohn 56 Posting Pro in Training

give the image a height of 100% and a width of 100% (or whatever numbers suit you.

HOWEVER it will look distorted and pixelated

diafol commented: like it - doh! fuzzy thinking on my part +6
drjohn 56 Posting Pro in Training

SELECT * FROM userbooks WHERE book_title LIKE '%yourWord%' or book_title LIKE '%otherWord%';

alternatively if both words must be present.

SELECT * FROM userbooks WHERE book_title LIKE '%yourWord%' AND book_title LIKE '%otherWord%';

is the correct way to do this.

Similarly

SELECT * FROM userbooks WHERE book_year LIKE '%33%';

drjohn 56 Posting Pro in Training

So WHY are you reviving a FOUR YEAR OLD thread on a completely different topic???

drjohn 56 Posting Pro in Training

Yes, declaring a column or pair of columns as the primary key automatically means they will be indexed.

drjohn 56 Posting Pro in Training

background-position:center center;
puts the center of the image in the position that corresponds to the center of the content, and vertically if you have a page with two lines, the vertical center is half way between the two lines.

So the trick is to tell the browser that every page is full of content, by adding this line to your body styles:
height:100%;

PS absolutely positioning a 100% wide container to 0,0 is identical to setting border:0; padding:0; for the body (a VERY common way to start the style sheet) and then no using position:absolute at all.

drjohn 56 Posting Pro in Training

You never need a semi-colon after the last declaration, before the closing } - it's a weird rule, but it's true. However it's good practice to add a semi-colon, in case at a later stage you add another bit, as then the lack of a semi-colon will cause things to go wrong.

drjohn 56 Posting Pro in Training

landing has a width of 760px.
INSIDE it is contentMain, with a width of 950px
contentNotMain is also inside landing and also has a width of 950px.


So contentMain is forcing landing to be wider and sticks out to the right side of it.
When I deleted the width declaration for contentMain and contentNotMain it got rid of the scroll bar until the page is smaller than you map.

Also, the css says for contentMain top:-290px; (why???)
then the inline styles you have applied say to use for contentMain top:0px;

Perhaps I'm being a bit picky, but that's quite a change!

Also you have used three nested divs to hold the first bit of text - WHY???

<div id="contentMain" style="left: 52px; top: 0px; height: 195px;">
		<div id="landingDesc" style="height: 192px">
			<div id="landingDescPad">

				<h1>Where does this drain go to?</h1>
				<p>Find out the impacts on the environment when something nasty 
				gets spilled. Select a season. Then, click on the map where the 
				spill occured. The map will show you where your spill went, and, 
				let you know how much damage to the environment the spill caused. 
				Click the &quot;Drains On&quot; button to show the underlying drainage network<br>
				</p>
				<form name="Season">
					<p>Rainy Season<input checked="checked" class="styled" name="GetSeason" type="radio" value="Rainy Season" /> 
					Dry Season<input class="styled" name="GetSeason" type="radio" value="Dry Season" /></p>

				</form>
				<p></p>
			</div>
		</div>
	</div>

You only need one div, with the correct css, to get the text in the correct place with the right …

drjohn 56 Posting Pro in Training

The query is returning the CORRECT data

Because the join is on agentID and there is no link between the customer and the product, but there is a link between the agent and the TWO products.

so the join of agent to product produces two rows, and EACH row then joins to the customer with the same agentID, and there are two of them, so you get four rows.

In other words, your tables are wrong.

You are relating ALL customers of each agent to ALL products of each agent.
Don't customer buy/use products, shouldn't you have some table which lists which customers are buying/using which products.
ie a customerProduct table with the customerID and the productId in it, to link each customer to their specific products.

It's called normalisation.

drjohn 56 Posting Pro in Training

That is totally normal.
The overwriting is known as the lost update problem, when two people edit something and save, the second save always overwrites the first one. In databases we use row locking and table locking to overcome this, which is why some databases can only ever be standalone and not shared - they don't all have locking mechanisms.
The problem arose the day they invented networks and gave more than one user access to edit a common file. I.E. it is a decades old problem, that everyone knows about.

It's a big problem and is not easy to solve. If you read the Wikipedia article on collaborative editing, you'll see it mentioned that it was demoed in the Mother of All Demos, but took decades to implement.

You still haven't said why on earth you want several people editing a file simultaneously. It is a very unusual requirement to need.

drjohn 56 Posting Pro in Training

I'm not surprised you have nothing to show for this so far!!!
I think you are in for a big disappointment!
And I don't think you know what you are asking for either.

The internet delivers data to each user, and they get a copy on their computer. There is no connection between the users. Nor to the original file. So there is no way that you can set up collaborative editing with a little PHP script. You need something special that links all the computers that are looking at the text together and transmits every mouse movement, every click, every keyboard press back and forth between the users.

Somehow, I don't think you'll be doing that with a simple PHP script!

Collaborative editing can be done over the internet - it was part of the legendary Mother of All Demos, back in 1968 - but you need a specialist tool to do this.

Try Google on collaborative editors to see what exists to enable many users to edit a file at once. It can be done.

Why do you wish to have multiple people editing a file at the same time??? It's a very unusual requirement.

drjohn 56 Posting Pro in Training

The answer above is how I do it. The function nl2br() was created specifically for this sort of thing.

drjohn 56 Posting Pro in Training

There is no need to have ProjectId AND ClientId, in the notes table, you just need projectID, and then join project to client. Otherwise you risk having the WRONG clientID in notes for the project listed. The correct clientID is defined by the projectID itself.

Similarly for the payments table you would not need clientId, you would use a join, for the same reason.

Re using ID instead of a word - ID is a word - a little word, but it's a word.
Adding tbl in front of the name of a table serves no purpose, that's why I say don't use that antique naming style. Similarly, in its own table, you don't need to add the table name to the ID, as it can only be that table's ID. For a foreign key id, it is common to add the table name to indicate which table the foreign key came from and distinguish it from the tbale's own ID

drjohn 56 Posting Pro in Training

What do you mean by the structure is not hierarchy???

A web site is a collection of html pages.

IF there are several quite distinct sections, YOU might choose to put then in different folders, and have a menu with sub-sections. But YOU have to build these menus and these folders. A site map is just a list of pages.

So what do you think FrontPage (the sign of the beast!) should have done?

drjohn 56 Posting Pro in Training

Make a page with links to the web cams...

drjohn 56 Posting Pro in Training

And not every server is set up to use server side includes.
Which has annoyed me several times in the past.

drjohn 56 Posting Pro in Training

Also a problem is this bit

tblProjects
ClientID(PrimaryKey)
ProjectName
Durration

clients may possibly have more than one project, and clientID is VERY unlikely to be the primary key of projects.

a better structure would be client--< clientProject >---project

IE a linking table, clientProject, which had as its joint primary key, the PK from each of the other tables.

This approach might help you solve some of the other things I asked earlier, by illustrating how it should be done.

drjohn 56 Posting Pro in Training

Does a client have many projects
does a client have many payments
does a client have many notes
does a client have many expenses???

OR
does a project have many payments
does a project have many notes
does a project have many expenses?

We can't tell with any great accuracy from here!

Why doesn't payments have a primary key but instead a foreign key?
Ditto notes, ditto expenses?

Also drop that tblPayments style of notation and just call the tables by the name of the ENTITY that they represent. And you don't need to call the id for the clients table clientsID, ID by itself would be enough.
eg compare your way
tblClients.ClientsID
with
clients.ID

less typing, less typos, easier to read.

so we need a bit more to go on to answer your questions.

drjohn 56 Posting Pro in Training

I notice you don't have a primary key, which would result in MySQL creating an index on the PK automatically.

It looks like you are building a linking table and that the two fields mentioned are in fact a joint primary key. So if you made them a joint primary key, neither would need the index declaration.

drjohn 56 Posting Pro in Training

yes


PS it's a popular homework question, pops up regularly in many forums, and at regular intervals. And it was in my course several years ago too.

drjohn 56 Posting Pro in Training

In other words it's a standard many to many relationship between orders and products, and so the standard linking table between orders and products is required, as described by urtrivedi .

drjohn 56 Posting Pro in Training

You really do need chem_name to be declared as unique. There are no two chemicals with the same name (although there are alternative names for some chemicals - eg acetone and propanone are the same thing)

This would then let the database engine do the work of checking for you.

PS does your database have Difluorophosphino(tetrafluorophosphoranyl)amine in it??? It's one of mine.

drjohn 56 Posting Pro in Training

Many people like video tutorials as they can see some interaction going on.

But you can't print out the tutorial, you can't see the beginning middle and that bit near the end where he said..., somewhere about 7:27 or was it 8:35.

Also, as you saw in the tutorial your referenced, he talks a lot but doesn't say much. And gets confused as he didn't have a script written out to talk from ;)

And he started saying the tutorial was on using include files, then covered absolutely NOTHING on include files for connecting to the database...

Sometimes tutorials go too fast at crucial points and you don't realise you've missed a vital bit.

Buy a book, and watch videos just to see the interactivity.

EDIT:
I decided to watch the first three tutorials. The first one started saying how to use include files. three tutorials and 25 mins later, and still no explanation of why we are using an include file, and the big advantages it gives us...
Some of the comments after the third tutorial make this point too.

This is why books, which have technical editors and are assessed as suitable and accurate, can be so much better. If the above three were combined into a single written tutorial, it would have been a couple of pages long.

A cute video isn't really all that good (unless you are selling them, of course)

drjohn 56 Posting Pro in Training

The second way is normalised, and great simplifies querying - you don't have to search multiple columns.

Apart, that is, from your failure to recognise that product and component are a natural joint primary key. There is no need to add another unique identifier, as it will cause you problems. For example you will have to declare the combination product with component unique and force the database to check this separately from checking the unnecessary id. Declaring them as a joint primary key makes this unique check automatic, and saves the extra check on your extra id.

So your table is just the two columns product_id and component_id.

PS you should be googling on database normalisation.

drjohn 56 Posting Pro in Training

You'd store info on the users in the users table in your database. That's what databases are for.

If you stored info on them in a text file, then you've just created a flatfile database, and then you have to learn how to retrieve data from such a table. Stick to using your mysql database and your users table, and let mysql and queries do the hard work for you.

drjohn 56 Posting Pro in Training

Identify the entities and the items of data that are being stored. Assign the items of data to each entity - you may discover one entity is actually two, or that two entities are actually the same thing.

do this by using two highlighter pens and a copy of the assignment - one colour for entities, the other for data. when you start to relate them, you are writing out the entities and their attributes, and that's your database. Watch for situations where you need a link table to join two tables in a many to many relationship.

drjohn 56 Posting Pro in Training

Also, it is very bad practive to colour code something to give it meaning. what happens when someone with a colour deficiency views the page? 8% of men have some form of colour blindness, and then you have the screen itself - one of my sites seems to have a pink background on one monitor and yellow on another that I use.

So do try to avoid using colour for special meanings, it is a bad idea. Ask any usability engineer - Oh I've just answered before the question was asked...

drjohn 56 Posting Pro in Training

Kaycy, a div is what is called a generic container, a box, a block, into which you put things - menus, content, images. You can have all of them in the one div, or you can have one div for each, whatever suits your layout.

A span in an inline thing, used to style a small part of a bigger thing. Like the words inline thing above this. (Note that when you make things bold here, it is NOT html you see but another type of code that teh forum code knows how to convert into html.)

The MS site is VERY strangely laid out, it uses multiple spans and divs in many places, often dozens at a time, when often one would be enough. It is probably generated via an in-house content management system. These are often designed to be robust enough that the user, who may know nothing about web design at all, can produce usable content that will work in any browser. So a technical expert on, say anti-virus software might be explaining how the anti-virus software works or telling you about new viruses, and just entering text into a box, like the one I'm using. Similarly, a public relations person may be producing a news item to appear on the page, again with no knowledge of html, while a database expert might be telling you about Access, with no knowledge of web design.

So, the code behind the page is not necessarily written …

drjohn 56 Posting Pro in Training

The tables vs CSS discussion comes up when a beginner first tries tables for layout, then someone points out that tables are for displaying data. Then people discuss the topic. This is exactly what has happened here, isn't it? There is no debate among experienced users and pros.

As for forms and tables <sigh>
http://designshack.co.uk/articles/10-css-form-examples

http://www.alistapart.com/articles/prettyaccessibleforms (nice colour gradient, try that in a table)

http://www.themaninblue.com/experiment/InForm/index.htm (the examples, not the crude unstyled version, of course)

http://articles.sitepoint.com/article/fancy-form-design-css
(they even have an entire book of fancy forms, all by css)

http://www.webdesignermag.co.uk/tutorials/make-your-forms-beautiful-with-css/

http://www.smashingmagazine.com/2006/11/11/css-based-forms-modern-solutions/

http://woork.blogspot.com/2008/06/clean-and-pure-css-form-design.html
(nice basic tutorial)

And note that these are OLD articles.

PS as for Microsoft knowing about things like web design let me say just one word
FrontPage ;)

drjohn 56 Posting Pro in Training

WHAT problem of storing information on users?

drjohn 56 Posting Pro in Training

Tables were invented in html for displaying tables of data.

People then tried using them to control the visual layout (yes, I admit it, when I was younger I did this too).

Then in 1996, CSS came out, and by the end of the century, CSS was adopted by pros to layout pages. So it is not some new technique, and by internet standards it is old.

There is NO debate any more (not since about 2000 - 2002 anyway).
Use CSS, it was invented for styling pages.
Use tables for displaying tables of data.

drjohn 56 Posting Pro in Training

Kaycy, the answer is no, you will not have to change to using html5.

The doctype you use tells the browser what tags are legal within that type, and how to interpret them. So when html99 comes out, if you have written a page using html4.01 and declared that doctype, it will still work exactly the same way as just now, even if all the tags we now use have been totally replaced by something else in html99.

Doctypes enable a web page written when one level of html was common to be interpreted properly when a more advanced level of html comes out, by stating which version of html you are using. The browser makers build in the correct method to use to interpret each version of html. So your pages will work okay.

Without a doctype, a browser will switch into what is called quirks mode, and quirks mode is rather different in every browser, so without a doctype your page can display very differently. Remember that the majority of people do not use firefox, and creating a page that can only display properly in a minority browser such as firefox, or chrome, or safari, or flock, is a very silly thing to do.

drjohn 56 Posting Pro in Training

It's probably how you are building your query that's the problem.

You have to start with a basic query, then for each checkbox that is checked, add the appropriate bit to the end of the query, then finally pass that to your database.

so, something like this perhaps

$sql ='select your fields from yourtable where 1=1'

then a select case type section or set of ifs which for each true case adds the next bit this way
if (checkboxA)
$sql = $sql.'and fieldA=somevalue';
if (checkboxB)
$sql=$sql.'and fieldB=othervalue';

and so on. I've written this in a hurry, it's not correct but it gives you the sort of ideas to use.

drjohn 56 Posting Pro in Training

Just how many rows are in the table?

I've just run several similar queries on a remote database table with 62000 rows, and the variations I tried took from 0.093 to 0.171 seconds. No index on the columns I used.

drjohn 56 Posting Pro in Training

In Notepad++, the choice of professionals everywhere, once you have saved a document with its extension (so it knows what language you are working in) when you start typing, it pops up a list of tags/function/whatever that begin with the first few letters you have entered. Great when entering PHP function names, for example, as there are so many of them.

It doesn't offer the intellisense of VB.net or Eclipse, unfortunately. But it is so lightweight compared to these two.

I also love the way I can have five or ten tabbed files open at once and if I close it, it remembers which tabs were open the next time I start it. VERY handy for continuing from where you left off.

And it's so easy to learn and understand too ;)

drjohn 56 Posting Pro in Training

notepad (not even worth the uppercase in its name) is to Notepad++ as a rusty bike with broken spokes, one wheel, no pedals or seat and a broken chain is to a Ferrari...

drjohn 56 Posting Pro in Training

The source code shows, as you'd expect, references to JQuery and scrolling. Try googling on JQuery img scroller for examples and tutorials.

And ignore the bit about framesets. Geez. Some people.


Edit: I thought I'd save you some time. Here's where they got the code from
http://flesler.blogspot.com/2008/02/jqueryserialscroll.html

drjohn 56 Posting Pro in Training

and where exactly in the source code do you see the tag frameset????

drjohn 56 Posting Pro in Training

If there is an error somewhere in your code, then different browsers' error correction features can lead to different results.

That's why a live page to examine is so much better than snippets of code. No need for us to re-create a page to test something, just use Web Developer Toolbar in FF on the real code and experiment to sort it. No dozens of html files all called test to clutter up the hard disk either.

drjohn 56 Posting Pro in Training

I'd guess that your css file got lost on the way to your browser, or got corrupted in some way (and then the corrupted version got cached and keeps getting used on your local machine).

you have the correct code to get rid of the list's dot - list-style:none; - so try Ctrl-F5 for a forced refresh and see if that solves it for you.

A quick link to your site would save people having to create pages to test your code.

drjohn 56 Posting Pro in Training

no, believe me. i work in firefox and its not required tos ay the least. im just really happy u dont understand! I feel like im the diamond in the rough!

The fact that you had to ask about html5 and the things you asked show that your knowledge of doctypes (and a few other things) is severely limited, and you probably haven't heard of quirks mode.

Perhaps you haven't viewed your site in IE to see how the most widely used browser displays it.

Perhaps you cold give us a link to your site, to impress us?

drjohn 56 Posting Pro in Training

And usually images are NOT stored in the database (even though it is possible). Usually you store the file name and location of the image file instead.

drjohn 56 Posting Pro in Training

There are a few differences between oracle and mysql's dialect of sql. Usually extras each has added. The basics of sql are very very similar in each db however. That's the whole point of sql.

drjohn 56 Posting Pro in Training

Don't try to write your own cart! Use an existing script or free service. They all include a way to integrate a service such as PayPal or any of the other money handling services. There are literally thousands of such scripts and services around.

If all you want is a catalogue with links to your PayPal account, then yes of course you can do that. Asking the question suggests you have little experience of using databases. You can store anything in a MySQL database and manipulate it with PHP. (Although most people recommend against storing an actual image in the database, just a link to where it is located is best).

I'd suggest you start by just playing with MySQL and PHP and when you've had a bit of practise, come back and ask more specific questions. Neither of these is something you can pick up in a few days, so don't rush at this, buy a book or two and work through the exercises for example.

drjohn 56 Posting Pro in Training

one order is related to only one customer, but one customer can be related to many orders
therefore it is one (customer) to many (orders)

You just ASK yourself "will this happen".

drjohn 56 Posting Pro in Training

SELECT from relations_like
WHERE id_like = idapple
AND id_like = idbanana

drjohn 56 Posting Pro in Training

Can't be done with PHP as it's executed server side and the result is then sent to the browser.

You CAN do it with CSS or with Javascript however, by send the info and hiding it, then the CSS or javascript reveals the hidden info.

If you visit the ukfolkfestivals site in my signature, go to one of the country pages, and click on any festival name that does not have its data visible, javascript will reveal it for you. I've deliberately got a slow reveal rather than a fast one, but it can be instant.

But you can't run PHP on the client's computer, so PHP can't do this..

drjohn 56 Posting Pro in Training

Looking at your code makes it all clear. It's the third <tr> from the left, which I've marked in red, that's the problem.

drjohn 56 Posting Pro in Training

to get reduce the number of joins required, when one of more queries continually need the same join.