Your way is just wrong, the method above is correct.
drjohn 56 Posting Pro in Training
vedro-compota commented: ++++++ +1
Arkinder commented: Accurate information. +1
Your way is just wrong, the method above is correct.
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.
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?
Are you sure about these quotes around combination? I've never done that when using sql.
WHERE test1.IDONE = `combination`.IDONE
If you're working on a worthwhile project and it can't afford a budget of about $150, it's not really a worthwhile project, is it?
Although I didn't notice it supporting SQLite either.
Sorry, but if just driverID and vehicleID are the joint primary key OR are a unique pairing, then no driver can ever drive the same vehicle more than once. Ever. Therefore the suggestion above is just WRONG.
As you originally had it, a triple joint primary key was the correct solution. That way the same driver and same vehicle can be booked but it must be on a different date. Assuming that a driver and vehicle are never booked for two different things on the same day, that is.
If you have separate tables for driver (and you should) and vehicle (and you should) AND for booking (and you probably should) then the bit about foreign keys does prevent you using a driver who doesn't exist and a vehicle which doesn't exist. That's what foreign keys are for. Assuming of course that you state the correct storage engine type because the default engine in MySQL is myisam, which does not support the concept of foreign keys. You must make it use the innodb engine for foreign key referential integrity.
Triple joint keys are less common than double ones, but they do occur.
How would you check that the driverID was valid - only offer valid driverIDs via a drop-down list, and ditto for vehicleID.
And how do you get these to be valid - start with a form where the date is entered first, clicking the NEXT button then queries the database for drivers and …
you're using position:fixed and position:absolute
That usually causes lots of problems.
Position:fixed says place it exactly here in the browser, no matter what the user does about scrolling, at these points relative to the corners of the viewport.
I'd suggest scrapping this design which is seriously doomed to failure and will be the source of lots of head banging against walls.
Make a new design.
Use a #wrapper div and give it a width, and style it margin:auto; - now it is centered.
Put your other divs inside it, give each of them a width and float them to the left or to the right. OR set margin:auto on them to center them. Use position:relative.
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.
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.
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.
You'd also need details of WHO authorised the medication each time, who administered it, and probably other things too in the table above.
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.
Remember that a visitor can read your javascript...
not exactly secure, is it/
Find some new tutorials!!!
What about floating? Do your tutorials mention that? It's a very common way to control layout. You really should avoid position:absolute as much as possible. I can't remember coming across many (any?) tutorials that only used position:absolute as the main way to control layout. Seriously. It is NOT the normal way to do things.
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)
Have you considered re-inventing the wheel?
Perhaps you enjoy a challenge, but the most efficient way to get a forum going is to use some of the existing forum software which has been refined over many years, often by teams of developers. There are free forums, including open source ones, and almost any one of them would be more reliable than a home grown system.
The choice of how you lay out the threads is trivial compared to the programming challenges you will face.
No, you need to set it in a div, give the div a name (class or id, whichever is most appropriate), give the div a width and set margin:auto. And of course drop the position:absolute completely - it's almost always a bad idea to use position:absolute.
If you expect to have more than one similarly styled paragraph in the div, and only paragraphs with those styles in it, apply the paragraph styles thus
#divName p { styles in here }. This way you don't need to add classes to each paragraph in that div, they will be applied automatically for you.
PS Perhaps you've noticed that on the web text is hardly ever justified at all (I can't remember the last time I saw it used, it's so rare). That's because text:justify; generally makes the text harder to read as the spaces between words can become very variable and annoy the reader. So I'd suggest dropping that as well.
I know, but it's an answer to the original question. I can post an entire javascript that will do this, with a variety of window sizes on offer, if you like.
Incidentally, it's not deprecated in all versions of html, and it's not a style either, it's a behaviour/action. But personally, I wouldn't use it anyway. I just suspect from the nature of the question that it might be the simplest answer for that poster
PS Pritaeas, I looked at your glider emblem link
Now THIS is a glider (and it's mine) ;)
http://www.eaglephoto.co.uk/EaglePhotography/Bicester_Regionals/Pages/LS8.html#0
Apart from still using { } instead of ( )
where you have any line like this
SNAME varchar( 200 ) NOT NULL default,
you have to state what the default value is.
eg
SNAME varchar( 200 ) NOT NULL default 'fred',
so obviously you will have trouble setting default values for some fields, like name, address, post_code, in fact ALL the fields where you have used default!
Default is normally used where you can have the database automatically insert a valid default value - say no, which you will occasionally later set to yes . so in a houses for rent database, the default value for a new property for available would be yes, which you'd change to no whenever it was rented out. Your query to display available to rent property on a web site would then use "where available='yes' ", so visitors don't get excited about a property, only to discover it's been rented out for years.
Create a link in the normal way and set target="_blank" The new page will open as a new window.
PS Any idea why iceandrews thinks that a board on html and css is the wrong one for a question like this???
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.
Please explain the difference between LEFT JOIN and LEFT OUTER JOIN in MySQL. To the best of my knowledge there isn't any.
Sorry, my mistake. I just had it drummed into me to say left outer join and forgot that left join was identical.
nearly right
it's a left outer join
SELECT months.month, IFNULL( payroll.pay, 0 ) AS pay
FROM months
LEFT OUTER JOIN payroll ON payroll.month = months.month
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.
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
It might help if we saw what was in the original table you are querying.
And that's not an inner join, it's just a join.
Now an answer.
Your menu is wider than the containing div, and sticks out over the edge of it on the right.
your <li><a> bits are respecting the edges of #container and wrapping when they met the edge. You want them to ignore the edge of #container and work with #menu.
You can change the height of #menu from it's silly height:4.01% to a min-height:4%; and add position;absolute;
Or set #menu to min-height:4%; and add position:absolute; to #menu ul
This all works better when you stop using percentage widths and use a fixed width instead.
PS As it's Xmas, why not visit one of my sites.
Let's start with the most obvious errors and clear them away first, shall we?
You have float:both; for #menu
float takes the object out of the normal document flow and moves it over to the left or the right edge of whatever is containing it. There is no such thing as float:both, because you can't move to over to the left AND the right. So remove those lines completely.
Next, your ridiculous percentage widths all over the place, such as width:87.3983%;
Monitors work in pixels as the display unit. Suppose we have a viewport that is 1000px wide, for ease of calculation.
You are telling it to make a div which is 873.983 pixels wide. THIS WILL NOT HAPPEN! It will be rounded off to 874px. So get rid of these silly bits after the decimal point and use, for example 87%.
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.
You should be using floats for this layout! Otherwise each div will automatically appear below the previous one, which is what you are getting with your current code.
#right-navigation{
width:290px;
height:658px;
/*margin-top:90px;/*this space is for right upper navigation*/
background:#E9E9E9;/*light blue colour*/
border: 1px solid black;
float:right;
}
#right-upper-navigation{
width:290px;
height:90px;
background:#968B79;
border: 1px solid black;
float:right;
}
#masthead{
margin-top:40px;
width:690px;
height:90px;
/*margin-right:90px;*/
background:green;
border: 1px solid blue;
float:left;
}
So I've deleted your margins on the right hand divs and floated them right, and floated the masthead left.
PS this bit is silly
<body class="body">.....
it is just <body>
Apply any body styles directly to the body tag itself in the css, as you have actually done. But drop that height you have given the body, it will lead to problems later.
PPS and setting margin:auto for the body will center the design in the browser window - not everyone works with a viewport of 1024px, some users have it wider.
$result = mysql_query("SELECT email FROM users WHERE email='$name'",$db);
Your form is not passing any variable called $name, and also you haven't even collected the data from the form at this point - your $_POST bits come after this, so even if it was a variable on the form, you can't yet use it.
Also, you are not sanitising any of your form data, but are passing it directly to the database!!! Very risky indeed.
You need multiple tables to do this properly.
person--<loans>--equipment
person stores people details, with a PK = PersonID
equipment stores ALL the stuff you loan out, with a PK of eqipID, and includes a field called eType for type of item (plus other fields you may need)
for example equipment {equipId, eType, description, manufacturer, cost, rentalFee, modelNum, whatEverElse}
loans records all loans you make
loans (PersonID, equipID, dateOut, dueBack, dateReturned) and perhaps a few other things you personally might need. It has a joint Pk of PersonID and equipID
this way you can check all loans by any person, all loans of any bit of equipment, all loans on any type of equip, find all stuff due back or a particular type of equip due back, and all stuff that is over due or a particular type of equipment that is overdue. ETC, etc, etc
Basically your original design is very poor indeed. Very inflexible. AND most important of all, stores no historical info, as you are resetting a loan to personID=0 when it is returned and destroying your history.
PS don't waste typing time and risk typos by preceding each table with that t_ ! eg t_Person. that style of notation is rarely used and is from a different era of database design. Just use the table name, it is all that you need.
I had similar problems with server2go and it seems very difficult / impossible to add things to a database on it. I too played withits config file for hours of endless confusion.
I switched to using usbwebserver (http://www.usbwebserver.net/en/) which completely wipes the floor with server2go. I now use it as my home test server, and to distribute to a couple of clients the current state of things I'm building for them. And once they have got it running, I can send them just the files that have been updated to copy and paste.
Usbwebserver has removed a mailing program it originally used, as it gave false malware warnings because malware that took over people's PCs used the same mailing program and got it a bad reputation (the mailer, not Usbwebserver)
Dump server2go, it is for a fixed content database, not an editable one.
EDIT Damn, I didn't notice the dates and have been tricked by a forum spammer into replying. But my advice is still valid.
i would like you to help me to build my school database query rightnow
In your dreams.
The blink tag was invented as a joke, when someone at Netscape said can you make the text flash on and off. It is highly NOT recommended for a variety of usability reasons. It is considered one of the signs of a true beginner.
Write worthwhile content???
Interesting that you say you offer link building as one of your services ;)
Javascript mouse followers / mouse trails were considered cool - in 1999.
It's 2010 according to my calendar...
Just give each link a title, which will appear as a tooltip for you with absolutely no effort required. No special tooltip code required what so ever.
<a href="images/friends/arnie.jpg" rel="lightbox[friends]" title="This will show up as a tool tip when the mouse is hovering"><span class="classic">This is my friend arnie, click to enlarge!</span><img class="gallery" src="images/friends/arnie_small.jpg" alt="friend 1" title="While this bit will appear as the cation in the lightbox, okay?" /></a>
If you drop the angled bars with home, about, etc, you can simply set the rest of the image as the background to a wrapper div, and then set content and header divs inside that which correspond to the positions of the areas you will use for your content.
Then you might, with a bit more practise, set a nav bag below your header area and another as a side bar on the left and make individual images for the two types of angled bar. Don't use some fancy font as you have in your design - if it is not on my computer, it will substitute some other font and look very different.
Just remember, building web sites is not really about making a pretty picture in photoshop or similar packages.
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.
IE6 currently has a market share of between 4 - 6% of the browsers used world wide...
I was just about to recommend the same book! (Second hand from one of the charity bookshops on Amazon gets you great bargains!) Books are better than little two page tutorials on a simple sub-topic. Online tutorials could be written by another beginner, books aren't.
Treat all user input that interacts with the database as an attack!!! Check it carefully for signs of an attack.
Don't you just love memorising 2800+ lines of code then juggling it around in your mind to spot the answer!!!
If the page had been online and an url supplied, it would have been soooo much easier to use web developer toolbar to test edit it with no problems and all the images in place...
joins are made on data that is identical.
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.
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.
As a scientist I can give only one answer - do the experiment!
Make a couple of templates, one simple, one a little bit more complex, and see if the client can use them. It's as easy as that. If the answer is yes, get to work on the project. But send her some of the intermediate templates as you work towards the final target,m to check it is still working properly. After all, it's all html, isn't it.
#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.