Jump to content

kicken

Gurus
  • Posts

    4,704
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by kicken

  1. You have your to_id and/or from_Id columns marked as being unique. You need to remove this constraint. Also, you posted in the form for Microsoft SQL Server, but you are using Mysql. They are completely different database packages. I've moved your thread for you, please pay attention to where you post in the future.
  2. Rather than a for loop, use a while loop to read the results: $this->rows=array(); while ($row=$this->result->fetch_assoc()){ $this->rows[] = $row; } return $this->rows; Have you verified that your query actually returns data by running it in your db management tools?
  3. Look at the HTML output produced by your script so you can identify exactly where the text is being output at, then find that location in your PHP script. Basically the text 'Resource id #X' occurs when you attempt to convert an internal PHP resource (such as that returned by mysql_query) into a string. My best guess as to the reason you are seeing that text is that you may be using $playerinfo previously in your script to hold the result of a mysql_query call. Because you never seem to clear the value, when your script later does: $playerinfo.= "<div class='title'>.... it will attempt to concatenate the html onto the end of the resource, causing the resource-to-string conversion resulting in the text appearing at the top.
  4. \n is a new line, which a browser will render as a space. That is what is causing your issue.
  5. I don't really see the point in such a thing. Generally you'd only want to cache the items you need frequently, not an entire database. This would completely fail if you database became even moderately sized and pulling data from APC rather than the DB defeats much of the point in having a DB in the first place (quick searching and joining of data). The only instances in which you might want to just dump data to APC from the DB would be for maybe a configuration table that holds a bunch of application-wide settings, and maybe something like a category list.
  6. No, with a proper 301 (Permanent) redirect google and other search engines should transfer any ranking data from the old URL to the new URL
  7. If the URL in their index is no longer valid on the new site, then you should mark it as gone, which can be done using mod_rewrite or apache's Redirect argument. For example: Redirect gone /the/old/url.php Next time google tries to index that URL it will see that it is gone and slate it for removal from it's archives. If the URL in their index is still valid, just with different content, then you'll just need to be patient and in time google will update to the new content. You can submit your URL to http://www.google.com/addurl/ to try and speed up the process of google re-indexing the site.
  8. By defined pattern, I mean there is something common to all URLs which can be used to match them. For example, if they all begin with /services/ and end in .html with only the middle bit changing then you could match all of them using the regex: /services/(.*)\.html. You can then use that pattern in the mod_rewrite solution described above.
  9. callback functions are something you pass as an argument to one function, and once that function has finished doing something, or needs to do something it does it will execute the passed function. Exactly what a callback does is going to depend on what function is using the callback. In the specific case of call_user_func_array the callback is just the function you would like to execute, the array of params will be passed into that function as individual parameters. For instance: call_user_func_array(array($stmt, 'bind_param'), array('ii', 123, 456));will execute as if you had instead typed $stmt->bind_param('ii', 123, 456);on that line. By using call_user_func_array, the parameter list given to bind_params can be built up dynamically during your code, where as if you had typed that line directly you'd only be able to provide a static list.
  10. If all the links follow a defined pattern that you can generate a regex for, then you can use mod_rewrite to redirect them. Eg: RewriteEngine On RewriteRule /page/(.*)\.html /page/$1.php [R=301,L] If there is no defined pattern, you can just take the individual URLs and redirect them using the Redirect directive. Redirect permanent /page/whatever.html http://www.example.com/page/whatever.php Redirect permanent /someotherpage/blah.html http://www.example.com/someotherpage/blah.php These would go in your .htaccess or apache config file. If your using a server other than apache, you'll need to research how that server handles redirecting.
  11. What part of the processes takes so long? If it is downloading the data, then you can setup a system using cURL to download from several sites in parallel. If it is the actual processing of the results then you may have to step into the multi-process realm to kick off several child processes. The first step before any of that though is to make sure your code that does the processing is as efficient as it can be. Make sure you're not doing something silly like queries within loops, or unnecessary nested loops. Use string functions where possible rather than regex, minimize IO time, etc.
  12. You can add extra code above or below the existing code without a problem, ie: <?php //your new code here include 'someclass.php'; //The existing code ?> You wouldn't be able to modify anything in the middle of the existing code without undoing the obfuscation though. Without being able to modify the existing code, adding a class to the file seems kind of pointless as it wouldn't be used by the code.
  13. kicken

    Help!

    If you're talking about all the links on the silver nav bar (Home, Tutorials, Blogs, etc) then there is nothing special going on. They are just normal links loading different pages. Each page has the same base template though so the header and side bar are the same. What you describe though is commonly referred to as AJAX. You use Javascript to make a request for a certain page in the background and then insert the response content into the current page's DOM. There are lots of tutorials on the subject, and the jQuery library has several convinence methods for various use cases, such as .load
  14. Because you have to have string variable with your content, which has been represented as $html in the example.
  15. var option_count = $( '#opt_count' ).val(); // This number is subject to change on every page var opts = {page_no:2}; for ( i = 0; i < option_count; i++ ) { opts['option_'+i] = $('#option_'+i).val(); } $( '#contain' ).load('receiver.php', opts); Create the opts object with the page_no option to start, then add each option_x property in the loop.
  16. There is no simple or short answer to that question. You'll need to do a lot of searching and reading of tutorials. Search for things like PHP Web App Security, Cross-site Scripting, SQL Injection, Cross-site request forgery, Session Hijacking.
  17. HTML does not render line breaks. You need to replace (or add to) them some <br> tags which will then cause a new line to be rendered. PHP has a nice function for this called nl2br
  18. LIKE does not do what you seem to think it does. LIKE is for basic wildcard matching, ie searching for %PHP would find anything ending in the string PHP. What you seem to want is something that will take a bunch of words listed in one column, and see if a second column contains those same words without regard to order. As far as I know, there is not any pure SQL way to do this. Perhaps a better plan would be to change your skill_keywords columns into separate tables, with one row per key word. Then you could join based on that and get your desired results. If you keep it setup as is, you'd likely have to fall back to a not very pleasant PHP solution.
  19. You're missing a ; after the width specification in the first one. Both the float and the width rules are ignored as a result. You also have a few stray ; in places they do not need to be, such as the one after align="left" in the second block there.
  20. Prepared statements would go in the same place your queries currently are, there is no need to move them anywhere. Changing to prepared statements just means that you'll be handling how you handle user-provided inputs with the queries. Rather than inserting them directly into the query by concatenating them to the query string, you put in placeholders and then bind the parameters. So your current function: function get_jb_summ($job_id){ global $connection; //Escape value $job_id = mysqli_real_escape_string($connection, $job_id); $jb_summ_set = mysqli_query($connection, "select summary from job where job_id = '$job_id' and summary !=\"\""); return $jb_summ_set; Would just change to: function get_jb_summ($job_id){ global $connection; $stmt = mysqli_prepare($connection, "select summary from job where job_id = ? and summary != ''"); mysqli_bind_param($stmt, 'i', $job_id); mysqli_stmt_execute($stmt); return $stmt; } Assuming I got my mysqli functions correct, I'm not very familiar with that API as I use PDO generally. Technically yes, but it is not necessary and ill-advised. Prepared statements exist to prevent SQL Injection. The contents of your stored procedures should not have any need for that. You may use prepared statements to call your procedures from your script, and should if they accept parameters.
  21. Storing a cookie with a unique ID inside of it is the only thing you can do to try and uniquely identify a computer. There are no other identifying marks which can be tied to a specific computer. Even a cookie is not perfect, but it's the best possibility.
  22. My first guess would have been that short tags is disabled, but if your main script is also using them and it works fine, then that seems unlikely. Regardless, you should not be using them anyway. Use full <?php tags, not <?
  23. You're missing the closing PHP tag (?>) at in the first code sample. Other than that, it is fine. In the future when you post code please surround it in [code ][/code] tags.
  24. You misspelled function in the second script block.
  25. If you just want to get it working, then just load up the demo page, view the source, and look at what needs to be done. It's about as simple as anyone could make it. If you want to actually know more about what the JS is doing and how the jquery plugins work, seek out some additional tutorials about how to create jquery plugins.
×
×
  • 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.