Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. I am not familiar with the way linux file permissions work, but it seems to me that it prepends its permission number with a 0. IE 0777 is the same as 777. Beyond this echo, has anything else happened that would lead you to believe that the file permissions are different from what you expect them to be
  2. Well i'm kind of confused on how exactly you want to match strings. What criteria does the string "RES STRUCTURE FIRE" have that qualifies it as an alarm type. what are some other examples of strings that would match for alarm type. Can you please explain the criteria you need to use for matching strings. That way we can be of much more help. Also, the matched strings go into the $matched array. From the manual Hope this helps
  3. ahh I see. Yeah i don't know how I missed that. You have error reporting turned on correct? Perhaps there is some error not being displayed that is stopping that constant from being defined. you could also used the defined() function that check if it is indeed defined. However, why don't you try putting the string directly into the argument to the move_uploaded_file() function instead of using the constant, and see if that works
  4. Seems alright to me... Have you tried it out?
  5. those are notices not errors. However, they indicate a lack of knowledge on certain concepts. "Undefined Index" notices, For array keys, you should always surround them with single quotes. for example //instead of $array[key]; //it should be $array['key']; undefined key errors basically mean the array is not defined on that key. I'm not sure why you are using those keys, or what you expect them to be, so im not sure how to help you there your problem is probably with the second notice. You are using (or trying to) a constant named UPLOAD_DIR. this Constant doesn't exist. You are going to have to define it, or include a script to define it. Otherwise, you are trying to move the image into the directory named "UPLOAD_DIR" which probably doesn't exist
  6. as a side note, creating your own function is kind of pointless. Why not just use substr directly?
  7. try commenting out certain lines so you can narrow down what is hanging your script up. You can also increase the max execution time setting in your php.ini
  8. are you sure the image is being moved correctly. Try moving the move_uploaded_file() function into an if statement to see that it is indeed being uploaded correctly. like so: if (move_uploaded_file($_FILES['image']['tmp_name'], UPLOAD_DIR.$_FILES['image']['name'])){ echo "File uploaded correctly"; else { echo "file upload failed"; }
  9. Well in order for PHP to do it, you would need a form submit, which ultimately leads to a page refresh/reload. I was under the impression that OP wanted to do this without a page refresh, in which case you would need javascript. Also, yes, w3 schools has some outdated information, but its a good resource for beginner level tutorials and reading. If he wants to do his own research he is free to, but that is the link I gave. He can do with it what he will
  10. So what happens exactly? Is an entry entered into the database? Blank page? Nothing happening
  11. that... doesn't make any sense.. where did that come from
  12. Firstly, when posting code, please only post the relevant code. No one wants to read through lines and lines of code just to FIND what you are talking about. Now, selecting something from a DB is rather eas. As I would hope you already know, simply use a select statement to grab all the information you need. For example $sql = "SELECT * FROM mytable WHERE some condition"; $res = mysql_query($sql); $row = mysql_fetch_array($res); now we can use this $row variable to populate our option box. To do this, we can use a foreach loop to create as many options as we need. for example, assuming we did the code above to grab the db row and store it into the array $row, we can echo "<select ... whatever attributes you want>"; foreach($row as $key=>$value){//i use $key=>$value syntax just incase you need the key for some reason echo "<option attributes here... value='$value'>$value</option>"; }//end foreach that should get you started. Hope that helps
  13. why dont you try posting the code so we can take a look
  14. I see. glad your problem was solved. Please click the topic solved button at the bottom of the thread to mark this topic as solved
  15. No problem. Remember, if your topic is solved, you can click the "topic solved" button at the bottom of the thread
  16. For the first problem, you don't need AJAX. simple Javascript will suffice, though, if you are comfortable with Jquery, or would like to learn it, Jquery is the way I would do it. It is cross-browser compatible (as all the different ways browsers interpret javascript, especially DOM functionality is behind the scenes in Jquery), and makes development of DOM altering features alot easier and quicker. if you are interested in Jquery, try this tutorial: http://www.w3schools.com/jquery/default.asp If you simply want a javascript solution, try a google search for altering the HTML DOM with javascript. Also, if you are unfamiliar with javascript in general, I would google for few javascript tutorials, and read about how it works, because using Jquery without a solid understanding of javascript is a recipe for disaster But this isn't quite the correct forum to go over this, so you may have more luck asking about this in the javascript help forum
  17. The only problem with this script, is it could lead to a crash of your server depending on how many users he has. For example, if OP has 1000 users, someone may try to join, in the worse case scenario, the user could be very unlucky, and need to refresh the page 1000 times before he gets a unique number. Yes, this is very unlikely, but if it can happen, it will happen, and you need to always consider the worse case scenario. Consider what will happen if multiple users try to sign up in a short time frame. Basically, the larger the audience that this script has, the longer on average it will take to run, and the more chance for a server crash, or an overload of bandwidth. If OP is not planning on having a large amount of users for his script, it may be OK, but if he plans on having a larger amount of users, this may not be the optimal solution. Now, another way you could go about doing this is to generate a table with all the possible unique values and a column that tells you whether that number has been used or not. For you, you could have a table with the numbers 10000000-999999999999 (8 - 12 digit numbers). Assuming you have this table, you could then do something like //get 1 unused unique key $sql = "SELECT number FROM uniqueIDS WHERE used=false ORDER BY rand() LIMIT 1"; $res = mysql_query($sql); $row = mysql_fetch_array($res); $id = $row['number']; //now we can use $id however we want, and its a unique randomized number from 8-12 digits long Hope this helps
  18. what line are you getting this error on?
  19. Oh hey I remember you. Anyways, you are going to do something similar to what you already have. In MySQL queries, you can select multiple things at once. So you don't even have to do another query, but modify your existing one to get the other information you need. For example //your original query whtat just gets ApplicationStatus $sql="SELECT ApplicationStatus FROM table1 WHERE uname='$uname'"; //now if we want the column with date information in it, we just select it also by adding it after ApplicationStatus, in a comma seperate list. //so for example, if the column you are after is named DateInfo, we do $sql="SELECT ApplicationStatus, DateInfo FROM table1 WHERE uname='$uname'"; once you have selected it, its just a matter of displaying it wherever you need using the $row array and echo. So for example, if you simply wanted to display it after your select input ... $row = mysql_fetch_array($result);} echo '<form name="test" method="post"> <select name="ApplicationStatus"> <option value="">------</option> <option value="In process" '.(($row['column1']=='In process')?'selected="selected"':'').'>In process</option> <option value="Withdrawn" '.(($row['column1']=='Withdrawn')?'selected="selected"':'').'>Withdrawn</option> </select>'; echo "Date Information : {$row['DateInfo']}";
  20. Well That code doesn't really show us much. We don't know how your database is structered, so giving a definite answer is somewhat impossible, but theoretically you could go about solving your problem using something similar to what you posted
  21. Ok well if you want someone to give you the code, there is a freelance forum for that as I said. Asking someone for a full script for free on an all volunteer forum isn't going to get you very far. Also, if your problem is fixed, there is a thread resolved button at the bottom of the thread
  22. Theres a few things wrong with that idea. Firstly, depending on how you run that script, it could take a very long time if you have a lot of users. Secondly, look into the unique key construct that mysql supports. A little more information would be good. How long are the numbers gonna be? can they be any length? Why do they have to be random? Would an auto incremented primary key suffice?
  23. Are you talking about the visual text box, or the guide setup box. Assuming you are talking about the textbox, there are quite a few different ones you can download. some for free. They are known as WYSIWYG text editors. A google search for this term will yield quite a few results. you can check out this page which has a list of the top 10 best (in that sites opinion) WYSIWYG text editors. hope this helps
  24. Oh sorry I must have missread your post. Firstly, in order to access session variables, you simply use the $_SESSION super global array. Kind of like what you did, but don't use it as a key to the $_POST array, just use it by itself. So $var6 = $_SESSION["empId"] will assign the value of the session variable "empId" to the variable $var6. This, however, is assuming that you are indeed setting this session somewhere in your website. Make sure to read up on sessions (that is a link to the w3schools.com tutorial on sessions. It has some older information but it is still mostly valid and useful). You also need to use the session_start() function in order to access sessions on your webpage. However, if you are using sessions, you should already know this hope this helps
  25. Very awesome. You should include a way to see all the tweets. Perhaps simply showing the last 5-10-20 posts from the twitter feed. Maybe allow for filtering of the feed by subject, tags, whatever. Very cool idea though. Wish I thought of it . Some sort of Facebook integration would also be quite cool.
×
×
  • 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.