Jump to content

dalecosp

Members
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by dalecosp

  1. Well, if you're planning to paginate, you probably shouldn't be calling "echo" on the data; create an array to hold it and push it though a loop (or use a template). That said, how much data are we talking about? If you're really using multiple pages (that is, a new page load for each page), wouldn't it be preferable to have your data resource only return enough data to create one page, and then get the data for the next page on the next page load? Or are we talking about AJAX-type paging here?
  2. Incidentally, mysql_* is deprecated; you might get a little better performance from mysqli_* or PDO, but I'm not sure about that....
  3. Start here: $upit11 = mysql_query("SELECT id FROM kalkulacija_stavke WHERE id_kalkulacija = '$id_kalkulacije' AND kataloski_broj NOT LIKE '1%'") or die (mysql_error()); //select every ID ... $brojcanik = mysql_num_rows($upit11); // but only use this query for a count? //This would be preferable, I think: $upit11 = mysql_query("SELECT count(id) FROM kalkulacija_stavke WHERE id_kalkulacija = '$id_kalkulacije' AND kataloski_broj NOT LIKE '1%'") or die (mysql_error()); //select every ID ... $brojcanik = mysql_result($upit11,0);
  4. Isn't that because you asked it to? $sql = mysql_query("select * from $demo") or die (mysql_error()); Perhaps I don't understand the issue. Incidentally, isn't "XMLHttpRequest" only available in FireFox and Chrome? Are you not supporting MS browsers?
  5. But if you don't use JS, you're requiring a page reload for each video....
  6. It happens to everyone at some point or another. Get some sleep before coding whenever possible! ;-)
  7. Hmm, it was either that, or the other problem: you fed a string instead of an object to appendChild. This seems to work OK: <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script> function myFunct () { //a function; we'll call it once the DOM loads. 'use strict'; var list, myNewElement; list = document.getElementById("list_items"); myNewElement = document.createElement("li"); myNewElement.innerHTML = "This is some new text"; list.appendChild(myNewElement); // not "myNewElement", which is a string, but the obj/var itself } </script> </head> <body onload="javascript:myFunct();"> <ul id="list_items"> <li>Test 1 </li> </ul> </body> </html>
  8. I *think* the problem is that the script is executing before the DOM is loaded, and therefore "list" is null. I'll take a look at a new snippet.
  9. Sounds like AJAX, not rocket science. What do you have so far? Javascript works in the DOM, and you're showing no code.
  10. When an insert fails, I always log, mail, or print the SQL query --- it's the best way to debug it (assuming, of course, you speak SQL, and you should, if you intend to program it).
  11. http://en.wikipedia.org/wiki/Web_crawler#Open-source_crawlers But, really, you made a search engine but no spider? I should think the spider is the main thing! (Maybe I should go read the "History of Google" again...)
  12. Incidentally, this is Javascript, which is NOT Java. Search Youtube for Douglas Crockford and spend about 3 hours on his tutorial series from Yahoo! It will help a lot.
  13. You spelled "console" wrong --- and "consloe" isn't defined.
  14. 1. Check server logs. 2. Does a simple mail script work from the host? $to = "me@mydomain.com"; $subj="Simple Test"; $msg = "This is a test, this is *only* a test. If this was actually working, I wouldn't have to send this!"; mail($to,$subj,$msg);
  15. That's a great start, AaronClifford! Kudos to you for helping. Only observation I would make is that server log files are often very, very large, and you can create a very large memory structure and load your box's RAM if you keep all that data in an array. Unless it's critical to have all the bandwidth values in an array, I'd just create a var to hold the total and add the value for each line to said var on each iteration of the loop. One var will not take up near as much RAM (and array_sum might use a heckuva lotta CPU, too, on a big array).
  16. If you have access to php.ini, you can set something like: error_log = /some/path/you/can/read/php_error_log and get only PHP errors written here.
  17. I'd second that. If you're looking for services, PayPal would love to handle it, Amazon.com has Amazon Payments; a standard setup is a provider like Authorize.net and a merchant account at your local bank.
  18. Given that it's confusing to the reader and could do type coercion (one of Crockford's No-No's), I suggest not using it. If you want to "return TRUE;" you should "return TRUE;" ... right?
  19. Have you considered simply using uniqid()? $track_number = uniqid("myprefix",TRUE); //will give you "myprefix" plus 23 characters to make this number unique. Set FALSE to cut it by 10 characters.
  20. Looks like it's just some sort of POST field validator: //create an array $required_fields = array('menu_name', 'position', 'visible'); //loop through it; it appears we'll be checking to see what was POSTed from a web form. foreach($required_fields as $fieldname) { //if the field is not set in POST, or the field is set but empty and non-zero ... I *think*. This line actually looks rather suspicious. if(!isset($_POST[$fieldname]) || empty($_POST[$fieldname]) && ($_POST[$fieldname] != 0)){ $error[] = $fieldname; //there's an error, so we're recording which field it was in } }//end foreach loop if(!empty($error)){ // we have something in the $error array, so we'll redirect? redirect_to("new_subject.php"); // this must be a custom function, as no such call exists in PHP AFAIK. } //Now it appears we'll do the same thing, just checking one field, "menu_name" and making sure it's less than 30 characters. //Field Length $fields_with_lengths = array('menu_name' => 30); foreach($fields_with_lengths as $fieldname => $maxlength){ if(strlen(trim(mysql_prep($_POST[$fieldname]))) > $maxlength){ $error[] = $fieldname; } }
  21. Very nice. So, um ... you have code that does this?
  22. Argh! We've got an issue here. Dunno why I didn't see this before ... are you using "$result" for the DB resource, and "$result" for the result of the ping command as well? Try changing the one in the ping command to "$pingresult" or something like that, and see if we have a better, um, "result" ...
  23. Not really. Perhaps corrupt/unexpected input? That's often why something that has been working quits (if you haven't made changes) --- because you forgot to account for some edge case/funky character input.
  24. This means that $login is not a valid database resource, your query on line one isn't returning anything.
  25. That should display all of them. Can you put something like: $result = mysqli_query($con,"SELECT * FROM aps"); //doublecheck our result list size echo "Got ".$result->num_rows." access points from DB.";
×
×
  • 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.