Jump to content

ThePsion5

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by ThePsion5

  1. Nevermind actually, I can do the same exact thing by using the Union Syntax with a MySQL view.
  2. An example of what i'd be trying to do:I have four tables, Location, Battle, War and Related. If a battle in WW2 (in by Battle took place in a certain City and that city is in my Location table, I want to record that relationship in my Related table. But if WW2 is in my War table, I also want to record that relationship in the Related table.This may seem like a minor problem but i'll be dealing with a database with 14 or so tables, and i don't want to have a corresponding Related table for each of them, although there may be no way around it at this point, sadly...
  3. Hi,I have two MySQL tables that form part of a resume database and I'm trying to create a MERGE table in MySQL that uses information from both of them. Now, according to the documentation it seems like I can use standard UNION syntax and combine two select statements in the union clause, but MySQL returns a syntax error when I attempt to do this. Here's my table creation SQL: CREATE TABLE MergedProjectFullInfo(ProjectTitle VARCHAR(120),Description TEXT,Placename VARCHAR(120),SkillID INTEGER UNSIGNED,SkillName VARCHAR(120),SkillType VARCHAR(120),Relevance TINYINT UNSIGNED)ENGINE=MERGE UNION=((...FIRST SELECT STATEMENT)(...SECOND SELECT STATEMENT)) I'm wondering if I can only specify exact tables instead of being able to use the standard UNION syntax, which is the impression I was under previously. Thanks in advance!
  4. Hi guys,Recently I ran into an interesting SQL problem when trying to design a database with a significant number of tables (10+ means significant for me, lol) and I wanted the capability to have 'notes' associated with one or more of these tables (A.K.A. a location could have a note about a famous battle, but someone who was part of it would have the same note) and I havn't found an easy way to do this with SQL, at least not MySQL. I'm a stickler for designing tightly-knit databases and I would like to take care of this at the database level, but I also wonder if this is something that I should just use PHP for. Any help would be appreciated, thanks!-Sean
  5. Hm...that's a shame. I was hoping that I could create a PHP function that would scan the HTML files in the root directory of the website and compile information on their meta-tags. Is there a way to do this without requiring ftp access to the server?
  6. Here are all the error messages i recieve: I get the feeling that I'm going about this the wrong way, but I was also under the impression that i could pass an http reference as a path. Perhaps I was mistaken...
  7. Hi,I'm trying to write a script in PHP that obtains and compiles meta-tag information about a specified website. I modified a script i found at php.net to iterate through all html files and directories when given a specified directory, but this appears to only work on a local host or directory (any attemps to use this by specifing a remote host) return the following error: Here's my PHP code, sorry if it's a bit lengthy:function read_dir($dir, $depth){ global $MaxDepth; $path = opendir($dir); $info = pathinfo(dirname($path)); $i = $info['dirname']; while (false !== ($file = readdir($path)) && $depth <= $MaxDepth) { if($file!="." && $file!="..") { if(is_file($dir."/".$file)) { $files[]=$file; } else { $dirs[]=$dir."/".$file; } } } if($dirs) { natcasesort($dirs); foreach($dirs as $dir) { read_dir($dir, $depth+1); } } if($files) { natcasesort($files); foreach ($files as $file) { search($dir . '/' . $file); } } closedir($path);}
  8. Hi guys,I have the following situation: CREATE TABLE Alpha(ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,...ForeignID INTEGER NOT NULL,...CONSTRAINT FOREIGN KEY (ForeignID) REFERENCES Beta.ID ON DELETE CASCADE) AUTO_INCREMENT = 0; Ok...the way I understood how foreign keys work is that if a row is deleted from the table Beta and that row's ID is referenced in the ForeignID field of Alpha, then that row in Alpha should also be removed. However, MySQL doesn't seem to be doing this properly and i'm not entirely sure why. Am I missing something basic here?
  9. I figured it out...i misunderstood the '*' symbol to mean any character instead of just the preceding character, so it was using the first and last '*' as the delimiters and getting confused by the rest. This is the proper regular expression:"/ *; *| *, */"Maybe this will help someone else.
  10. Hm...that page was pretty helpful actually, thanks :)One other thing...the following regular expression give me an error, but I believe i'm using the correct syntax for it: "*;*|*,*" PHP tells me that "|" is an unknown modifier...according to the documentation, my version of PHP supports this as the 'or' character. What am I doing incorrectly?
  11. ok...I've done some researching and I think I found a regular expression formula that matches my first request. To break a string up by the following characters:,, + any number of spaces;; + any number of spacesI would use this expression:";*|,*"Is this anywhere near correct?
  12. Hi guys,For anyone here that is familiar with regular expressions in PHP (which I am not, sadly), this should be fairly simple. I need the syntax for three expressions that will break a string apart explode()-style for the following strings:","", "";""; "I also need a regular expression for just the first two and last two characters. Unfortunately, however, I need this very soon and PHP's regular expression page intimidates me, lol. Is there anyone who can A.) show me the regular expressions I need or B.) point me towards a good tutorial that explain the basics of them without getting too involved. Thanks in advance!-Sean
  13. AH! I should have seen that, lol. Thanks!
  14. I tried reformatting my HTML code like so, but with no luck: <a onclick="popupRelated('related.php?id=13&field=keywords&name=test%20link%203')"> I also tried the reverse where i enclosed the function in single-quotes and the URL in double quotes with the same result. Stupid IE! I have it set up the way that the W3Schools Tutorial has it set up, I don't see why it wouldn't work...
  15. I have the following snippet of code from a javascript function that I call as follows on my page: <a onclick= popupRelated("related.php?id=5&field=keywords&name=SomeKeyword")>Random</a> Now, in Firefox this works perfectly, but It breaks in IE. I get the following error: can anyone tell me what's going on? My actual javascript function is here:function popupRelated(url){window.open(url,'Related Items', 'width=640,height=480,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no');} EDIT:I tried replacing the single quotes with double quotes in my window.open method like so: function popupRelated(url){window.open(url,"Related Items", "width=640,height=480,scrollbars=no,resizable=yes,status=no,toolbar=no,menubar=no,location=no");} but to no avail. Any ideas?
  16. ThePsion5

    CSS and Forms

    Damn, I guess I'll have to do it that way then, lol. Thanks for the help though!
  17. Well, the first think I would look at is the way you have your CSS written...you might want to try writing it like this, otherwise browsers might not read the CSS at all:.newsflash {position: absolute;left: 544px;top: 544px;} You may also want to try enclosing your flash elements inside of a div tag, this may also make thing easier and i've found that it eases a few other problems as well.Good luck!
  18. ThePsion5

    CSS and Forms

    Hi guys,I know that I can style general form inputs by writing CSS for the input element, but is there any decent way to style a submit button without applying that same style to all other input elements or having to individually give them a class or ID? Thanks!-Sean
  19. That works perfectly well, actually. Thanks!
  20. Hah, that does help, doesn't it? What I'm still wondering is if I can get the IDs of the newly inserted values without having to use a select statement to find them again. As in can I avoid having to use a statement like the following:SELECT ID FROM 'Clients' WHERE Name='name' AND site='site' OR Name='name2' AND site='site2' (and so on...) Is it possible for me to use NEW here, as in a much easier statement like this one: select ID from NEW
  21. Hi Guys,I'm writing a PHP function that inserts multiple values into a MySQL database, and then creates a new entry in a different table that references the freshly inserted values. I can't remember how to do this, however. My insert statement looks something like this: INSERT INTO Clients VALUES(0, 'name','site'), VALUES(0, 'name2', 'site2'), VALUES ('name3', 'site3'); Should I break the queries into individual inserts and then create the reference using New.ID or is there a better way? Thanks in advance!-Sean
  22. The second page in the article deals with some client-side stuff, you probably just missed that part. It was very helpful though, thanks
  23. The article you mentioned used client-side scripting...I suppose there's no way around that if I want the password encrypted before it even hits the server, lol. It's just a possibility I've been considering. I also like the idea of using a timestamp as a salt and then checking to make sure no more than x seconds have elapsed, but that might be complex as well. Thanks for the help though -Sean
  24. Ok, I took a look at the article and decided to use a method similar to this one to encrypt the password client-side: function hash_password(){var username = document.getElementByID('username');var password = document.getElementByID('password');var securePass = md5(password.value+username.value);document.getElementById('password').value = securePass;} Calling this function on submit should encrypt the password with a salt unique to each user before sending it to the server. But this raises another problem - since the javascript password encryption is client-side, can't a potential attacker instantly gain the salt just by viewing the login page's source code?
  25. ThePsion5

    SQL or PHP?

    There should be a PHP function to output any SQL errors for the database you're using, try looking that up at php.net.
×
×
  • Create New...