Jump to content

Don E

Members
  • Posts

    996
  • Joined

  • Last visited

Everything posted by Don E

  1. Don E

    PHP Copy function

    Hello everyone, Does the copy function only take literal strings for parameters, and not variables that are strings? is there a way to copy a file where the path and name are stored in a variable?http://php.net/manual/en/function.copy.php Thanks.
  2. Don E

    multi arrays

    You were pretty close.. just add myArray.length; to the second for loop... instead of ("m"+i).length; <!DOCTYPE html><html><head> <title></title></head> <body><script>var m0 = [0, 1, 2, 3, 4];var m1 = [5, 6, 7, 8, 9];var m2 = [10, 11, 12, 13, 14];var m3 = [15, 16, 17, 18, 19]; var myArray = [m0, m1, m2, m3]; for (var i = 0; i < myArray.length; i++) { for (var j = 0; j < myArray[i].length; j++) { document.writeln(myArray[i][j]); }} </script></body></html>
  3. document.getElementsByTagName(); is used to get a specific HTML element like 'p' or 'div'; returns a collection of the specified tag name. There are no 'company' and 'name' html tags that I am aware of. There is a 'address' tag though. If you thought getElementsByTagName mean't getting an element when an elements name attribute is set to a specified name like <input type="text" name="address" />, then no, that's not what getElementsByTagName does. Maybe you were thinking of document.getElementsByName. http://www.w3schools...tsbytagname.asp http://www.w3schools...mentsbyname.asp JSG meant something like... var inputs = document.getElementsByTagName('input'); for(var i = 0; i < inputs.length; i++) { if(inputs[i].name == "address" && inputs[i].value == NULL) { alert("Please fill in Address field."); return false; } etc... }
  4. You can use the mysql_num_rows(); function to check if the query returns a row which in your query I believe should return 1 or none (0). For the if statement, you can have something like: $numRows = mysql_num_rows($res); if($numRows == 0) // for not answered image{ echo "<a href='a.php?no=$no∂=$part&qpid=$qpid&board=$board&subject=$subject&StudentId=$StudentId&totalrows=$totalRows1'><img src='img/not_answered.png'></a>";}
  5. Don E

    Java and Dr. Evil

    JSG, Would it be sufficient enough to disable the java plugins in our browsers?
  6. Trying putting the select query in quotes for the mysql_query function. ie: "SELECT article_content FROM articles"
  7. you can try <a href="javascript:self.close()">Close the window</a> but I dont think that works in most/all browsers.
  8. From what i understand, that function only works when you open a window with the window.open() function.
  9. Don't give up. It can work. Post the code that gave you the error above. There's a solution to the problem. Always!
  10. Looks like you're forgetting an extra equal sign here: if ($username = "trainee") To check for equality: if ($username == "trainee")
  11. Don E

    footer problem

    Try googling sticky footer.
  12. Don E

    SQL Injection

    Check out this link for some information on SQL Injection: http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php
  13. Try putting curly braces around the values like the following: : $sql="INSERT INTO discussions (name, desc, maker)VALUES({$_POST['namevalue']},{$_POST['descvalue']},{$id})";
  14. What exactly is the error display now?
  15. Still getting an error after you edited it?
  16. Everything looks alright. Are you sure you're not misspelling(not necessarilly misspelling, but thinking you mean desc but actually mean Desc for example) the column names in the query... for example... maybe you have Desc instead of desc for that column's name. Also not sure if it matters.. but try changing $_POST['desc'] to something else like $_POST['descrip'] in case MySQL is getting confused with desc as the column name and 'desc' in the $_POST. If you do that, don't forget to change the name attribute for desc input in the form to, for ie: <input type="text" name="descrip" />
  17. I see. Post the section in the code where this query takes place.
  18. Check my edited post above with revised query to try. See if that works.
  19. What does the error message display? Same thing? Try: $sql="INSERT INTO discussions (name, desc, maker)VALUES('". $_POST['name'] . "', '" . $_POST['desc'] . "', $id)";
  20. For VALUES, try: ($_POST['name'], $_POST['desc'], $id)
  21. Don E

    Header issue

    Have you tried giving the header margin: 0 and/or padding: 0 to the areas you want to have no spacing?
  22. Here's the light switch in action so to speak. Maybe you can get an idea and then apply the concept to the box to grow and ungrow with onclick. <!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Switch</title><script type="text/javascript">var lightOn = true; function switchOnOff() { if(lightOn) { document.getElementById('lightBulb').style.backgroundColor = "yellow"; // box grows document.getElementById('lightBulb').innerHTML = "On"; lightOn = false; // set to false because the next click of the mouse is wanting to turn off the light } else { document.getElementById('lightBulb').style.backgroundColor = "white"; // box ungrows document.getElementById('lightBulb').innerHTML = "Off"; lightOn = true; // set to true because the next click of the mouse is wanting to turn on the light } } </script><style type="text/css"> #lightBulb { border: 1px solid black; width: 500px; height: 500px; margin: 0 auto; }</style> </head> <body> <div id="lightBulb" onClick="switchOnOff();">Click to turn off/on.</div></body></html>
  23. Glad you got it working.
  24. The reason why the 0 in quotation marks works is because you're basically saying: if the string 'taco' is not equal to the string '0', which turns out to be true because they are not equal strings. If you're looking to check if a variable contains a value in an if statement, you can do something like the following: $thing = "taco"; if (($thing != NULL) && ($thing != "")){ echo "Hello";} or... $thing = "taco"; if (($thing != FALSE) && ($thing != "")){ echo "Hello";} or.. $thing = "taco"; if (($thing !== 0) && ($thing != "")) // True if they are not of same type which they aren't, $thing is string, 0 is integer.{ echo "Hello";} or with the empty() function.. $thing = "taco"; if ((!empty($thing)) && ($thing != "")) { echo "Hello";}
  25. I just noticed for the onclick attributes, you have toggleInfo() instead of toggleNav(). The function is toggleNav().
×
×
  • Create New...