premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
My instinct says try removing header("Cache-control: private"); And see if it works on IE.
-
Don't hijack, create your own thread. It should be created in the 3rd party forum as well.
-
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
-
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!
-
CRON on UNIX or Schedule Tasks on Windows are what you want.
-
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!
-
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...?
-
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.
-
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.
-
substr is one way...explode would have to be another.
-
PHP noob, need help with echo vs. return in functions
premiso replied to sigkill-9's topic in PHP Coding Help
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. -
[SOLVED] echo to specific location from function
premiso replied to aebstract's topic in PHP Coding Help
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 -
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!
-
[SOLVED] echo to specific location from function
premiso replied to aebstract's topic in PHP Coding Help
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. -
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...
-
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.
-
$_SESSION['keyname'] = $row->post_id; Is that what you are after?
-
How could I know if a day is sunday on a calendar?
premiso replied to giba's topic in PHP Coding Help
getdate Would that work out for you? -
<?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.
-
Can I force an HTTP Status Code before the script completes?
premiso replied to jedgar's topic in PHP Coding Help
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. -
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.
-
[SOLVED] Should You mysql_real_escape_string ALL form data?
premiso replied to limitphp's topic in PHP Coding Help
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: -
$query="Select * from myTable WHERE id={$_SESSION['rest']}"; That would be.