Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. My instinct says try removing header("Cache-control: private"); And see if it works on IE.
  2. Don't hijack, create your own thread. It should be created in the 3rd party forum as well.
  3. This is assuming you want it to be cut into 10 words, roughly 50 characters: <?php $text = "With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post."; if (strlen($text) > 50) { $chopped = substr($text, 0, 50); echo $chopped . "..."; }else { echo $text; } ?> Simple as that. Should do it. EDIT: This is an example using substr
  4. premiso

    Sorting

    http://www.phpfreaks.com/tutorial/basic-pagination Pagination is what you are looking for. EDIT: Beaten to it, but I posted the in house tut, w00t!
  5. CRON on UNIX or Schedule Tasks on Windows are what you want.
  6. I do not think you can do this in PHP. VB Would definitely be the way to go. If you can do it in PHP it would be using http://www.codeplex.com/PHPExcel But I think that part of excel is done in Binary. So yea, good luck with VB 6!
  7. How is the data stored/retrieved? Does it have the line break character with it? Is this done by MySQL, or? If it is done in MySQL, do you see the code like how you want it, or on one line? Please elaborate on that, I also do not know if this PDF class actually interprets HTML...?
  8. Not quite. It encodes a url to send properly, so for a space, which normally breaks a url, it sets it to be %20. Upon receiving the $_GET['cmd'] you should urldecode it and it will display what you originally put in.
  9. Time ran out, oh well. Anyone interested, Google Notebook[/m] offered the prefect solution for this. You can download a "browser extension" and extend that functionality.
  10. substr is one way...explode would have to be another.
  11. First up, all those echos, take processing time to do. If you were, to say, store all that into a string then return the string and echo the string, that is one echo. Echoing inside functions is fine, especially for simple scripts. However, returning a string will allow you to manipulate that string, so if you wanted to parse it etc you can. And you can call that function anywhere on your script and still be able to echo that string when you want/need to. But yea, 50 echo's like that is not good, you do not need to put an echo on each new line, thank god.
  12. It does not end the script persay, it just exits the function. If you want the function to continue, this would work and is actually better, imo, than just printing data onto the screen. function showCart() { global $db; $output = ""; if (isset($_SESSION['cart'])) { $output .= '<form action="index.php?page=cart&action=update" method="post" id="cart">'; foreach ($_SESSION['cart'] as $id => $array2){ foreach ($array2 as $material => $array3){ $result = mysql_query("SELECT * FROM p_products WHERE id='$id'") or DIE(mysql_error()); while($r=mysql_fetch_array($result)) { $partnumber=$r["partnumber"]; $partname=$r["partname"]; $description=$r["description"]; $category=$r["category"]; $price=$r["price"]; } $output .= " <table width=\"590\" style=\"border-top: 1px solid #000;\"> <tr> <td width=\"100\"><img src=\"products/$partnumber-cart.jpg\" class=\"jkimagelarge\" title=\"products/$partnumber.jpg\" /></td> <td width=\"350\"> $partname<br /> $partnumber<br /> $price / each<br /> Material: $material </td> <td width=\"60\"><input type=\"text\" name=\"qty$id\" value=\"{$array3['qty']}\" size=\"3\" maxlength=\"3\" /></td> <td width=\"80\">$($price * {$array3['qty']})</td> </tr> </table>"; } } $output .= '</form>'; } else { $output .= '<p>You shopping cart is empty.</p>'; } return $output; } You would be fine
  13. I do not know....I just thought it might cool. I will take a look at the bookmark mod, I guess I never really looked into it. I just figured it added a bookmark to your favorites in the browser. I will take a look at that. Anyhow, just a suggestion, it sounded good at the time EDIT: I was actually looking at the new features of my GMail and that was one of them. Anyhow I will probably just find a 3rd party app to do this for me, thanks!
  14. Return values are great. Let's say you want to do a math calculation. This would be an ideal way to do it: <?php $num1 = 5; $num2 = 6; $num3 = 3; $returnVal = add($num1, $num2); echo $num1 . " + " . $num2 . " = " . $returnVal . "<br />"; $returnVal2 = sub($returnVal, $num3); echo $num3 . " - " . $returnVal . " = " . $returnVal2 . "<br />"; function add($val1, $val2) { return ($val1 + $val2); } function sub($val1, $val2) { return ($val1 - $val2); } ?> Hopefully that will help you understand the return. It allows the data to be assigned to a variable.
  15. What type of email address are you sending it? If it is Yahoo, AOL, or Hotmail, they tend to not accept emails from a lot of php scripts without valid headers, or where servers who do not ping back that they have a mail server on them...
  16. chmod The directory just allows files to be written to it. The actual file has it's own set of permissions. The file would also need to be writeable, so 0667 I believe should suffice.
  17. $_SESSION['keyname'] = $row->post_id; Is that what you are after?
  18. Let me ask you this, is there a reason you are not using sessions for this?
  19. getdate Would that work out for you?
  20. <?php $var = mysql_query("SELECT * FROM table;"); if (is_resource($var)) { while ($row = mysql_fetch_assoc($var)) { print_r($row); } }else { echo 'Query failed, error is: ' . mysql_error(); } ?> Hope that helps ya.
  21. You are setting the cookie for 1 second from now....try doing it for a bit more than that.
  22. You can use exec along with PHP CLI to send the script to a separate process...that way the page "is done" but the process is still running. I am not 100% sure if that would work, but yea. Worth a shot I guess.
  23. Hey, So I was thinking, this would be a really cool feature to have, especially if it could be displayed in like a floating div on the page or something if enabled: http://custom.simplemachines.org/mods/index.php?mod=560 http://custom.simplemachines.org/mods/index.php?mod=788 That way you could store snippets of commonly posted issues, like the error_reporting etc and have easy access to them. Even if you have to go to the profile page to use it, I think it would still be handy. Not sure if this was brought up before, but yea (I searched for notepad /memo pad with no results) Just thought of that idea and thought it might be cool.
  24. It returns a bool, but as you notice I do not set it to anything. It goes through the array, by reference, and applies that to every element of the array. The data will be escaped. The example from the man page:
  25. $query="Select * from myTable WHERE id={$_SESSION['rest']}"; That would be.
×
×
  • 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.