-
Posts
471 -
Joined
-
Last visited
-
Days Won
8
Everything posted by dalecosp
-
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 replies
-
- json_decode
- file_get_contents
-
(and 2 more)
Tagged with:
-
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);
-
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?
-
Creating HTML5 Video Player - Loading in code snippets
dalecosp replied to Ricky55's topic in PHP Coding Help
But if you don't use JS, you're requiring a page reload for each video.... -
It happens to everyone at some point or another. Get some sleep before coding whenever possible! ;-)
-
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>
-
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.
-
Need to fire JS Link back with captured variable
dalecosp replied to n1concepts's topic in Javascript Help
Sounds like AJAX, not rocket science. What do you have so far? Javascript works in the DOM, and you're showing no code. -
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...)
- 2 replies
-
- crawler
- search engine
-
(and 2 more)
Tagged with:
-
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.
-
You spelled "console" wrong --- and "consloe" isn't defined.
-
unable to get debugging mailer to work within case.
dalecosp replied to Greywacke's topic in PHP Coding Help
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); -
Need help with web server log file data extraction
dalecosp replied to DanSgt's topic in PHP Coding Help
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). -
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.
-
Basic question on returning one of two values
dalecosp replied to Drongo_III's topic in Javascript Help
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? -
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.
-
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; } }
-
Very nice. So, um ... you have code that does this?
-
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" ...
-
[Help] warning:mysql_num_rows() expects parameter 1 to be resource
dalecosp replied to Adhe_Arie15's topic in PHP Coding Help
This means that $login is not a valid database resource, your query on line one isn't returning anything. -
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.";