Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 01/22/2019 in all areas

  1. 1 point
    mssql_connect was removed from Php http://php.net/manual/en/function.mssql-connect.php PDO is how you will want to do it. http://php.net/manual/en/book.pdo.php
  2. 1 point
    You could do it with PHP, but the more you learn and advance with web development the more you're going to need to know Javascript and understand things like AJAX. One step at a time. Get the rest of your idea in place, the stuff you already know how to handle, then when you get to the trophies you can think about how to use the opportunity to expand your skillset.
  3. 1 point
    here's a list of things i saw in the posted code - 1. don't put php variables inside of double-quotes if they are the only thing in the string. 2, don't use or die() for error handling. use exceptions and in most cases let php catch the exception. note: your use of mysqli_error(...) in the connection code won't work because there's no connection to use. 3. don't unconditionally output database errors onto a web page (this will go away when you get rid of the or die() logic.) 4. don't run queries inside of loops. learn to do JOIN queries. 5. if your code is tabbed that far over because it is located inside your html document, you need to put the php code that's responsible for getting/producing data before the start of your html document, fetch the data into appropriately named php variable(s), then use those variable(s) in the html document. 6. handling the negative/failure case is usually shorter then the positive/successful case. if you invert the logic tests and handle the negative/failure condition first, your code will be clearer. you won't have logic for the negative/failure case 10's/100's of lines later in the code. 7. don't use loops to fetch what will be at most one row of data. just directly fetch the single row of data. 8. don't put static calculations inside of loops. the various date values shouldn't change during one report (where they are at now, they will if the request spans midnight.) put them before the start of the loop. 9. don't put quotes around numbers. 10. don't selected things that are not used and don't create variables that are not used (given the amount of code, the cases i saw of this may not be accurate.) 11. if you are looping to do something (should go away with JOINed queries), don't evaluate count() statements in the loop. determine the loop count, once, before the start of the loop. 12. doing some of these things will simplify variable naming. you won't have to think up unique names for variables because you will only have one instance in the code. 13. the $AffID is probably from external/unknown data. you should NOT put eternal/unknown data directly into an sql query statement. use a prepared query, with a place-holder for each data value, then supply the data when the query gets executed. switching to the much simpler php PDO extension will make using prepared queries easy compared to the php mysqli extension.
  4. 1 point
    It is really incredible how MANY different problems you encounter and have to post for us to puzzle over. So much stuff I have never imagined could be in existence and you seem to come up with reasons why they don't work for you. Do you just spend 24x7 researching things to learn about? Or do you have such a diverse workload that you have to learn all of this "stuff"? All of the things you have posted can't possibly all be connected, can they? If so it must be one heck of a project!
  5. 1 point
    When in doubt, Ctrl+F in the documentation might help.
  6. 1 point
    The only difference between the "OOP" and "procedural" versions is that one uses $object->function_name($arguments) and the other uses similar_function_name($object, $arguments). I didn't look hard at what you did but I did see you did more than just change the function calls.
  7. 1 point
    Since PHP doesn't actually "do" color, I would suggest that you use CSS. Setup a set of colors in your CSS area and then as you loop thru the numbers and create the HTML that will output those, assign a CSS classname. First the CSS <style> .color_1_10 {color:red;} .color_11_20 {color:blue;} .color_21_30 {color:green;} .color_more {color:black;} </style> Now the PHP for ($i=20; $i<=49; $i++) { switch ($i) { case <= 10: $clsname = 'class_1_10'; break; case <= 20: $clsname = 'class_11_20'; break; case <= 30: $clsname = 'class_21_30'; break; default: $clsname = 'class_more'; break; } echo "<span class='$clsname'>$i</span><br>"; } Note that I used a different range of numbers, but I think you get the idea.
  8. 1 point
    I tried it using the page you linked and it worked for me. Goes on the li. Oh, and remove the float. And you'll probably want to tweak the margins a little.
  9. 1 point
    As requinix suggested, you need to be using the logical operator for "and". Note that you'll also need to correct the second part of your if statement. The following will always equate to "true". if("Followee_All") { So the following is going to give you unexpected results: if($followee_username != "followee_all" AND "Followee_All") { You need to tell PHP that you are running a second test against the $followee_username variable. if($followee_username != "followee_all" AND $followee_username != "Followee_All") { For what it's worth, I would just leave the username blank whenever someone wants to see all users. Then your code would look something like this: //IF USERNAME ISN'T BLANK, GET SELECTED USER'S INFORMATION if($followee_username != "") { //... //ELSE...GET INFORMATION FOR ALL USERS } else { //... } That way you don't need to worry about the case (followee_all, Followee_All, FoLLowee_ALL). You also don't need to worry about someone inadvertently picking this "special" username. Of course, I'm guessing that's probably not going to happen.
  10. 1 point
    Have you got php error reporting turned on in your php.ini file? (You have ann error in the PDO options)
This leaderboard is set to New York/GMT-05:00
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×

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.