
artacus
Members-
Posts
737 -
Joined
-
Last visited
Never
Everything posted by artacus
-
Could someone with a bit of Talent help on this one.
artacus replied to todayme's topic in PHP Coding Help
Dont you have the entries in your status table ordered lowest to highest? I was guessing your status table would look something like so id name 1 Recv'd 2 Pending 3 Sold 4 Closed or whatever would be lowest to highest. -
Dang it emerkay stop doing that. LOL. Seriously there should be a mod to tell you who is replying to a thread before you reply.
-
SELECT COUNT(*) AS cnt FROM applicant WHERE specialization ='administration' ... or if you want all specs... SELECT specialization, COUNT(*) AS cnt FROM applicant GROUP BY specialization
-
It's called a JOIN SELECT * FROM tableA AS a JOIN tableB AS b ON a.id = b.tabA_id WHERE whatever
-
Could someone with a bit of Talent help on this one.
artacus replied to todayme's topic in PHP Coding Help
Ok, well you'll need to first to a subquery to see what the max() status was. Then you'd return any records where the status matched max_status from the subquery. -
Yeah, see if you can do everything inside of a single query and while loop. It will make it easier to write and will perform better because you are not doing all the db calls. Another good trouble way to troubleshoot php / mysql is to echo out the query and try running it in phpMyAdmin or similar.
-
See if this isn't what you want: $arrErrors['email'] = array('type'=>'toolong', 'description'=>"The email ..."); or less likely: $arrErrors['email']['toolong'] = 'The email ...';
-
This isn't two queries, its just two where clauses. You can have any number of where clauses and separate them with AND or OR as appropriate. Use ()'s when using OR's. eg. SELECT FROM article WHERE visibility = 'notlive' AND `date` BETWEEN ... whatever
-
When doing queries, its always good to do this: $result = mysql_query($query) or die(mysql_error()); So you can get a clue where it is going wrong. And it looks to me your problem is going to be the unclosed quote around $title at the end.
-
SELECT SUM(accessed) AS tot_access FROM myTable
-
If you have to scream "Pass the potatoes!!!" Your table is too big. If you cant crawl into your chair because it is constricted between the table and the wall, your table is too big. I think you both would do well to read a book on database design and normalization. Database Design for Mere Mortals, is a pretty good one to start with. Databases can scale to enormous proportions, but you've got to be really smart about how they are laid out, joined and indexed.
-
LOL. This is an awful post. You are all over the map here. Give a little more thought to what you want to do and then spell it out. This is way too vague to work from.
-
LOL. You've got too much time on your hands Barand. This is an excellent thread. Well, I'm no Harry Fuecks. I do write web apps for a living, so I've got to be at least a professional at PHP, SQL and JS. Here's my philosophy on the subject. I think that its important here to differentiate between knowing the science of programming and learning the art of programming. You can learn how to do everything possible in Photoshop, but that doesn't make you an artist. In the same way, you can memorize the php manual and be a master of oop. But the art part is figuring out how to write apps that will be adaptable to new situations; be easily configurable; how to store your information efficiently in your databases; interact with your users in a clean and understandable interface. The science can be taught in a book or learned in a tutorial. The art part takes much longer to grasp and for that you need experience.
-
WTF? You stealer of avatars. Here, you can be pinky.
-
This is true. Have you ever tried coding something you've never done before when your Internet is not working? You might as well take the day off.
-
Well like I said, google maps will do 1 and 2 for you. After you have the lat/long you need to use the haversine or Great-circle formula to calculate the distance. http://en.wikipedia.org/wiki/Great-circle_distance
-
SELECT g.id, away.name as 'away_team', home.name as 'home_team', DATE_FORMAT(g.game_date, '%m/%d/%y %l:%i %p') AS game_date, g.away_score, g.home_score FROM games AS g JOIN team AS home ON g.home_team_id = home.id JOIN team AS away ON g.away_team_id = away.id WHERE g.game_date < NOW() AND (g.home_team_id = 101 OR g.away_team_id = 101)
-
Need some help with a query please, counting fields...
artacus replied to mikeee's topic in MySQL Help
Ok, well if you want to do a count, you probably shouldn't have the "and userid=X" at the end since you'll only have 1 record. This query will help you get a little more detail. I'm assuming you are not allowing nulls. If so, you need to take those into account as well. SELECT COUNT(*) AS num_users, SUM(IF(field1 = '' AND field2 = '', 1, 0)) AS one_and_two, SUM(IF(field1 = '', 1, 0)) AS empty_one, SUM(IF(field2 = '', 1, 0)) AS empty_two FROM users -
Well does the guest account have any permissions on your server?
-
Wow. You need to read thru a few tutorials first.
-
LIKE or RLIKE
-
You need to modify the LIMIT part LIMIT (number to skip), (number to fetch)
-
Yeah, so what's the error? Does it not like your user/password or is it not accepting the connection?
-
Remove "LIMIT 0,5" from your query.
-
For this type of application w/ large tables, I'd try to avoid searching 3 columns at once. Its important that these run very fast... as fast as you can type. Maybe a radio button that indicates what you are searching on. When I do these, I don't start the search until there are at least 3 characters. For first name, I make them enter a last name and a comma before they can search on it.