-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
that question borders on the phylosophical as far as database storge goes. Personaly I would do as you are doing, blobs can be a bit messy at times when it comes to formating the data return. Also, I am under the impression that you can get better compression on the raw file than you can on a blob entry. Just my two pence worth, like I said, you'd have been as well asking for the meaning of life
-
ok, here's the table info: IDtinyint(4) - auto_inc - PK namevarchar(40) timevarchar(10) dayvarchar(9) buildingvarchar(40) cityvarchar(30) addressvarchar(40) notestext opentinyint(1) smokingtinyint(1) literaturetinyint(1) handicaptinyint(1) birthdaytinyint(1) speakertinyint(1) rotateformattinyint(1) candlelighttinyint(1) NewChangedtinyint(1) activetinyint(1) well there is certainly plenty going on...this could take a while
-
How can I JOIN (I think) these two tables ??
Muddy_Funster replied to spacepoet's topic in MySQL Help
No problem, hope it helps. -
NULL is an empty value. Even white space takes up space, it has ascii code that represents it, so I think you are asking, what would happen in the event of white space being in there? Then, as you suspect, there would be a result returned. You can tweek the code to include any combination of fitering that you want. for other conditions that you want to exclude simply add them using OR within encompasing brackets, eg: WHERE (table2.employeeID IS NOT NULL) AND (table3.employeeID IS NULL) OR (table3.employeeID = ' ') OR (table3.employeeID NOT BETWEEN 0 AND 9999999)) just like in complex mathimatics, the brackets help dictate the execution order.
-
I'm not really sure on what you are doing here, but I think it's likely failing because you can't just call an external file as a variable for mysql_query(), you will need to load it first, or not just use it.
-
It's only got two fields, "SELECT field1, field2 FROM" is a more solid selection method, returning all the data anyway. That said, what if he doesn't need it? Do you pack all the clothes, books, games, furnature you own to go on holiday for a weekend "just in case"? I haven't heard a single GOOD argument for using SELECT * (ever).
-
sure, pm me the login and I'll post the requred info back in a format that we can all work with (I won't post any content, just structure and table/field names). If you could still throw up what you have so far regarding the PHP it would also give us a starting point for helping with that too (no sense us getting you to code a loop for something that can be done in a loop you already have).
-
How the H*ll did monkeykoder get into the end of the echo $query??
-
it's times like that that you will find error capture propper handy. $result=mysql_query("SELECT * FROM Persons WHERE username='$myusername'" ) or die ('Query !FAILED! with following error -- '.mysql_error(); Once you can see what the problem is, and I have a hunch what that is (but need more info to say more than it's an error in the query), you can then start to debug the issue, you can also post the error along with the code and we all have a better chance. it's easier to help someone when they can post "check manual for syntax to use near 'WHERE username =' " than with a PHP error generated because the code failed to create the output.
-
ok, so you want to know if, while a low priority query is being run, it can be interupted by another query being initiated at a normal priority? In my limited knowledge, I am fairly sure that once a query has been started it can't be stoped under normal running conditions untill it has completed. I think this will be a problem however because: A) your delete query is likely to run quick enough that it won't even overlap with any other activity B) even if it did overlap, MySQL can run much more than 1 querie at a time. So it's not really much of an issue as I see it. I think you are totaly missing the mark with what low_priority actualy does.
-
_POST is safer, but still not 100% (or so I am led to believe). using url variable passing is not nearly as popular as it used to be, which is kinda unfortunate when it comes to links in spam emails, but cleaner for everything else. I personaly would go down the hidden field in a form or session variable rout rather than the url?variable= but that's because I like to keep users ignorant of the workings of my sites - lets face it, if they want to know what variables I'm passing, it's not going to be for anything that will benifit me.
-
Should be fairly straight forward, can you post your current working code and a table+field list?
-
Does this ever work? and could you echo out an example of $DBprefix and let us see that's in there?
-
Yeah, your right, it can't ever equal both 1 and 2 at the same time. A work around mat be: SELECT tols.tutor_id FROM tutor_overall_level_subject AS tols INNER JOIN tutor_profile AS tp ON (tols.tutor_id = tp.tutor_id) having COUNT (tols.subject_level_id) = 2 This should show only those that have taken 2 cources. Not too flexible, but I'll keep looking.
-
sounds like your using the wrong kind of join, see if this helps: SELECT tols.tutor_id FROM tutor_overall_level_subject AS tols LEFT JOIN tutor_profile AS tp ON (tols.tutor_id = tp.tutor_id) (WHERE tols.subject_level_id) = 1 AND (tols.subject_level_id = 2)
-
No, he's not. The password is a sha1() hash. Fair point there, I missed that appologies.
-
Probably it's because MySQL doesn't actualy support the INTERSECT command. I'm not sure what DB app you learned that in, but for MySQL you're going to have to learn how to use the JOIN command.
-
No problem, let us know how you get on.
-
first off, welcome to the forum. now to the code : you can't just echo $result. You need to look at how your getting your output from the database to the screen from a different angle. also, you've kinda neglected to mention what $meta is all about. $result = mysql_query("SELECT * FROM {$table} WHERE 'ordreid'"); if (!$result) { die("Query to show fields from table failed"); } echo($result); $i = 0; while($i<mysql_num_fields($result)) { $meta=mysql_fetch_field($result,$i); echo $i.".".$meta->name."<br />"; $i++; } should look more like: $qry = "SELECT id_field, name_field FROM ".$table; $result = mysql_query($qry); if (!$result) { die("Query to show fields from table failed with following error --".mysql_error() ); } while($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row['id_field'].'">'.$row['name_filed'].'</option>'; } Take time and look through example code and some manuals to get a better understanding of what's going on here. It sounds dull, but is no more time consuming that trying to work out what the problem is on your own (although it is marginaly less frustrating).
-
Biggest security hole I see is that you are storing the password in plain text, and pulling that password out of the database during the login. all you need to get back from the database is a single field (username, id etc.) during the login so that you can establish a user exists matching the login credentials given by the user. As for further enhancements...out with my scope to comment through experiance, but some speculation I can offer is: 1. add a field to the database for the IP scope of the user logging in (ip address minus last three possible digits) and have a comparison on that. if the user loggs in from another location - ie school, office, university - than is held on in the database, you can have an email sent to the registered address stating this (or block it from being able to access at all - but that's a smidge extreme). You can also generate custom session variables, again that you can store in the database, based on other client information at time of login, to add extra security to the sessions. Hope that at least helps a little
-
SELECT sub_event_entered.sub_event_id, sub_event_entered.race_no FROM sub_event_entered LEFT JOIN sub_event ON (sub_event_entered.subevent_id = sub_event.subevent_id) LEFT JOIN main_event ON (sub_event.main_event_id = main_event.main_event_id) WHERE main_event.user_id = $user_id JOIN is your best friend - take the time to learn it well.
-
help: checking before doing query in php with mysql
Muddy_Funster replied to don11's topic in PHP Coding Help
That's a bit of a strong statement, perticularly with the capitalisation of ALL. I dissagree, partly: The first if is not, in my opinion, the best way of handeling an execution error - use of a try would, I think, be better. Personal prefference on my part sees that I never nest variables within an SQL string, but break the string and add the variable with dot connectors. Just because I have come across a fair few occasions whre people (myself included at the start) have tried to nest a variable within a single quoted string. oh yeah....and I personaly have never build a query with "$which = $link1;" in it . Good template though - could be well worth starting a sticky with simple templates like this in it for a quick refference (though you may have to restrict posting in it to admins/mods so tubes like me don't ruin it ) -
I don't understand what you are trying to do here...People get older, as the current date increses, so will there age. are you trying to force their dateOfbirth field to be constantly set to what it would be were they born 20 years and 335 days ago? I'm confused, what you are suggesting makes no logical sense without any context to go with it. Could you tell us a bit more about what you are actualy trying to achieve here? P.S. CURRDATE() is the same as DATE_FORMAT(now(), '%y-%M-%d') - just a nicer way of doing it.
-
or.... SELECT uniqueID, employeeName FROM table1 LEFT JOIN table2 ON (table1.uniqueID = table2.employeeID) LEFT JOIN table3 ON (table1.uniqueID = =table3.employeeID) WHERE (table2.employeeID IS NOT NULL) AND (table3.employeeID IS NULL) @jay7981 : SELECT * from a two field database?!?!?! REALLY??