Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. $_SERVER["QUERY_STRING"] If you look hard at $_GET you'll see it has $_GET["AB32123"] = "" but don't try to use that.
  2. I see a 5.5.1 in the downloads page so yes, there is a version there you can upgrade to. But you know you don't have to upgrade at all, right? By the way, unless you're ready to spend the time testing your website in 5.5 and know that you'll be able to host it in a place that supports 5.5, stick with 5.3 or 5.4 for now.
  3. ... 5.3.19 > 5.3.7
  4. mysqli_connect_error Your username or password is wrong. I can say that outright because you should NEVER connect to your database as root. Make a new user just for your PHP scripts.
  5. Try a different collation.
  6. There's a fairly standard way of doing this de-duplication process when the "key" is a simple value (like a string URL). 1. Start with an empty array for the de-duplicated data 2. Loop through the source array 3. If isset($deduplicated_array[$unique_key_value]) then "merge" the new value into the existing value. In your case that's adding to the [2]. 4. If not set then add it with $deduplicated_array[$unique_key_value] = $original_source_data. In your case you end up with an array array( "http://www.yolosheriffs.com/" => array( 0 => "Yolo County Sheriff's Home 2008faroo", 1 => "http://www.yolosheriffs.com/", 2 => 86 ), "http://en.wikipedia.org/wiki/Fremont,_Yo" => array( 0 => "Fremont, Yolo County, California - Wikipedia, the free encyclopediafaroo", 1 => "http://en.wikipedia.org/wiki/Fremont,_Yo", 2 => 11 ), "http://www.youtube.com/watch?feature=pla" => array( 0 => "The Lonely Island - YOLO (feat. Adam Levine & Kendrick Lamar) - YouTubefaroo", 1 => "http://www.youtube.com/watch?feature=pla", 2 => 45 ) )
  7. Do you have a specific question?
  8. Can't get it to work because... you get a white screen of death? if(!confirmed_logged_in() ()) {Or because of a different reason? We're not psychic: you have to tell us these things.
  9. Those four lines I showed? That's the part that needs replacing, but after doing that the code can be cleaned up a bit. Skipping the steps of replacing in the preg_split() stuff I have and doing the cleaning, here's the end result: <?php $csvLines = preg_split('/\r\n?|\n/', $_POST["text"]); foreach ($csvLines as $csvLine) { $csvLine = str_getcsv($csvLine); // same echos as before echo "Header 1: $csvLine[0] <br />"; echo "Header 2: $csvLine[1] <br />"; echo "Header 3: $csvLine[2] <br />"; echo "Header 4 - $csvLine[3] <br />"; echo "Header 5: $csvLine[4] <br />"; echo "Header 6: $csvLine[5] <br />"; echo "Header 7: $csvLine[6] <br />"; echo "Header 8: $csvLine[7] <br />"; echo "Header 9: $csvLine[8] <br />"; echo "Header 10: $csvLine[9] <br />"; echo "<hr />"; } ?>
  10. $csvNumColumns = 10; $csvDelim = ","; $csvData = $_POST["text"]; $data = array_chunk(str_getcsv($csvData, $csvDelim), $csvNumColumns); I guess you got that from this user comment on the manual page for str_getcsv? Guess what: it's wrong. I'm posting a comment there right now: Consider the following: <?php $input = "r1f1,r1f2,r1f3,r1f4 r2f1,r2f2,r2f3,r2f4 r3f1,r3f2,r3f3,r3f4 r4f1,r4f2,r4f3,r4f4"; print_r(array_chunk(str_getcsv($input), 4)); ?>will output the (paraphrased) array array( 0 => array(r1f1, r1f2, r1f3, r1f4\nr2f1), 1 => array(r2f2, r2f3, r2f4\nr3f1, r3f2), 2 => array(r3f3, r3f4\nr4f1, r4f2, r4f3), 3 => array(r4f4) )which is totally wrong. You MUST split the input into lines. str_getcsv() operates assuming the input is a single line and will thus consider newlines to be part of a value. <?php $input = "r1f1,r1f2,r1f3,r1f4 r2f1,r2f2,r2f3,r2f4 r3f1,r3f2,r3f3,r3f4 r4f1,r4f2,r4f3,r4f4"; $csv = array(); foreach (preg_split('/\r\n?|\n/', $input) as $line) { $csv[] = str_getcsv($line); } ?>
  11. Either usort and you write a function that can compare two of those arrays to determine which comes first, function goggles($a, $b) { if ($a["rank"] != $b["rank"]) { return $a["rank"] - $b["rank"]; } else { // same rank so use something else to break the tie } } usort($google, "goggles");or array_multisort and you create a separate 1D array containing just the values you want to sort by. // as if $goggles = array($google[0]["rank"], $google[1]["rank"], $google[2]["rank"], ...) array_multisort($google, $goggles);
  12. 99% of the time that error message means your query failed due to a syntax error. Since you haven't shown where most of the important variables are given values, something that we would have seen if you had posted all of your code rather than just those few lines you thought were relevant, what is the exact value of $query?
  13. $i += 1; $text[$i] = $row[$i];There is only one column in the results. You shouldn't need $i at all, let alone be changing it over time. $text[] = $row[0];You should also initialize $text = array(); before the loop, since it's undefined when you're trying to append to it (as [] does).
  14. Are you sure you're not getting a "failed to open stream" error with require()? Because you should be getting at least one and that will kill your script. Have you tried even the most basic of debugging techniques: printing stuff out and seeing what's happening? Because you're in a much better position to do that then we are, given that it's your code we're trying to help you with.
  15. Besides, how is anyone supposed to write code for it when we don't even know what the input is?
  16. As I posted in the other thread you created for this exact same problem, which I've deleted because I don't want anyone else to make the same mistake of replying to one thread telling you to post code and then coming over here to discover it's the same question but this time with code, Turns out it was the "right path to it". The path to the file is not "/public_html/cert/*" because I doubt you have a public_html directory at the root of your drive. Next I would tell you what path to use except there's a problem: those files are web-accessible. That's horribly bad. Move them somewhere else not in or under the public_html directory. Then figure out what their actual paths are (spoiler: probably starts with something like "/home/andy1212") and substitute those into your code.
  17. It's great that you can read what's in the packet but that doesn't really help with the code much. What's the exact value of $data? As in according to print_r() or var_dump().
  18. Nope. What have you discovered in the last 24 hours? If you want to actually built the TCP/IP packets yourself then sure, go ahead and climb that mountain. But the rest of us don't mind letting PHP and our operating system do that work for us. Or to be more blunt, are you saying file_get_contents($request_url)does not work?
  19. Oh, I didn't know "this loop is not standard" meant "I understand that a loop is the standard solution". foreach (best option) for while do/while
  20. The code in your post that shows what you're talking about.
  21. Not really. Things like name and address fields should use the common names so that the browser (which is what's showing you the past inputs) can accurately judge whether, in fact, to display name and address information you've used in the past. They're also fairly good at recognizing generic fields like "username" and "email" and not showing every single username or every single email you've entered on other sites. If you want to completely disable the autocomplete on common fields and force the users to retype information that they may have used elsewhere, and want to use on your form, then use the HTML 5 autocomplete attribute: Or for the entire form,
  22. Don't use utf8_bin as the collation. Binary collations mean strings have to match exactly. Try utf8_general_ci. Unicode Character Sets
  23. Your code is rather difficult to read, indentation being one of the main problems, but I do see echo 'URL: '.$r_set[$echo_l]['url'].'<br>'; echo 'URL TITLE: '.$r_set[$echo_l]['url_title'].'<br>'; echo 'SNIPPET: '.$r_set[echo_l]['snippet'].'<br>'; echo 'RANK: '.$r_set[echo_l]['rank'].'<br>'; echo 'ENGINE: '.$r_set[echo_l]['engine'].'<br>';you're missing some $s.
  24. Open up your php.ini and change the settings: error_reporting = -1 display_errors = onThen restart your server and run the script. You'll get a warning message pointing you to the problem.
×
×
  • 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.