pclfw 23 Junior Poster

My daughter had the same problem with her laptop. Windows 8.1 was installed and the whole thing was very, very slow. CPU running at 98% with nothing loaded.

The cause was McAfee antivirus. When I (finally) got rid of that the laptop ran like a young gazell. Upgraded to Windows 10 (her choice not mine) and it was like new.

pclfw 23 Junior Poster

Wow, the Country list begins with ths USA and Canada, the rest of us have to be in alphabetical order.

Who'd thunk it?

pclfw 23 Junior Poster

Perhaps it would be easier to split this select into a number of smaller SELECTs each satisfying a seperate case (received, etc.) Then use the UNION operator to join the whole mess together.
Also, split the lines up. Seperate the code so that you can actually read each join and understand where it fits in in whole.
That would make the code a little easier to read and stop our eyes bleeding when we try to help.

pclfw 23 Junior Poster

Just use

SELECT * FROM Hospitals WHERE city_id = $input

This will return all of thew rows where the CITY_ID is the same as the input value.

pclfw 23 Junior Poster

Try Google. I found the whole set in about 5 seconds.

knives67 commented: thanks, found it also.. :) +0
pclfw 23 Junior Poster

And your question is...?

pclfw 23 Junior Poster

You really should go to www.php.net and look at the function definitions. The PHP site is one of the best available for learning the language.

Even on a cursary look at you code there a major structural problems.

pclfw 23 Junior Poster
SELECT * 
FROM   property, 
       personal,
       spouse
WHERE property.id=personal.id
AND   property.id=spouse.id
pclfw 23 Junior Poster
pclfw 23 Junior Poster

"MAKE" a motherboard??????

pclfw 23 Junior Poster

I am not an Oricle DBA, but in MS SQL the WHERE clause needs to be very specific before it actually fetches directly via the index. I see no reason to expect that Oricle is any different.

pclfw 23 Junior Poster

The MySQL documentation has your answer (I've just been reading it.)

pclfw 23 Junior Poster
pclfw 23 Junior Poster

Ever thought about using the DB itself?

Set the username and emailaddress as a concatonated unique index and try the insert. If you have a duplicate the insert will fail. This is a much faster way of ensuring uniqueness.

pclfw 23 Junior Poster

So, have you had a look at the manual yet?

pclfw 23 Junior Poster

Write a function that takes a date value, (use whatever input format that you want) as input and gives your YYYYMM as output. Output the data in YYYYMM format. Not only will it be search-able, it was also be sortable. Use that function where ever you need to convert a data.

pclfw 23 Junior Poster

Also consider MS Access. You can split off the data tables & views from the GUI and have local (LAN) access into the data. MS SQL Server Express will drive a DB upto 1GB in size. It won't be fast, but it will be cheap.

pclfw 23 Junior Poster

Thanks Adam_k,

An app is a business application, in this case it would have been developed in house and thus SHOULD have conformed to (what little) naming conventions we have.

Each application currently has its associated data tables hosted in a single SQL Server database. One of the DBs holds data that is destined to be accessed by all of the other apps, but no other data sharing is envisaged.

The suggestion has been made that ALL of the data table be hosted in a single database. And the person who made that suggestion is influential enough to have this imposed unless a real REASON can be put forward against this proposal.

pclfw 23 Junior Poster

I was asked a question a few days ago that I cannot easily answer.

"Why don't we put all of our small application databases into a single database?"

Well, There's nothing really stopping us. All of our small apps were developed in house so we don't have any problems with conflicting table names etc.

My initial reaction was to recoil in horror, "No way!" I don't think that I shouted, but it wasn't far off.

But the questioner stuck to his guns, "Why not, can you come up with a REASON why we shouldn't do this?"

Well, how about high availability? Well we can set up a cluster, or mirrored pair of servers, so that's no limitation.

And, no, I couldn't.

So I'm throwing this open - How many Applications should be using a single database?

Over to you.
:)

pclfw 23 Junior Poster

If the query runs correctly within MySQL but not within PHP then I would suggest that the problem lies within your PHP code.

Which you haven't given us.

pclfw 23 Junior Poster

Your function loadXMLDoc() needs to validate its inputs BEFORE trying to create and call the XML request.

pclfw 23 Junior Poster

Change line 29 so that this button doesn't submit the page. Use the ONCLICK method to call the required javascript to send the data and display a message to the user. The form can then be reset or another page loaded from within the same script.

pclfw 23 Junior Poster

Try setting the focus of one of the new tabs elements to true.

pclfw 23 Junior Poster

It isn't possible for the client side javascript to access another domain. <<<<SOLUTION DELETED BY AUTHOR>>>>

However this really doesn't sound like something that I would like to happen to any of my data. Sounds a lot like cross site scripting to me.

pclfw 23 Junior Poster

How fragmented are the indexes? DBCC REINDEX is your friend.

Fragmented disks, these can also kill performance. Are the disks nearly full?

How full is the Db? can you archive records to reduce the number of rows in the table(s)

pclfw 23 Junior Poster

And have you tried looking in BOOKS ONLINE? If you don't have a copy then you can use the version on the Microsoft web site.

Search for ALTER TABLE

pclfw 23 Junior Poster

Have you tried

SELECT count(*)*1.0/
       
      (SELECT count(*) FROM events_may_2010 WHERE convert(varchar,call_date,112)= convert(varchar,GETDATE(),112) AND call_status IN ('1110', '1199', '1002') )*100
       
      FROM events_may_2010 WHERE convert(varchar,call_date,112)= convert(varchar,GETDATE(),112) AND call_status IN ('1110')

GROUP BY agent

ORDER BY agent
pclfw 23 Junior Poster

You can do this by having a sub-query which uses a RIGHT join to link PERSON and MENU (I don't think that MEAL is relevant here.)

Then SELECT DISTINCT from the resultant data set all of the PREFERENCE.PERSON where the linked MENU.DISH is not NULL.

There, that may help. :)

pclfw 23 Junior Poster

This sounds like a very ambitious project for someone who doesn't understand the complexities of the question they've asked.

You might wish to google 'Data Normalisation', followed by 'data optimisation'.

When you understand those two fields you might wish to reframe your question. Or you might wish to buy in a contractor who understands all of these things and will do it for you. They usually turn out cheaper than a screwed up DB in the end.

pclfw 23 Junior Poster

Surely it is more usual to clear both the username and password fields without giving any indication as to which was in error.

pclfw 23 Junior Poster

One of the many possible answers is to use AJAX to send the email data back to your server and then have a server side script format and sent the email.

You have a couple of advantages in doing it this way, you can revalidate the sent values, and you can limit the number of emails send.

You Server side script can be run synchronously or asynchronously and you can provide the client with error messages or email sent messages.

pclfw 23 Junior Poster

You may be having a slight problem with terminology & functionality.

SQL (Structured Query Language) is a language that OTHER systems (PHP / C / C++ / Java / Basic) can use to interrogate a database. This is a 'backend' language and doesn't normally have any user interaction.

The language that you use to call SQL stored procedures, or building SQL queries, is responsible for handling all user interaction and then building the SQL script with the required parameters in the correct place(s).

pclfw 23 Junior Poster

The code that you're using should work,

<?php // code to get final grades
//$sqlquery2 = "SELECT max($Totalmark) $fname, $surname FROM details";
//$results2 = mysql_query($sqlquery2);

If you inserted the missing comma between max($Totalmark) and $fname.
Might be worth a try.

pclfw 23 Junior Poster

How do I put this.

When your user clicks on the SUBMIT button, well, PHP has bin and gone and has nothing to do with the page any more.

PHP runs on the SERVER.

Javascript runs on the CLIENT in the clients BROWSER.

Now that should be hint enough for you to workout how to complete your submit function.

pclfw 23 Junior Poster

Well for starters you seem to have 4 values in the VALUES clause but only three columns in the INSERT clause.

The named values in the line

if($_SESSION[usedmemory] < $_SESSION[allocatedmemory])

should be quoted.

See http://uk3.php.net/manual/en/language.variables.predefined.php

pclfw 23 Junior Poster

Which DBMS are you using?

pclfw 23 Junior Poster

So are you saying that the tables I should have are IMAGES, EVENTS and GALLERIES?

I'm saying that you should have normalised your data first.

pclfw 23 Junior Poster

Now that I've gone back to your (edited) first post I have to agree with Migcosta. However a ternary relationship, by its name implies a special relationship between three associated items.

It might have been better to insert your changed query within the flow of the thread rather than edit the original query. I don't often re-read everything in a thread.

pclfw 23 Junior Poster

Two question on this one,
1) Shouldn't the strings within the $_SESSION[] markers be single quoted?
2) Aren't these SESSION variables? i.e. they give the information relevant to that particular session and not the total memory used. So USEDMEMORY should always be less than ALLOCATEDMEMORY.

pclfw 23 Junior Poster

Have you tried using urlencode() on the title?

pclfw 23 Junior Poster

Unfortunately your tables don't relate very well.

As your IMAGES table has the columns
| id | image | thumb | category | relation_id | date |

then, ideally, your GALLERY table should have
| id | title | category | relation_id | date |

Well actually the GALLERY table should be split into GALLERIES and EVENTS
GALLERIES would have
| id | title | category |
with ID as the primary key

EVENTS would have
| id | category_id | relation_id | date |
where CATEGORY_ID is a foreign key to GALLERIES.

Now you can actually JOIN these tables with SQL.

Play with these ideas for a while and see what you make of them.

pclfw 23 Junior Poster

Rather than have text literals embedded in the PHP / HTML scripts, these items are held in a DB table. A LANGUAGE variable is initially set to the value of the default language. This variable is used within the key of the record when building the SELECT string to fetch the text for use as the required text literal in the PHP / HTML script.

So the basic meta data table would hold these columns.
ROWID, LANGUAGE, TEXT

Each time a text literal is required then the actual ROWID value and the value of the $LANGUAGE would be used to build the WHERE clause.

Of course holding more text value columns, and fetching all of these values together when building the page speeds the page build considerably, and eases the maintenance of the meta data.

pclfw 23 Junior Poster

The last time I implemented a multilanguage website (English, French, Dutch) the varying language elements were held as meta data. Where data items were in different languages then these too had the language PK as part of their PK.

To add another language a complete set of the language elements were translated and inserted into a new record set with the language PK as part of their PK.

Note that this wasn't a translation system, the different language pieces had to be created and entered separately.

pclfw 23 Junior Poster

In the example shown all of these entities have existence without necessarily being related to the other two.

Degrees are defined prior to people being awarded them.

People start courses without necessarily being awarded degrees

Dates exist without being linked to people & degrees.

It is only when you are considering the specific instance of a degree awarded to a person on a date that these relationships have meaning.

And get to more of your classes and then you'll understand the questions you're asked. :(

pclfw 23 Junior Poster

This is starting to get a bit tricky to solve. There are just so many thinks that can be wrong or setup incorrectly with MS SQL.

Try installing the client tools onto a separate computer. Then can you attach to the SQL server from the tools machine?

Is the MS SQL Server process running under a LOCAL SYSTEM account or NETWORK account. Is Port 1433 open?

Books on line or microsofts own website might be your best bet.

pclfw 23 Junior Poster

before you try to work out what the DB structure looks like you should define your requirements.

Then, and only then, can you reduce your data into 3FN or Object tables. These alone will provide you with your DB structure.

pclfw 23 Junior Poster

SQL Server needs a small number of parameters passed to it on start up. Things like where the MASTER database is, error log location etc, have a look in Books On Line.

It is also notoriously memory & CPU hungry. Fill your server up with memory and use the fastest disks you can afford.

pclfw 23 Junior Poster

In Enterprise Manager highlight the database name, right click and chose VIEW > TASKPAD. This will show if there is any free space and where it is. You might want to make notes of the amount of free space and file sizes too.

You can then chose to right click on the DB name again chose ALLTASKS and SHRINK DATABASE. Click on the option to move the pages to the beginning of the file. Be aware that this will impact the performance of the shrink. Be prepared to wait a number of hours for this to run.

Now start figuring out WHY your DB ballooned so quickly.

pclfw 23 Junior Poster

Without knowing more details of your setup (OS, HTML server etc) it's very difficult to make sensible suggestions to help you.

Have you tried recompiling your HTML server without GD, and making sure that PHP is included into the server?

pclfw 23 Junior Poster

Ummm, bit of a discussion area this one.

You don't _have_ to have an index on the column you test against. But it will improve performance if you do. As for the storage overhead, disk is cheap, but people get very annoyed when their queries are slow, and they tend to shout a lot.