Jump to content

xangelo

Members
  • Posts

    102
  • Joined

  • Last visited

    Never

Everything posted by xangelo

  1. That's the problem. Your output has already started on line 44, you can't send headers after you already have output unless you are buffering. Read the sticky: http://www.phpfreaks.com/forums/index.php?topic=37442.0
  2. From my understanding "blend modes" are not a native component of anything. They are algorithms for modifying an image. Technically you would either need to find these algorithms yourself or write your own.
  3. The reason you're getting that error message is because you never closed your php tag before you started typing out html. Change line 44 to mysql_close();?>
  4. What's the error that is appearing?
  5. You're almost there. Try this: <?php echo date('F j, Y',$_SESSION['date']); ?>
  6. Glad to help. One thing I would suggest, however, is to sanitize your input variables before you insert them into your database. http://php.net/manual/en/function.mysql-real-escape-string.php
  7. Oddly enough apple has a pretty in depth guide regarding SOAP. http://developer.apple.com/internet/webservices/soapphp.html Just to clarify, the PHP code is just going to serve as a middleman correct? Something pushes data to the PHP script, which in turn relays it internally on your clients network? Or will the PHP script be requesting some data from Salesforce which it will then push internally?
  8. Not a problem, glad to be of help.
  9. The easiest way is use PHP's sessions to store all the information between pages. You could leave app_form_1.php without the session code since it doesn't need to maintain any information. On submit (ensure the action is app_form_2.php, not just app_form_2) it will send the details of your form to app_form_2.php This is what the start of app_form_2.php could look like. Make sure the session_start(); method appears at the VERY top of your page. <?php session_start(); $_SESSION['firstname'] = $_POST['firstname']; ?> <form id="form1" name="form1" method="post" action="app_form_3.php"> Lastname: <label> <input type="text" name="firstname" id="firstname" /> </label> </form> <p> <label> <input type="submit" name="Continue" id="Continue" value="Continue" /> </label> In this way, app_form_3.php would look like this: <?php session_start(); /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $_SESSION['lastname'] = $_POST['lastname']; ?> <form id="form1" name="form1" method="post" action="app_form_process.php"> Email address: <label> <input type="text" name="emailaddress" id="emailaddress" /> </label> </form> <p> <label> <input type="submit" name="submit" id="Submit" value="Submit" /> </label> Your app_form_process.php only needs to be modified slightly: <?php session_start(); $firstname = $_SESSION['firstname'] ; $lastname = $_SESSION['lastname']; $emailaddress = $_POST["emailaddress"]; Let me know if you run into any other problems.
  10. As per your code, you're not calling mysql_query properly and you're not calling it in the right spot. Since you want it to execute for each loop, it should be more like this: $query = ("SELECT `propertyref` FROM `feed_property` WHERE `status` = 'Sold' ")or die(mysql_error()); $result = mysql_query($query); if (isset($result)) { while ($row = mysql_fetch_array($result)) { $ref1 = mysql_real_escape_string($row['propertyref']); $query1 = "DELETE FROM `feed_property`, `feed_images`, `feed_characteristics`\n" . "USING `feed_property` INNER JOIN `feed_images` INNER JOIN `feed_characteristics`\n" . "WHERE feed_property.propertyref = '$ref1'\n" . " AND feed_images.propertyref = feed_property.propertyref\n" . " AND feed_characteristics.propertyref = feed_property.propertyref; "; if(!mysql_query($query1)){ echo '<h1 style="color: red;">Error</h1><p>', mysql_error(), '</p>'; } else { echo '<h1 style="color: red;">Properties have been removed from the database</h1>'; } echo $query1; } }
  11. Assuming the data format stays the same, here's a much easier way: $data = "<a href=''>Arbitrary characters. Bla bla bla</a><p>123456789</p><p>$10,100</p><p>01/02/2010</p><p>01/02/2011</p>"; list(,$str_1,,,$str_2) = explode('<p>',$data); $str_1 = substr($str_1,0,strlen($str_1)-4); $str_2 = substr($str_2,0,strlen($str_2)-4); What this does is split your string into an array at every '<p>', then it assigns it to some variables by using list(). Finally, it strips of the trailing '</p>' that is present. http://php.net/manual/en/function.list.php http://php.net/manual/en/function.explode.php http://php.net/manual/en/function.substr.php http://php.net/manual/en/function.strlen.php
  12. The 3rd argument is an offset from the start of the string, not from the matches. So $opening_fourth_p = strpos($data, '<p>', 4); starts from the 4th character of $data, not the fourth occurrence of <p>. Also, in general, offsets are 0indexed. http://php.net/manual/en/function.strpos.php
  13. Most likely the path you are passing to mkdir does not actually point to the location you're trying to create the file in. Since you're calling mkdir from Setting/time/index.php it looks like you want to create the folder IN that directory. Try: mkdir('./'.$id); or use the following to see where exactly you are creating that new directory. mkdir("../Setting/time/".$id,0,true);
  14. If you dump the data in PHP before you put in the database is the data still being mangled? Or does that only happen when it's inserted?
  15. This isn't actually a php question, it's a javascript one. Basically in order to do this you need to use some mechanism in javascript to query this page in the background. There are plenty of javascript frameworks (jQuery, MooTools etc.) that provide something called an "AJAX" implementation. Basically, you can provide a URL to these javascript methods and it will essentially "visit" the page in the background. It will then return whatever string you want. For example, in jQuery, you would do something like this: $.ajax({ url: 'path/to/your/file.php', dataTye: 'text', success: function(data) { // data is the string from file.php } }); Now you would just need to modify your .php file to echo whatever you want to display
  16. Hi everyone, I've been working on a script that generates HTML tables using multi-dimensional arrays in PHP. It accepts a multi-dimensional source and allows you to Select which columns will be displayed Rename the titles of displayed columns Re-order the displayed columns Create new columns and insert them before or after any existing column Allows back-references in column data. IE, you can refer to ANY column within the row via {column_name} Here's a link to the writeup of how it works: http://wheremy.feethavebeen.com/datagrid-v2/ Here's a link to the phpclasses hosting of the download: http://www.phpclasses.org/package/6542-PHP-Display-data-listings-in-an-HTML-table.html I just wanted to know what you guys thought of it, as well as any suggestions or improvements you might have.
  17. You are Nightslyr, the post was more to see if there were any reasons not to pursue that method of type hinting. I've gone ahead and abstracted everything a bit more. There is now a TypeHinting class that you can extend or instantiate separately to give you access to the TypeHinting abstraction. There is also a TypeDef class that gives you access to primitive Type Definitions, but of course, you are free to extend it and implement static versions of your own Type Definitions. <?php /** * Allows you to tie in to the basic TypeHinting methods * to allow pseudo-type hinting within PHP * * @author xangelo */ class TypeHinting { private $structs; /** * * @param string $type Class Property * @param function $cb Callback Method */ protected function AddTypeDef($type,$cb) { $this->structs[$type] = $cb; } /** * * @param string $key Class Property * @param function $value Intented Property Value * @return bool */ protected function IsValidType($key,$value) { if($this->structs[$key] != null) { if(!$this->structs[$key]($value)) { throw new TypeException('Type Exception: '.$key.' type mis-match'); return false; } } return true; } } ?> <?php /** * Creates the default primitive and advanced Type Definitions * for use in Strongly Typing your classes. * * @author xangelo */ class TypeDef { /** * * @param string $x * @return bool */ public static function string($x) { return is_string($x); } /** * * @param int $x * @return bool */ public static function int($x) { return is_numeric($x); } /** * * @param bool $x * @return bool */ public static function bool($x) { return is_bool($x); } /** * * @param double $x * @return double */ public static function double($x) { return is_double($x); } /** * * @param float $x * @return float */ public static function float($x) { return is_float($x); } } /** * Creates base TypeException class * * @author xangelo */ class TypeException extends Exception {} ?> And once again, our account class that implements TypeHinting utilizing our TypeDef helper: <?php /** * Sample Account class to implement type hinting * * @author xangelo */ require_once('TypeDef.php'); require_once('TypeHinting.php'); class Account extends TypeHinting{ private $ID; private $Name; private $Password; public function __construct() { $this->AddTypeDef('ID',function($x){return TypeDef::int($x);}); $this->AddTypeDef('Name',function($x){return TypeDef::string($x);}); $this->AddTypeDef('Password',function($x){return TypeDef::string($x);}); } public function __get($key) { return $this->$key; } public function __set($key,$value) { if(property_exists($this,$key)) { if($this->IsValidType($key,$value)) { $this->$key = $value; } } } } try { $Account = new Account(); $Account->ID = 521; $Account->Name = 'Angelo'; $Account->Password = '49g10fc0q0weq'; echo '<pre>'.print_r($Account,true).'</pre>'; } catch(TypeException $e) { echo $e->getMessage(); } ?>
  18. I've been doing the same for Objects, but primitive types aren't supported by PHP's type hinting (yet?).
  19. I've been working with various strongly typed languages rather exclusively for a little while now and was hoping to work with the same features in PHP. I understand that PHP isn't inherently typed but I've come up with some sort of pseudo-typing mechanism outlined below. I was just wondering what your thoughts were on this? class TypeException extends Exception {} class Account { private $ID; private $Name; private $Password; private $TypeEnforce; public function __construct() { $this->TypeEnforce = array( 'ID' => function($x){return is_numeric($x);}, 'Name' => function($x){ return is_string($x); }, 'Password' => function($x){ return is_string($x); } ); } public function __get($key) { return $this->$key; } public function __set($key,$value) { if(property_exists($this,$key)) { if($this->TypeEnforce[$key] != null) { // Type is enforced if($this->TypeEnforce[$key]($value)) { $this->$key = $value; } else { throw new TypeException('Type Exception: '. $key .' failed to be set to '. $value); } } } } } try { $Account = new Account(); $Account->ID = "49ga"; $Account->Name = 'Angelo'; $Account->Password = '49g10fc0q0weq'; } catch(TypeException $e) { echo $e->getMessage(); }
  20. [*]AJAX is not a coined term when actually referring to Asynchronous JavaScript and XML. [*]JSON has nothing to do with asynchronous or even synchronous JavaScript. It is simply an object notation. [*]There is no such thing as a "JSON request". It is a request. You may either choose to utilize JSON to pass data back to your server-side script, or you can choose not to. You can also choose to include the data directly into the URL you are accessing. What you actually want shahzad429 is simply an XML file that contains all the data you need. This file can either be generated utilizing a database and a server-side scripting language, or you can just have a static file if your data won't change very often. Using JavaScript (I'd recommend looking at a utilizing a library like jQuery or MooTools, because trying to handle the different browsers is a hassle) you'd create an AJAX request passing the URL of your XML file. Depending on which library you use, you may have to specify that you are returning XML data. Once you get your data, you will need to parse it and store it in an array. When a user presses a key in your textbox, simply look through this array using some kind of loop and show them the matching values.
  21. It doesn't make sense to output code before you make all your changes to it, because now you're wasting cycles and time doing string manipulations. A much easier method would be to have an associative array of things that you'd like to change, and their values. assign() will simply set the value of the array key and display() will simply use each value from the array.
  22. Once the page has loaded, it creates an AJAX request that returns in XML format. This data contains things like the airport code, city etc. It queries: http://www.emirates.com/system/aspx/IBEAirportsXML.aspx?pub=/ae/english/&mode=2 When you type, JavaScript looks through the data that it already has and only shows you the relevant data. This way, it doesn't need to request any data on every key-stroke so things seem a lot faster.
  23. CKEditor plugins are written in JavaScript and run through a custom compiler that mashes all the code into a single .js file to minimize requests. Each button in CKEditor is (most times) it's own plugin, so it can get pretty hefty. Please don't respond if you don't understand the question, or at least ask for clarification instead of assuming you are all knowing.
  24. I recently ran into a similar issue with an application I was developing. I ended up going with a combination of dropdown, auto-complete and input field. When typing into the input field, it queried a hidden dropdown to eliminate querying the database. It then showed those results. If a user continued typing something different it would still accept the value they had given. I just included a link for them to browse all available categories if they wanted to, but this method seems to cater to all my users needs.
  25. echo $info['title'].'<br>'; However, might I suggest looking into tables to organize the displayed data? http://w3schools.com/html/html_tables.asp
×
×
  • 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.