Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. You could get more advanced with this and store into a database, set a unique for possibly date,ip,username,page or whatever you desire.
  2. I can see this being true as most asking questions on coding sites are beginners. If an OP posts procedural code naturally the responses would be returned as procedural. As we all know helping people with OOP coding would be a nightmare in a forum. I'll even add that most who even know how to code in OOP may not write good code, most likely even in procedural. Anyone can write a book and express their own opinions and try to convince you their way is better, but since are talking Uncle Bob will go along with you. Uncle Bob has his own site. https://sites.google.com/site/unclebobconsultingllc/
  3. Do you have anything created yet? You do know that getting google search results is only 8 results per fetch through their api. Max results being 64. So 8 pages per query term. Now I ask what makes you want to use imperialistic competitive algorithm, is it something you read or looked into? Do you want to compare results and place the better matching results judged by whatever rules you come up with and shift them in the array loop?
  4. Hi Martin, welcome to the forum.
  5. If I wanted my girlfriend to learn this I would walk her through the manual the same way I learned php, except she would have you to help and explain as well. http://php.net/manual/en/index.php Her asking any questions she is not fully understanding at the time is a good thing, promote that while teaching her. You don't always find out an answer if never ask the question. Spend more time going through and playing with functions and knowing what works better certain situations or know there is many options, be creative using a few together. http://php.net/manual/en/language.functions.php Can browse through some of the extensions and get even more ideas. http://php.net/manual/en/extensions.alphabetical.php Create along with her a "what did I learn so far" and store into a database. Making something useful gives a goal and sense of accomplishment. Math related are always fun right? Making forms and retrieving POST,GET,SERVER,REQUEST Uploading files or images Folder and file based functions Creating sessions and cookies, accessing them. Playing with many date functions and modifying them for display. Creating simple functions. Show how can echo within the function or return results. Adding multiple parameters. Explaining arrays and key values, different array types. foreach and for loops, accessing arrays. using various string manipulation functions how to concatenate and escape php/html database usage I posted a fairly long "do and don't" list for another member. http://forums.phpfreaks.com/topic/293447-echo-hello-world/?do=findComment&comment=1501111
  6. Could you post your current code and database structure, also any code how you are implementing this.
  7. Use a while loop while ($ln = mysqli_fetch_assoc($resp)) { echo 'replyfrom: <b>' . $ln['from'] . ' </b>in <b>' . $ln['subject'] . '</b><br />'; }
  8. From Fastol's example did $row['Highest_Speed'] not work? In your loop compare them and highlight speed if it matches. <td> <?php if ($row['Highest_Speed'] == $row['speed']) { echo "<strong>".$row['speed']."</strong>"; }else{ echo $row['speed']; } ?> </td>
  9. Your blog scripts should link to those type urls in a href. If you want to get results such as that particular article would query the database matching the category/dates and or by the pretty_slug such as my-topic-for-the-blog
  10. Did you have a look at what can return with $_SERVER to determine the uri? As for the variables can do them with GET ... ?action=edit In this case would check if $_GET['action'] is set and not empty or within an array that you allow. For the multiple values can do a switch or if/else. I see what you are trying to do, for my one cms I made a controller that handles what to include. Everything goes through index page I include the controller script Controller script determines which script to load depending uri or parameters, also my allowed GET array I use a switch to determine which script to load (you could do similar get values and script names and append the extension) If file exists include that script
  11. The first place I would look is the response times coming from the 3rd party api at https://viatorapi.viator.com
  12. https://codex.wordpress.org/Function_Reference/query_posts query_posts('posts_per_page=2&offset=1');
  13. To ensure the break works html,html5 and xhtml should use <br /> Personally I use echo because it can do more. echo (278909887*4) . "<br />"; I know this is a simple example, for the record using css is even better.
  14. mysqli_real_escape_string requires the connection made first function limpa($con,$valor){ return mysqli_real_escape_string($con,$valor); } does this really save you making the function another function?
  15. You have to pass the connection as well. $update= "UPDATE avaliacao SET nota = '{mysqli_real_escape_string($con,$nota)}' , comentario = '{mysqli_real_escape_string($con,$comentario)}' WHERE id = '{mysqli_real_escape_string($con,$id)}'";
  16. Try this query. $update= "UPDATE avaliacao SET nota = '{$nota}' , comentario = '{$comentario}' WHERE id = '{$id}'"; You should be checking if POST values are set, data are expecting and not empty, also escaping them. mysqli_real_escape_string edit: Maxxd beat me posting.
  17. Check your apache access logs for excessive traffic, maybe is bots or spammers. deny them in htaccess
  18. Welcome to the forum disowned.
  19. Was another post I did about tracking clicks or views plus by dates. Note it's using mysqli_ functions instead of the deprecated mysql_ http://forums.phpfreaks.com/topic/296442-unique-click-tracking-using-php/?do=findComment&comment=1512504
  20. Are you using upper or lower case for id? From what I see you only need 2 columns ID and hits, since you seem to be trying to use the $video_id variable as id. If ID is an autoincrement would not work as you expected. ditch the autoincrement on ID if have it and drop the videoid column $getViews = mysql_query("SELECT `hits` FROM `views` WHERE `ID` = $video_id"); if(mysql_num_rows($getViews)) { $result = mysql_fetch_assoc($getViews); $videoViews = $result['hits']+1; } else { $videoViews = 1; } mysql_query("INSERT INTO `views` (ID,hits) VALUES ('{$video_id}','1') ON DUPLICATE KEY UPDATE hits = hits+1"); echo 'Total Views: '.number_format($videoViews);
  21. To expand on what mac_gyver said. Is hard for us to tell where this data is coming from in the first place. If it's a matter of displaying the output in html can use htmlentities() $parameters = "tonce=1377743828095093 &accesskey=1d87effa-e84d-48c1-a172-0232b86305dd &requestmethod=post &id=1 &method=buyOrder &params=500,1"; echo htmlentities($parameters, ENT_QUOTES, "UTF-8"); & should actually be & or encoded %26 or %26amp%3B so there is no confusion to the browser output, it's just parsing by it's rules To prevent this you can encode and decode data that's expected to go through the address bar urlencode() urldecode() rawurlencode() rawurldecode(); Since it seems you are combining parameters for use in the address bar should try http_build_query() As an example from an array: $parameters = array("tonce"=>"1377743828095093","accesskey"=>"1d87effa-e84d-48c1-a172-0232b86305dd","requestmethod"=>"post","id"=>"1","method"=>"buyOrder","params"=>"500,1"); echo http_build_query($parameters, '', '&'); results: tonce=1377743828095093&accesskey=1d87effa-e84d-48c1-a172-0232b86305dd&requestmethod=post&id=1&method=buyOrder&params=500%2C1
  22. Also... You are using POST above and these lines are using GET if (isset($_GET['visitor_id']) && is_numeric($_GET['visitor_id']) && $_GET['visitor_id'] > 0) { // query db $visitor_id = $_GET['visitor_id'];
  23. That would be link back to article in feed. guid and link
  24. It's pretty much the purpose for that function, to compare if the options are the same for the hash. Depends what is in the options, it could be a different cost or algorithm. The reason it's there in the example is if you did change any options and to compare it the same.
×
×
  • 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.