Jump to content

Dan_Mason

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Everything posted by Dan_Mason

  1. Hello there! I have written this MySQL function: DROP FUNCTION IF EXISTS optimaldb.TBC; CREATE FUNCTION optimaldb.`TBC`(SectionID int(10), StartTime datetime) RETURNS datetime BEGIN DECLARE PrevTime datetime; SELECT EndTime FROM PassSection WHERE EndTime < StartTime ORDER BY SectionID LIMIT 1 INTO PrevTime; RETURN StartTime - PrevTime; END; Into which I pass 2 variables i.e: SELECT TBC(3451,'2010-04-01 06:03:12') This is the error that keeps getting thrown up: MySQL Database Error: Incorrect datetime value: '9188914574.000000' for column 'TBC' at row 1 I'm not entirely sure what I have done wrong as I have looked up this: http://dev.mysql.com/doc/refman/4.1/en/datetime.html and as far as I can see I am structuring the datetime correctly! Any help would be really handy! Thanks, Dan
  2. Hello! I am having an issue creating a view. To cut it short, I need to create a view from multiple tables in the same database. Some of these tables are formatted as dynamic tables i.e: Item_Name Item_Value Test1 1 Test2 2 Test3 3 And some are formatted as fixed tables i.e: Test1 Test2 Test3 1 2 3 Unfortunately I am not in control of how the database has been built and cannot (For the foreseeable future) change the construction of it. But in the mean time I am looking for a work around, that will allow me to create a fixed format view, that contains information from both types of table using multiple SELECT statements. I have read the documentation on the creation of a view and cannot seem to find any information specific to this topic! Any help on this would be greatly appreciated as I am currently stuck on this part of my project! Thanks very much for your time, Dan
  3. I am having trouble searching for an item in a multi-dimensional array. Is there a way to search only one column in a multi-dimensional array? i.e: MULTI-DIMENSIONAL ARRAY ID Name DataTable 0 John Employee 1 Dan Employee 2 Matt Boss 3 Becky Supervisor Is there a way to only search the column "Name"(Column 2) using array_search() or similar? (i.e array_search("John",$ARRAY[Column2]) The help would be very much appreciated! Cheers, Dan
  4. Hello I am having trouble retrieving an array in the format I need from a mysql database. It is a Matrix/Multidimensional Array, and should look like this: Array( Array(Date => 22/04/1989, Time =>02:00) Array(Date => 23/04/19...... etc For some reason it is coming back like this: Array( Array( Array(22/04/1989), Array(02:00) ) Array( Array(23/04/19...... etc This is the code that puts the mysql result in the array: <?php while ($aTemp[] = mysql_fetch_array($result, MYSQL_NUM)); ?> Any suggestions would be very useful! Thanks! Dan
  5. Okay, Let me re-phrase the question. Can you use an LEFT JOIN to retrieve a constant data set (As I've shown pretty clearly above) from a Dynamic Table in a MySQL Database? Thats pretty much all I want to know. Sorry for the inconvenience.
  6. Hello All! I am having trouble working this one out. I am retrieving a data set from a Database which I want to look like this: Column 1 Column 2 1 NULL 2 4 3 NULL 4 5 Instead it is being returned like this: Column 1 Column 2 1 4 2 5 3 [/td] 4 [td] As you can see, this would not be a constant data set, so when being put in an matrix, wrong data is matched. Bearing in mind I am also using Dynamic Tables (Item Name, Item Value) which are constantly being updated. I have tried using a LEFT JOIN Statement, but it does not work, I am still getting incorrectly matched data back from the query. Here is the query: $result = mysql_query=( "SELECT $TableName.SectionIdent, ItemValue * 3.2808 FROM $TableName INNER JOIN $TableName2 ON $TableName.SectionIdent=$TableName2.SectionIdent WHERE $TableName.SectionIdent IN( $strNumbers ) AND ItemName = $ItemName ORDER BY StartTime" ); Any Suggestions as to a certain JOIN Type that could be used? Cheers! Dan
  7. Hello I have used some Javascript to be able to switch between 3 generated graphs on a page. I wanted to do this so that the page didnt have to be refreshed every time a new graph was selected. All it is basically doing is switching between pictures, Here is a screenshot: All I really want to do is leave the last Hyperlink clicked highlighted, so that it is really obvious to the user which graph they are viewing! Any help would be much appreciated!
  8. Ah! You were right! I checked over the CSS File used, and The Div ID was the same as another! Cheers! Ill make sure i watch out for that in future!
  9. No not there, Obviously the onClick is Javascript but I didnt think that could affect positioning! Not sure whats going on....
  10. Hello! I am having a few problems with positioning in HTML, Not sure why this is happening, But 1 link is overlapping another link... Here is the code for the 2 links that are supposed to look like this: Absolute | Percentage. (Seperated with a |) <html> <div id="image1" style="display:none"> <img src="GaugeSummaryAbsoluteGraph.php" border="0" alt="one" /> </div> <div id="image2"> <img src="GaugeSummaryGraph.php" border="0" alt="two" /> </div> <a id="one" href="#" onclick="changeIt('image1');">Absolute</a> <a id="two" href="#" onclick="changeIt('image2');">Percentage</a> </html> The 2 Hyperlinks on the page look like this: Anyone any ideas? Cheers, Dan
  11. Okay, so this is the code i have so far (as an example): <script language="javascript" type="text/javascript"> function removeSpaces(string) { return string.split(' ').join(''); } </script> <form> <input type="text" onblur="this.value=removeSpaces(this.value);"> <input type="button" value="Click"> </form> As you can see, I am automatically removing spaces in the field. Now I know it would be obvious to most people but the majority of people using the login system I am designing are going to be pretty computer illiterate, So i need it to be obvious. I want to also have a warning pop-up box If spaces are found and removed saying "Spaces cannot be used in Usernames, spaces have been removed." Can anyone help? Thanks in advance
  12. DELETE Record problem Here is the Query: DELETE FROM login WHERE 'Email' = "Hello@Example.com" It is not throwing up any errors, as all the information in the database matches the query but when I run it in the SQL Editor, it says "Query OK, 0 rows affected (0.00 sec)". This also happens when I run the query in my PHP Code. (It definately is not removing the record from the database) Any Ideas what I could do? Any help would be very appreciated
  13. Hello Having trouble here, Is there a function available to check the PC's locale? returning something like U.K or U.S or Europe, etc. Thanks In Advance
  14. Hello again I need to direct a page somewhere else depending on the last page the client was on, Is there any function that can do this? This is the general idea of what i want: <?php if (PreviousPage = 'http://something'): header(Location:'http://somewhere') else (PreviousPage = 'http://something_else'): header(Location:'http://somewhere_else') endif; ?> Cheers for any help
  15. I know everyone hates frames, and they are annoying and crap etcetc, but i started using them for the first release of a site, so im going to continue using them for the time being. Anyway, i am having trouble arranging the page like this: Can anyone help? Thanks
  16. Cheers man, but still having a problem. i am getting just the number 1 outputted to the screen. I think i have changed all of the appropriate parts to fit my system :S <?php define( '_CMS_PATH_ROOT_', dirname( dirname( __FILE__ ) ), true ); function cmsAutoLoad( $pClassName ) { if( strpos( $pClassName, 'cCms' ) === 0 ) { require_once _CMS_PATH_ROOT_ . '/AppLib/'.$pClassName.'MPDSData.php'; } } //Register cmsAutoLoad as an autoloader, in order to prevent clashes with other autoloaders (as opposed to the magic method __autoload) echo spl_autoload_register("cmsAutoLoad"); ?> Is there anything still in there that is specific to you system??
  17. Hello again! Back with another annoying problem! ??? I am trying to re-arrange my Root Directory in my Web-server so that I can access files easily and know where they are. Here is the Layout of my Directory: Report-->AppLib -->CSS -->Documents -->Images -->Graph -->Javascript -->Main Etc etc, You get the idea. There are appropriate files in each folder so that they are easily accessed. The problem i am having is linking the files together. I need the path for include's to be variable, as when I take this on-site (It is a local network based Report System), it will be placed under a different directory to the one i am testing it in now. Eg Instead of <?php Include 'C:\\Program Files\\Apache\\htdocs\\Report\\AppLib\\'; ?> I need <?php Include $FilePath . 'Applib\\'; ?> I have tried using These functions so far: <?php //Function to Return Server name function get_server() { $protocol = 'http'; if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') { $protocol = 'https'; } $host = $_SERVER['HTTP_HOST']; $baseUrl = $protocol . '://' . $host; if (substr($baseUrl, -1)=='/') { $baseUrl = substr($baseUrl, 0, strlen($baseUrl)-1); } return $baseUrl . '/'; } ?> That is for linking HTML files to eachother, as instead of a file path, a URL is required instead <?php //Start Session session_start(); define('INCLUDE_PATH',dirname(__FILE__)); $_SESSION['INCLUDE_PATH'] = INCLUDE_PATH; ?> The above piece of code is used for 'Include' and 'Require' filepath's but Niether of the 2 above codes seem to work! all i get on screen is ans HTTP 500 Server Error, and I cant fins whats wrong by De-bugging the code in Eclipse! One other question, Does anyone know of a better programming Environment than Eclipse, because i seem to be encountering alot of problems with it! Thanks in advance for any help
  18. Thankyou so much man! My Boss Is Especially Pleased With Me Now! Sorry about the misunderstanding, You know how it is, You know exactly what you want, but putting it across to someone who doesnt know what you want is quite difficult lol It all works peachy now anyway, so cheers
  19. Hello Again, Sorry, I'm not making myself completely clear (Quite new to this!). Here is a screenshot of the Report that is sent to the User. The "Export" button on this page is a link to the file with the fopen function in it. That file is the one Writing the .txt file. The .txt File Contains All of the Summary Data From the report shown above. What I would like to happen is that when the user clicks the "Export" Button, a "Save As" box appears, so that the user can specify Where to save the file. I hope this makes it more clear :S Thanks Anyway For Helping
  20. Well its basically A Report that The server generates for the client. Then each day when the report is sent to them (by Hyperlink), They click on the Download Summary Data Button To get the .txt file. Is there no way of being able to specify a directory from the client side?
  21. Help! I asked about this a while ago, but i didnt word it very well, as i wasnt sure exactly what i was looking for. Basically, I am using the fopen() function to write a .txt file, but i want the user to be able to specify the path that the file saves to. I need to do this as some of our clients are restricted and arent even allowed to save files on the C Drive of their Computers! (Paranoid Network Admin...) I wanted to do this using a File Browser within the Web browser, so that when the user selects the Directory needed, the path is written to the variable which is then passed into fopen(). <?php $filename = $DirectoryUserHasChosen //$filename = $FilePath; $somecontent = "Recorded Sections\tNumber Of Coils\etc\etc"; fopen($filename, 'w'); etc etc Rest of code ?> Any help would be much appreciated.
  22. hay Try Javscript http://www.dhtmlgoodies.com Theres a few New Window Open Scripts On There.
  23. Help! I asked this a while ago, but i didnt word it very well, as i wasnt sure exactly what i wanted . Basically, I am using the fopen() function to write a .txt file, but i want the user to be able to specify the path that the file saves to. I need to do this as some of our clients are restricted and arent even allowed to save files on the C Drive of their Computers! (Paranoid Network Admin...) I wanted to do this using a File Browser within the Web browser, so that when the user selects the Directory needed, the path is written to the variable which is then passed into fopen(). <?php $filename = $DirectoryUserHasChosen //$filename = $FilePath; $somecontent = "Recorded Sections\tNumber Of Coils\etc\etc"; fopen($filename, 'w'); etc etc Rest of code ?> Any help would be much appreciated.
  24. Maybe try this? <?php if (isset($intable)): print "".$intable." - <b>Matched To</b> - ".$tempsku.""; else: print "<b>No Match Found For:</b> ".$tempsku.""; ?> Im not 100% sure but i dont think you needed the Parenthesis around The Print statement.
  25. Hello Again, I have another problem with fopen() ??? What I want to happen basically is for The User to Click "Export Data" and a File browser box should appear with a default location and filename (i.e. 'C:\Documents and Settings\optimal\Desktop\Data.txt). So that if the user wishes to, they can change the Directory and filename. Basically whatever they change the Filepath to, I need it to be a variable Like this= $filepath = $UserDefinedFilepath Here is the Current code = <?php $filename = 'C:\Documents and Settings\optimal\Desktop\Data\ReportData ' . date('d-m-y') . '.txt'; $somecontent = $Something; fopen($filename, 'w'); // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo '<center>'; echo '<br />'; echo '<br />'; echo '<br />'; echo '<br />'; echo "Success, wrote Data to file ($filename)"; echo '<br />'; echo '<br />'; echo '<br />'; echo '<a href="Quad_Frame.php">Back</a>'; echo '</center>'; fclose($handle); } else { echo "The file $filename is not writable"; } ?> Any Ideas? They would be Most helpful Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.