Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. m/d/y is an acceptable format (just did a simple test on my local host). Can we see the code that is giving you problems?
  2. as scootstah said, that shows the amount of queries ever executed by your server. If you want the amount executed by that page, you want to grab the number at the beginning of the page, and subtract it from the number at the end of the page. (it appears you are doing this though, with your $total_queries_start variable) Also, can you post the code for that print_array function and the fetch_total_users function
  3. Thanks for the advice. I appreciate the critique and will look into the various things you mentioned to try to correct them. Also, the argument mentioned is interesting, and I will have to add this perspective to the article. again, thanks for your time.
  4. It looks pretty good, but there are some things that catch my eye. First, the movement, as people have mentioned. A little movement is fine (and actually that main scroll bar looks great) but the site crosses the line of a little too much. I would change the testimonials section to only scroll when they mouse over it (or put a down arrow thay they can click or hover over to get the downward movement). Also the red heart line is kind of.. meh. I think you should just make it static there. And the hot jobs box, it moves way too fast first of all, and along with the rest of the movement on the page kind of makes the whole page somewhat jarring. Medical professionals generally aren't the most tech savvy people, so simplicity rather than complication would be your friend here I think. The navigation is also a little off. Its off center from the rest of the content on the page, and it gives it a strange look, as if it were just kind of put there without care or notice. As a final note, the connect with us section just seems weird. At first glance its hard to see what it is exactly, since half of the button is off the screen. And the movement is also a little jaring. Perhaps instead of its current position you could place the buttons a little lower, and instead of the downward motion, you could have a small shaking animation if you absolutely must have movement. Personally, I would prefer a subtle hover change rather than full on motion. Overall though, you should be happy with the design, as it looks quite professional.
  5. Ah Unity. Thats a good idea. I have been meaning to eventually write one for Unity, but I have been putting it off until I feel I have a good grasp of it. I think I would be able to write a simple one though. I will probably do a bit of research and get on it later today. Thank you very much for the suggestion!
  6. Thanks Ignace, I'm glad you do! I was never really sure if my writing style was, well, good or not. Do you have any critiques? Or perhaps suggestions for new topics?
  7. Can't edit my post above, so I'll have to double post sorry. Joe92, I have added some examples (in very PHP-like pseudo code more or less) to the post. Let me know what you think of these new examples, and if they are relevant/make sense. Thanks in advance
  8. Thank you very much for the feed back. I originally intended that post to be language independent so I didn't put an example. I will put a pseudo code example now though, as I agree it would be a good idea. Another question if you don't mind, what topic would be a good idea to cover? Did you check out any other tutorials? If you are up to it, would you be willing to read one if the opinion pieces I wrote? The latest one I wrote is blackscorner.me/2011/11/20/spotify-dropped-from-over-200-labels/. Let me know what you think if you can! And again, many thanks for.the feedback.
  9. Ok, first I suggest you do a little more research into PHP, as you don't seem to even know about basic syntax rules. What exactly are you trying to do here, because the outcome from the first snippet of code (if it was written correctly) is completely different from the outcome of the second. The first is removing slashes, while the second is.. trying.. to replace all backslashes in those strings with 2 back slashes. If you simply want to remove the slashes from the string use stripslashes $intro = stripslashes($row['intro']); If you really really want to do whatever it is your trying to do in the second example, you need to escape backslashes in a string or else PHP thinks your trying to escape the quote. In order to do that, you use.. well the escape character which is backslash. This results in a double backslash "\\". Google PHP escape characters (or just escape characters, since its a language independent construct) to read about how these work. while ($row = mysql_fetch_array($query)) { // Gather all $row values into local variables for easier usage in output $intro = stripslashes(str_replace("\\","\\\\",$row['intro'])); $latestnews = stripslashes(str_replace("\\","\\\\",$row['latestnews'])); $maincontent= stripslashes(str_replace("\\","\\\\",$row['maincontent'])); $mainvideos = stripslashes(str_replace("\\","\\\\",$row['mainvideos'])); } again, I don't see why you would want to do the above though. it just turns 1 backslash into 2. BTW, you should be using a more advanced text editor than notepad, as any IDE, like dreamweaver or notepad++ would make syntax errors like what you have obvious. Even the forums code tags make them pretty obvious. You can see the string (the red) continuing into the comma after the first double quote.
  10. Why are you using preg_replace? str_replace seems like it would work perfectly fine here. $newlinks = str_replace("\n", "", $_POST['newlinks']);//replace all newlines with empty strings, thus removing them from the string
  11. I've never heard of a 64 bit version of PHP so i'm not sure, sorry.
  12. The reason that a 64 bit version of PHP will work is because 64 bit refers to the length of an int in the system. with 32 bits, the maximum integer value that any single variable can hold is 2^32 -1 (i think its -1, cant quite remember exactly), and this of course, coincides with the date of 1-18-2038 (since that date is, apparently, exactly 2^32 -1 seconds after the Unix epoch). Beyond getting the 64 bit version, there isn't much you can do that I can think of. Why exactly do you need a date at that point in the future? Is there an alternative you can do? What exactly are you calculating, and how are you calculating it?
  13. PHP/MySQL has absolutely nothing to do with server management. This is the wrong forum for that kind of question, but you will want to consult a sever management forum most likely. And really what you end up doing depends entirely on how you set up your servers, what regions they serve, and if each server serves a different region, or you have multiple servers serving the same region (and thus having the same data) but serving different parts of the region. Basically, this question is very broad, somewhat complicated, and depends entirely on how your specific service is set up
  14. It will be coerced to a boolean value because that is what if statements run on. There is no way to change the functionality of an if statement, but I'm curious, what are you trying to do here? Based on that if statement, you can just use if (true) and get the same result? A some what hackish way of doing what you want would be if (($_GET['view'] || $_GET['view'] == 0) && isset($_GET['view'])) But.. I'm still unsure of why you are even doing this. $_GET['view'] can be anything (except for the empty string) and that if statement would be true.. What exactly are you trying to test in this if statement?
  15. A few problems I notice. One, here <td><input type="radio" name="type" value="Yes" />Yes <input type="radio" name="type" value="No" />No<br/></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td>Any friends tagging along</td> <td><input type="radio" name="type" value="Yes" />Yes <input type="radio" name="type" value="No" />No<br/></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td><input name="submit" value="Submit" type="submit"></td> <td><input name="reset" value="Reset" type="reset"></td> In PHP, when submitting the form, the values from that form are put into $_POST or $_GET super global array depending on your forms method (in your case, its $_POST since you use the post method). The keys in the array are gotten from the name attribute of the individual input tag. Notice that the name of all your radio buttons are type. When you have two radio buttons that are part of a single group (IE the choice of whether or not you are attending) each radio button in that group should have the same name. However, when you have two or more separate groups (Like whether or not you are attending, and whether or not you are bringing a friend) each separate group should have a separate name. Thus, you may want to change your radio buttons to: <!-- Notice the name attributes --> <td><input type="radio" name="attending" value="Yes" />Yes <input type="radio" name="attending" value="No" />No<br/></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td>Any friends tagging along</td> <!-- Notice the name attributes --> <td><input type="radio" name="bringing_friends" value="Yes" />Yes <input type="radio" name="bringing_friends" value="No" />No<br/></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td><input name="submit" value="Submit" type="submit"></td> <td><input name="reset" value="Reset" type="reset"></td> Upon submitting, on the page this form is submit to, you could then access these values by doing $attending = $_POST['attending']; $bringing_friends = $_POST['bringing_friends']; Now, as for the rest of your problem, you should have posted the code. Your post submit not working correctly on the next page could be for a million different reasons, and without seeing the code we can't really tell you which. I'm not sure why you assumed that because the post was not submitting properly, you didn't need to provide the form processing code, but instead the code that is actually working. The problem is probably on that page! Also, in the future, when posting code (especially such a short script(s)) use the forums BBCode code or php tags, instead of attaching a script. Its a lot easier for us to read and help (as many people either don't want to download or can't download stuff)
  16. Hello everyone. I have a blog at http://www.blackscorner.me that covers are few different programming/geek related topics. One of which is tutorials (mostly PHP tutorials at the moment). I would really appreciate if someone could read a tutorial or two and give me some feed back on a few things. These are: Readability: Is the tutorial easy to read Sense: Does what I wrote make sense? Correctness: Are there any factual errors Writing style: Is it enjoyable reading the tutorial? Does it explain things well? How can I improve this? any other suggestions or critiques are great also! You can leave a post here or a comment on my blog if you wish to give me some feedback. You can start at this tutorial specifically if you don't want to search for one: http://blackscorner.me/2011/07/28/php-arrays/ Or you can view this page, which has a list of most of my tutorials on PHP: http://blackscorner.me/tag/php/ Thanks in advance to everyone who helps me out. Also, if you would like, you can read any different topic, and give me feedback. I would especially appreciate some feedback on the opinion pieces I have.
  17. It should work. a .PHP extension doesn't NEED PHP, but it capable of running it on the server. If there is no PHP the server will just return the HTML IIRC.
  18. You can put PHP tags directly inside a script tag, and echo PHP variables (or string literals or whatever) into the script which will then be executed as javascript, since PHP is done server side, and the response is then run by the client. So something like this perhaps <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'Weekday'); data.addColumn('number', 'Tickets Opened'); data.addColumn('number', 'Tickets Closed'); //data.addRows(7); base # of rows on SQL size, not a static number <?php $sql = mysql_query("your gigantic query"); $count = mysql_num_rows($sql);//php function for getting # rows returned in a result resource echo "data.addRows($count);\n";//javascript. \n so its readable in source //now we loop to set the values //we have $count rows and 3 columns so $i = 0;//start at 0th row while($row = mysql_fetch_array($sql)){ //extract values to php variables $day = $row['Day Of Week'];//you should pick easier to type keys $openTickets = $row['Number of Opened Tickets']; $closedTickets = $row['Number of Closed Tickets']; //echo javascript echo "data.setValue($i, 0, $day);\n"; echo "data.setValue($i, 1, $openTickets);\n"; echo "data.setValue($i, 2, $closeTickets);\n"; $i++;//increment the row ?> var chart = new google.visualization.LineChart(document.getElementById('weekly_div')); chart.draw(data, {width: 1000, height: 200, colors: new Array("#236B8E","#78A489")}); } </script> <p id="weekly_div" style="margin-top:-30px;margin-bottom:-15px"></p> note: this is untested.
  19. First of all, post your code in code or php tags (the # button in the post editor) Secondly, you need to be specific. Just posting code and asking how to do something won't get you help. When you run this code, what happens? What do you expect to happen (obviously this would be the get variable is inserted into the database) What have you done to debug the problem. Have you printed your $_GET variable to verify it has a value? Is there a mysql error? php error?
  20. Try echoing the values you are testing to verify that they hold the values you expect them to hold. I would guess they have values you don't expect
  21. I'm curious as to why you have 3 different tables to hold identical information, rather than have a flag that will determine whether the are free listings, premium or whatever, but thats beyond the point. When you want to use the like operator to compare multiple fields to something, you want to use AND or OR (in your case probably OR). so should be of course you will need a similar change for the other sub queries. Also, when using order by, you need to specifcy in which direction (ASC or DESC)
  22. assuming its already sorted, you can simply halve the count of the array, and have two loops to go through them for each div. like $arr = array(however your array is made and sorted); $midPoint = ceil(count($arr)/2);//ceil to make a int echo "<div id="left"> for ($i = 0; $i < $midPoint; $i++){ echo $arr[$i]; } echo "</div>"; echo "<div id="right"> for ($i = $midpoint; $i < count($arr); $i++){ echo $arr[$i]; } echo "</div>"; obviously you would need to change the output in my example to match what you desire.
  23. You can't set a PHP function to happen on an onclick event. Thats for client-side scripting languages (like javascript). PHP is run on the server side, so essentially you are just telling PHP to run that function at that point in the code. You could simply make a logout.php page, and run the logout code on that page. It will redirect so its not like the user will be stuck on the logout page.
  24. try echoing the values of $term and $cat to verify they hold the values you think they hold.
  25. Well php.net is the manual for PHP, not regex . The documentation for the regex functions assume knowledge of regex. regular-expressions.com (the link I provided) has some good documentation on how regex works, and its language independent. You will want to read up on the manual page though to figure out how PHP's regex patterns may differ from normal ones. Also, the results you were getting are probably from a regex pattern that didn't match anything in the string.
×
×
  • 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.