Jump to content

leachus2002

Members
  • Posts

    96
  • Joined

  • Last visited

    Never

Everything posted by leachus2002

  1. Hi There, I have been reading a tutorial on a website that shows people how to upload files into a MYSQL server - which seems to work perfectly. ** Code Extract ** if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } However, the problem I am faced with is that I would like to use MSSQL as the server to upload to, and I understand that the ADDSLASHES command will not work with MSSQL? I have tried using a combination of ADDSLASHES and str_replace commands, to escape the single quotes - but to no avail I am afraid. Can anyone help by helping me to modify the code above to allow me to upload to my MSSQL DB? Thanks in advance Matt
  2. How easy do you think it might be to incorporate this list: http://jqueryui.com/demos/sortable/#connect-lists with the first link? Thanks Matt
  3. Yes they are - it would just be a case of updating the employee_id field of the table
  4. Hi, Yep - for example, a list would be a queue of work for a member of staff - and I would like to drag from 1 member of staff to another. Cheers Matt
  5. Hi Everyone. I have been looking at this website http://www.webresourcesdepot.com/dynamic-dragn-drop-with-jquery-and-php/ which shows an excellent example of using JQuery and PHP to create, and edit an ordered list. This is great for changing the order of a list - however, I would like to be able to move between several lists - and update a variable called "list_id". Does anyone know if this can be done, and if so, are there any tutorials out there to do this? Thanks Matt
  6. Hey All, Have been looking into this for a week or so now without any luck - any ideas out there? Thanks Matt
  7. Hi Everyone, I have a training package that was developed by one of our departments, and I want to intregrate PHP into it so that it can post results of an exam to a DB. Basically, the way that it get's the score to the screen currently is to store the "score" value into a JS variable, and send it to screen using a <DIV ID='Score'> tag. Is there any way that I can extract the information out of that DIV tag into a PHP variable with just the score? I have tried: $score = '<div id="score"></div>' However, this brings the whole tag into the DB. Help is appreciated Thanks Matt
  8. Hi All, Are there any decent PHP graph solutions out there? I have an SQL statement that returns 12 numberical values in an array (mssql_fetch_array). I would like to plot these values on a graph. Thanks Matt
  9. Hi Ken, That's great, just what I need - however it is giving me the next 5 weeks, rather than the last 5 - is that easy to change? Thanks Matt
  10. Hi Both, Thanks for coming back to me! The complication is that my select box if built using an SQL statement. Like the following: while ($rowvalues=mssql_fetch_array($getnames)){ $name = $rowvalues['forename']; $options.="<option value=\"$name\">.$name."</option>"; }
  11. Hi There, Is there any way that I can get a select box to auto-select the value from a SQL query? For example, if I have a select box like this: Dave,Jon,Simon,Fred And a select statement that brings back the value of Fred then the select box (in HTML) would: <select name='people'><option>Dave</option><option>Jon</option><option>Simon</option><option selected='selected'>Fred</option></select> Same as if the name was Dave, or Simon etc etc. Hope that makes sense? Cheers Matt
  12. Hi Ken, I am not sure where to start - I am happy with dates and all, but not sure how to get just Monday dates etc etc. Cheers Matt
  13. Hi There, I am trying to create a table, and accross the top I would like the Week Commencing Dates of the last 5 weeks. So for example: <table> <tr><td>07/02</td><td>31/01</td><td>24/01</td><td>17/01</td><td>10/01</td></tr> </table> Can anyone help? Cheers Matt
  14. Hi Neil, I would like it to warn at less than 5 days until required_date, and also when the required date has passed. This is how I am using your code: <?php // the number of days from todays date we will add to our range $numdays = 5; $days = array(date('d/m/Y')); for($x = 1; $x <= $numdays; $x++) { $days[] = date('d/m/Y', strtotime('+'.$x.' days')); }// the date value to test $totest = '31/01/2011'; if(in_array($totest, $days)) { $result = '<img src="error.png"/>'; }else { $result = ''}?>
  15. Hi Neil, I have re-coded using your code, and it is working fine - I can see what you mean with the previous code that I used, it was highlighting more than I needed! Is there any way with your code that it can also highlight passed (previous) dates? Thanks Matt
  16. Hi doddsey_65 I like this method, however it is not "echoing" correctly, I believe - let me show my code: while ($unassigned = mssql_fetch_assoc ($unassigned_tickets)){ $pull_date = $unassigned['required_date']; $req_date = $pull_date; $req_date = strtotime($req_date); $req_date >= strtotime('-5 DAYS') ? $result='Yes' : $result='No'; echo '<tr><td>$result</td></tr>'; Cheers Matt
  17. Hi All, I have an SQL query that returns a date (31/01/2011 - for example) and this get's placed into a variable - $req_date. I want to be able to display an image when the required date is within 5 days of the current date. Normally in an if statement I would use: <?php if ($ticket_no == 100) { echo "This is ticket 100" } else { echo "This is not ticket 100" ?> However I am struggling to work out the difference between the 2 dates. Any ideas? Cheers Matt
  18. Hi There, I would like to place the last for month names into an variable- for example: February 2011 January 2011 December 2010 November 2010 But I would like them to all have the same variable ($date) - so when I use it in a mssql_fetch_assoc - it increments with every instance of $date, as there will be one instance of $date for every row returned, getting older with every row. Hope that is enough info? Cheers Matt
  19. Hi All, I am trying to "echo" a result from a SQL query, that returns a size in KB, but I want this to read in MB or GB - can PHP change this for me, or is it something I need to do in SQL? Cheers Matt
  20. Hi All, I want to place a graph on my website that will show total's from a SQL query. For example, I will run: $date1 - select count(*) from table where daterange between 01/01/2011 and 30/01/2011 $date2 - select count(*) from table where daterange between 01/12/2010 and 30/12/2010 etc etc..... This will return a number which I want to plot on a graph. Can anyone recommend a good script out there that will do this? I have had a look around, and most seam over-complicated for what I require. Thanks Matt
  21. Hi There, I want to be able to populate 2 variables, $previousmon and $previousfri with 2 dates, being the previous Monday and the previous Friday to the week you are on. So for example, if it is Monday 31st Jan, then $previousfri would be 28/01/2011 and $previousmon would be 24/01/2011. Is this easy enough to do? Cheers Matt
  22. Hi All, I currently have a ticketqueue that show's all tickets assigned to a group of people, but split into personal queues, but the way that I wrote it, means that it needs manually updating if a specific person leaves/joins the department. For example, to get the queue details, I use the following query: $username1 = mssql_query("select id,subject,body,priority from queue where assignedto = username1" $username2 = mssql_query("select id,subject,body,priority from queue where assignedto = username2" I have repeated this code for all of the users in our team. Which seams a waste, as I have all the information on our team stored in a DB called "sysadminusers". Is there an array I could use that would look at all the usernames in the table, and then repeat the query for me? I would also need this array to display the results on the page, currently I use the following: while($username1_tickets = mssql_fetch_assoc($username1)){ echo $username1_tickets['id'],$username1_tickets['subject']$username1_tickets['body'],$username1_tickets['priority'];} while($username2_tickets = mssql_fetch_assoc($username2)){ echo $username2_tickets['id'],$username2_tickets['subject']$username2_tickets['body'],$username2_tickets['priority'];} I am just looking for some design advice and code examples that would help me tidy up my code for this page, it seams a lot of code for quite a simple page. Thanks Matt
  23. Dragon, Awesome! - worked a treat However, I have 1 more question - if I search for "Text" then it will highlight "Text", but not "text". Can this be done? Cheers Matt
×
×
  • 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.