Jump to content

ridiculous

Members
  • Posts

    175
  • Joined

  • Last visited

    Never

Everything posted by ridiculous

  1. What does your database class look like? Can you post it, please? Do you know if you are getting connected to the database?
  2. [1] I'm trying to make a PDO connection into an object and pass the connection to outside classes. [2] I can do this when I put the PDO connection in a constructor but not when I put it in a public method. [3] I have the code pasted here : http://www.pastebin.ca/1360597 [4] I am monitoring this thread closely so please ask away if I can clarify anything. Thanks in advance
  3. RESULTS OF VAR DUMP string(18) "+OK 1218 octets " //var_dump($a) string(16) "+OK 1218 octets " //var_dump($b) I am pulling var $a off of a socket connection with the following code: $a=fgets($fp, 1024); And manually typing in var $b as a string. When I do a comparison test...they obviously aren't equal. Does anyone know what var $a could have that makes the string 2 characters longer?
  4. Does PHP have a print function that automatically breaks to the next line? i.e. => Java : println
  5. Actually, I have been able to write email clients in both IMAP and Sockets - but I don't have access to either extension from the server that I'm hosting the script on. I just need to know if you can do a curl_init that doesn't automatically go to http or ftp. in other words, I'm wondering if you can do the following in cURL: [1] fsockopen($server, 110); OR [2] imap_open ("{$server:110/pop3}INBOX", "user_id", "password");
  6. I'm wondering if anyone knows a way to hack the PHP cURL lib so that you can use it with POP3.
  7. Well, they tell me that I can install any extensions that I want...I just have to turn them on in the php.ini file and specify a file path. The problem is that I have to build them first, and I'm under the impression that I have to build the .so on the system its going to run on.
  8. What about just calling the extension in php.ini...like documented here http://us2.php.net/manual/en/ini.core.php#ini.extension [1] Is that slow also? [2] Who do you think is a better hosting company than goDaddy? I pay about $6 a month for shared hosting.
  9. -I'm not writing an extension, I'm just trying to include imap.so and sockets.so - both of which should be standard but which goDaddy has opted not to compile into php. -I don't have command line access like you do, so that won't work for me.
  10. I'm trying to build a socketed object (.so) that I can dynamically load with the php dl( ) function. My understanding of dynamic php extensions (not compiled into php) is that they are: WINDOWS SERVER => .dll filetype LINUX SERVER => .so filetype My hosting provider will allow me to dynamically load extensions on a linux environment, but I have to compile those extensions first. -I don't have shell access. -I have the extension source code(s) from php.net -I want to compile the extension source code into a .so (or download the .so from somewhere) and drop it into a directory in my hosting account so that (from there) I can dynamically load it. Questions: [1] Do you have to compile a php extension from the same linux distribution environment that you are going to run it in? [2] Is there any way to compile a .so file from Windows XP? [3] Does anyone know where I can download the: [3a] sockets.so [3b] imap.so extensions (already compiled)? /All feedback is welcome. Even smartass remarks. Just be funny.
  11. I just started working with PDO the other day and went through this. I don't think there is any kind of performance difference between the two...just that one is more spelled out in appearance than the other.
  12. I'm trying to install php_imap.so on my GoDaddy shared hosting account (Linux). [1] Does anyone know where I can download the php_imap.so file? [a-] I think this file is generally installed using a command line terminal, but I don't have this level of access on godaddy, so I have to drag and drop the file. [b-] I can't compile this file as an .so because I'm not running unix on my laptop. [2] Does anyone know if this code for the php.ini file is correct? Example PHP.INI CODE BELOW: php_imap=/extension_dir/php_imap.so
  13. You can't use a parameter for the WHERE clause. That's it. Probably because it doesn't have any optimization value when you do so.
  14. You can't use a parameter for the WHERE clause. That's it. Probably because it doesn't have any optimization value when you do so.
  15. Also, I just reset the error mode and got nothing from PDO when I ran my script. PDO::ERRMODE_EXCEPTION;
  16. DISCLAIMER: I'm not trying to spam. I put this up on the OOP board a few minutes ago and then noticed that it doesn't get a lot of traffic, so I'm reposting it here. I'm working on building prepared statements with the PHP PDO database class. http://www.php.net/manual/en/pdostatement.execute.php ============================ I'm using code snippets verbatim off of the PHP documentation page for execute(). I don't seem to have any problems at all with the code without placeholders. i.e. <?php /* Execute a prepared statement by binding PHP variables */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < $calories AND colour = $colour'); // $sth->execute(); $result = $sth->fetchAll(); print_r ($result); ?> When I print_r using the code above, the resulting array comes out fine. But as soon as I use the placeholder feature, I just get a blank array. I've run the code below on separate builds of PHP 5.2.2 and PHP 5.2.5 on different servers. <?php /* Execute a prepared statement by binding PHP variables */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour'); $sth->bindParam(':calories', $calories, PDO::PARAM_INT); $sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12); $sth->execute(); $result = $sth->fetchAll(); print_r ($result); ?> My code matches the PHP documentation perfectly, but I can't get the execute function to work properly. It's like the parameters aren't binding for some reason. Anyone have any ideas? I've run this code on WAMP and my GoDaddy hosting account with the same result each time. Thanks in advance!!
  17. I'm working on building prepared statements with the PHP PDO database class. http://www.php.net/manual/en/pdostatement.execute.php ============================ I'm using code snippets verbatim off of the PHP documentation page for execute(). I don't seem to have any problems at all with the code without placeholders. i.e. <?php /* Execute a prepared statement by binding PHP variables */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < $calories AND colour = $colour'); // $sth->execute(); $result = $sth->fetchAll(); print_r ($result); ?> When I print_r using the code above, the resulting array comes out fine. But as soon as I use the placeholder feature, I just get a blank array. I've run the code below on separate builds of PHP 5.2.2 and PHP 5.2.5 on different servers. <?php /* Execute a prepared statement by binding PHP variables */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour'); $sth->bindParam(':calories', $calories, PDO::PARAM_INT); $sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12); $sth->execute(); $result = $sth->fetchAll(); print_r ($result); ?> My code matches the PHP documentation perfectly, but I can't get the execute function to work properly. It's like the parameters aren't binding for some reason. Anyone have any ideas? I've run this code on WAMP and my GoDaddy hosting account with the same result each time. Thanks in advance!!
  18. I like PDO. http://www.php.net/manual/en/pdostatement.execute.php I want to use prepared statements, but I want to combine them with a method that allows me to pack the query string like so: $query = "SELECT $select_str FROM $from_str $where_str $group_str $having_str $sort_str $limit_str";
  19. Its from a PHP tutorial. The DB class was done in PHP 4. I didn't think there were any significant changes that PHP 5 would make...I'm going to try to merge this class with PDO. http://www.tonymarston.net/php-mysql/databaseobjects.html
  20. Find that and then you can coyly try to make me feel stupid.
  21. Ignace, I know where to find the PHP.net OO documentation. I just didn't see anywhere where people use a similar technique: new Class ('variable');
  22. Well, I have a database class like so: class Default_Table { var $tablename; // table name var $dbname; // database name var $rows_per_page; // used in pagination var $pageno; // current page number var $lastpage; // highest page number var $fieldlist; // list of fields in this table var $data_array; // data from the database var $errors; // array of error messages The way the class is written, you access the methods inside it by extending the class and sending the variables through a function. Like this: class Sample extends Default_Table { // additional class variables go here function Sample () { $this->tablename = 'sample'; $this->dbname = 'foobar'; $this->rows_per_page = 15; $this->fieldlist = array('column1', 'column2', 'column3', ...); $this->fieldlist['column1'] = array('pkey' => 'y'); et cetera ... } // end class constructor } // end class $s = new Samle(); $s->Sample(); Instead of extending Default_Table, I figure I'll just go: new Default_Table($tablename=" ", $db_name=" ", $rows_per_page=" "...) To me, that's simpler.
  23. Thank you very, very much. That was incredibly frustrating for me.
×
×
  • 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.