Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. gizmola

    PayPal

    Are you really sure you want to wed your business to paypal? I personally avoid it like the plague. There's almost nothing good about it from my point of view, either as a user or as a vendor, other than it offers shorter turn around for transfer of funds. For example, I am part of a coop that owns a server. Each year we pay one of the members money to cover our colocation costs for the year, and he pays the ISP. I went to transfer some money from my checking account, and of course that's going to take 2 business days to fund. Whoopeee. Then to make matters worse, because the guy has a merchant account of some sort, now he indicates that I'll be charged a fee for sending the money via paypal this year. Sweet. I'm really thinking of whipping out a check and a stamp this year instead, which is lame, but that's how paypal rolls apparently.
  2. gizmola

    .NET

    I really like PHP, but there are issues with the PHP market. For enterprise development, it's really a 2 horse race: .NET vs. Java. There are a lot of great things about .NET, and in particular .NET with C# that can make you a very productive developer. With that said, .NET pretty much weds you to the microsoft world. There's nothing wrong with that, but it's something you need to be at peace with going into it.
  3. Congrats on the interview -- step 1, but geez, maybe you should land the job before planning out the next 5 years of your life. I do wish you luck.
  4. Did you read the forum guidelines? The guidelines specifically state that you won't get help in modifying 3rd party scripts. Here you are asking for help modifying 2 different script packages, neither of which you seem to understand. > This is probably why you are not getting any help -- nobody wants to wade through all that.
  5. Foreign keys -- sure no problem. If you design it right, then updates to a brand would have no effect, because your normalized design would also use numeric keys to link product and brand together. In that way, changing for example, the name of a brand would not effect any products that were related to that brand, because the "brandname" column is in the brand table. Now, when you state that in deleting a brand you want to delete all related products, that is known as a cascading delete. Depending on the database, that can be set up automatically, or may require a trigger. In MySQL you can set up a cascading delete, assuming a few things, one of which was mentioned by priti: Assuming you're using MySQL: -You need to be using MySQL 5 -You need to have created your tables using the Innodb engine. -Your table declaration needs to include the ON DELETE CASCADE clause which would have been something like this in your definition of the product table: FOREIGN KEY (brand_id) REFERENCES brand(brand_id) ON DELETE CASCADE If you set this up properly, deleting a brand will delete all products of that brand. While cascading deletes are convenient for some things, they also represent a significant danger as a user could unknowingly wipe a lot of rows out of a database with one careless delete. Often you want to control this programatically. Caveat Emptor.
  6. An exchange server is an MTA just like any other MTA -- it will accept mail via SMTP. Keep in mind that the exchange server may need to be configured to allow the machine you're running your php script on, to relay mail through it, depending on how it's been setup, and what your network topography is.
  7. No, there's no way to do that because the pdf's are being rendered by the user's local computer. This raises the age old question of: can you show people information without having them see it? When you think on the conundrum, I"m sure you'll realize that this isn't possible --- you can't give someone a snack and not allow them to eat it, or for that matter to save a piece for their friend. You can, using certain libraries, generate pdf's on the fly that you password protect. This adds an extra barrier to the pdf and makes it that much harder for someone to distribute to the masses. If you *really* want to do this, there's a way, but what you're asking for is pretty much copy protection, and every form of copy protection ever invented to date has been broken.
  8. I have a lot of questions about what you're asking for, not to mention the structure of your database. For example, you imply you used a DATETIME column when you really only need a DATE column. This adds complexity, but basically, you can do a simple query like: SELECT thedate FROM holidays WHERE thedate >= CURDATE() AND thedate If that result set returns any rows, read it into an array. From there you'll have to figure out the format of the array, so that you match your php dates. As you loop through, you'll attempt to find the date in your array, and if you match, then don't render your button. One question that comes to mind is -- do you need 5 buttons regardless if the week has a holiday, or do you only show 4 in that case? Your code may need to be altered from a for loop to a repeat unil in that case.
  9. pdkv2 has the answer - your row has 2 columns because mysql_fetch_array creates both a numeric array of the columns of the row and an associative array. Since your query returns 1 column, when you try and do a count() on it, you get the answer of 2. I personally use mysql_fetch_assoc() which is a wrapper around mysql_fetch_array() that only returns the associative array version of the row. Really if you look at the php.net manual page for either function it has an example of how you should loop through the result set fetching rows until the set is empty, as this is fairly typical code. After your first fetch, you'd be able to do this: echo "Item num: $items['itemnum']";
  10. Your list is missing one of the biggest players right now: Symfony. http://www.symfony-project.org/
  11. You've made really obvious mistakes that would be easily remedied if you looked at the php manual for the functions you're using. Your code assumes along the way that things worked, and they probably didn't. Without checking, you won't have any information to help you narrow down the problem. How about this for a push in the right direction: include("dbinfo.inc.php"); $link = mysql_connect(localhost, $username, $password); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database) or die( "Unable to select database"); $query = "SELECT * FROM biotext"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } while ($row = mysql_fetch_assoc($result)) { print_r($row); }
  12. Nice site, however, I'd stick the wedding details at the top of the menu, as ostensibly that's why people are going to be visiting the site. I'm assuming here that this site is for family and friends you're invithing, so I think you should assume that many will skip your personal stories, and get right to the meat: where the wedding is, maps, details, registry.
  13. In general, nice job, looks good in Firefox. My main complaint would be some of the images you use could use a re-render. They need to be antialiased to take out the jaggies... there's no need for an intranet application to be trying to squeeze the quality down to 14.4k modem optimization. The borders should look smooth and natural -- as they are now, it's a bit distracting.
  14. Oracle publishes their price lists: http://www.oracle.com/corporate/pricing/pricelists.html Very few people pay anything close to retail, so take it with a grain of salt, as it's easy to get sticker shock when you see the pricing for Enterprise edition, lol. 
  15. Right. You need to read the php manual in regards to installing support for oracle. http://us.php.net/manual/en/ref.oci8.php Your phpinfo() should indicate that there is the oci8 is installed. There are also some instructions at the Oracle technology network for this stuff. The most recent server I did this for (linux) I used the oracle instant client.
  16. What might help you is to echo out the value of the query string you've created. echo "\n"; View the source for the page and see if the query is what you expect, and that it's something you can run in sqlplus. I'm thinking it isn't.
  17. Really depends on the version and OS. Let's say you're using Linux and 10g. su - oracle sqlplus "/ as sysdba" startup (exit sqlplus) lsnrctl startup
  18. You're not going to get a worthwhile answer without more information about what you're trying to do.  With that said, here's a few observations I have for you.  Oracle is a database that runs on just about every computing platform anyone is using, while mysql is predominately a unix program (although there is a windows and mac version).  Oracle has scalability features and a mature set of features that go substantially beyond what MySQL offers.  One of Oracle's great strengths is it's concurrency system, that by default offers versioning, known in Oracle terms as "read consistent views."  Basically, with Oracle, there is no need to have readers and writers contend with each other. For example, let's say that you are doing a query of a table of transactions in order to create a financial report.  The query needs to go through the entire table row, adding credits and subtracting debits.  In most databases, the solution to this problem is to put a "read" lock on the table, which would prevent updates from occurring to any of the rows of the table for the duration of the query.  If this was a large table, this locking period could really slow things down and be very undesirable for a high transaction system.  Suffice it to say, that Oracle doesn't require read locks of any kind, and that query runs fine and will not interrupt inserts, updates and deletes.  Oracle also offers highly functional stored procedures and triggers, including the ability to write sprocs in either pl/sql language or Java.  MySQL zealots love to debate this stuff, but point of fact there's a huge list of features Oracle has that MySQL doesn't, and probably won't anytime soon.  The thing that people typically point to is that MySQL's default mode (using the myisam engine) doesn't have support for transactions, or declarative referential integrity, both of which are meat and potatoes RDBMS features you find in about any other rdbms database (including Postgresql btw).  MySQL is a bit of an oddity in the relational database world.  It offers a unique feature that depending on how you look at it, is either a strength or a weakness: that of storage engines.  As I mentioned, MySQL's myisam engine doesn't support transactions, while the Innodb engine does.  This allows mysql to do some very cool things with specialized engines. Where PHP is concerned, MySQL has a property that works very well, in that PHP has page scope.  This means that PHP offers no persistence mechanism ... when a script runs it creates variables, and when that script is done, all the variables are garbage collected.  Because MySQL connections are very lightweight, there's almost no overhead in creating a MySQL connection, which works well with PHP's design. Oracle on the other hand, has a heavy connection process that can on the order of seconds.  Oracle has a session concept, and connections in general should be pooled and reused.  With Oracle, you make one connection if you need to do multiple queries, and issue the seperate queries using oracle sessions. Often people who don't understand this don't realize that they needed to use the ora_pconnect rather than the ora_connect.  There was almost no info on this in the old oracle client manual pages. Another key difference that helps with PHP is that MySQL's query execution process is far more lightweight in general use than Oracle's.  Oracle makes extensive use of query execution caching, however, the use of dynamically generated SQL statements as is common in PHP applications will result in very poor performance, because these statements will not be cached by Oracle.  Oracle requires the use of bind variables in order for Oracle to pull statements from it's query cache.  Many people find the work that you need to use bind variables to be tedious, although the increased interest in PHP security, and the development of PHP PDO are both developments that may have helped people appreciate the security benefits that can be had. Plainly speaking, PHP just didn't work very well with Oracle in the past, and was a bitch to get setup, requiring a pretty extensive understanding of Oracle, and the various client environment variables and client libraries.  In comparison, getting PHP setup with MySQL was simple and easy.  In the past couple of years, Zend entered into some agreements with Oracle post PHP 5, and work on integration with the Oracle library was stepped up significantly.  Part of that was a rewrite of the oracle client library to support 8,9 & 10 features, and BLOB types.  This client offers additional functions, as well as a variety of variables that allow you to tune connection caching, along with articles you can find on the Oracle Technology network, using PHP with Oracle is a lot more viable than it used to be.
  19. Did you do an explain plan and look at that first?
  20. Yes, this is a common design. There are several different paths depending on how you want to approach this. To tell the truth this is something that isn't Oracle specific at all, but comes down to basic web application design. In general there are frameworks out there that feature Model View Controller design pattern architectures that handle this. I'm not going to get into all that, but I figured I'd at least mention it as best practice. Assuming you want to keep it simple, the simplest solution is to write a new script which takes as a URL parameter, the ISBN number, or whatever primary key for the catalog you'd specify in your WHERE clause. So your url should be something like: echo ""; ?> In your showdetail.php, the first thing you would do is take this url parameter and set it to a variable you can then inject into your WHERE clause for the detail lookup. $isbn = (int) $_GET['isbn']; ?>
  21. I'm confused... where is the column that indicates which band these settings are pertinent to, or is this a cms application where the assumption is that someone will run this application on their website? The answer to your specific question is that I would probably just select all settings, and I would write a routine that would read all these settings into an array. With that said, if you want to stay with what you have, the 2nd approach is definately an improvement (one query vs. 2) .
  22. There's a few different ways to accomplish this. The first thing I noted is you used an unusual keying system where your service_id appears to be a letter. This is a bad design for many reasons, not the least of which is that have to manually figure out the next visit using either ascii numbering or some hard coded alphabet system. Your sample data also doesn't seem to make sense: for example you have the same car with two different visits on the same day. Did you really have the same car on the same day with two different service visits? Also do you really want the design to allow for only one thing to be done on one visit? I'm guessing not. If this is an academic exercist, then that is one thing, if it's a production system, then the problems with your design are more important to fix than the answer to this one query.
  23. Although technically even Data definition language (DDL) is a "query" that's only issued when the table is created. In selects and updates you would never use unsigned, as the concept of data typing of columns is not usually relevant once the table has been created. MySQL is similar to SQL Server in that it has byte length oriented numeric datatypes. The types match the number of bytes used to store the value, so in your example, the int type is a 4 bytes (32 bit value). Simple binary will reveal to you the largest value that can be stored with 32 bits. By default if you you don't specify at create time, that you want an UNSIGNED int, you will get a signed int, where one of the 32 bits is reserved to indicate whether the value is + or -. Effectively what this does is cut the maximum value range in half. I your example, you are creating the primary key of a table. More often than not, people will also define that column to be Auto Increment. With auto_increment you would never have a value that is minus, so it is a waste of storage to not used UNSIGNED as you lose 1/2 the potential maximum rows. This means that you would run out of keys at 2,147,483,647 rows rather than 4,294,967,295. Very few databases require that number of rows, so this is largely academic for most people, although the same principle works for smaller data types like the smallint (64k) or tinyint(256) values. One of the most important decisions you make in mysql design is correct data typing. The smaller and more efficient the size of an individual row, the more efficient the database will be, all other things being equal. For example, if I have a lookup table that is going to store types of fruit, it's worth asking the question of what is the largest number of fruit I expect to ever have in that table. In all probability, I will not be able to think of more than 256 different types of fruit, so an UNSIGNED TINYINT is a good type for the primary key of that table. As I relate that table to other tables in my database (think for example of a recipe database where I might indicate fruit and a quantity) that I may have thousands of rows of recipes that involve fruit, however in each one it only costs me 1 byte of storage to indicate the fruit as a foreign key.
  24. You need the Oracle jdbc driver. This sample code sums it up pretty simply I think: Connection connection = null; try { // Load the JDBC driver String driverName = "oracle.jdbc.driver.OracleDriver"; Class.forName(driverName); // Create a connection to the database String serverName = "127.0.0.1"; String portNumber = "1521"; String sid = "mydatabase"; String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid; String username = "username"; String password = "password"; connection = DriverManager.getConnection(url, username, password); } catch (ClassNotFoundException e) { // Could not find the database driver } catch (SQLException e) { // Could not connect to the database }
  25. Yes of course. The error is telling you the problem.  You start a while loop with a '{' and there's no '}' to end the loop.  Should be right before your mysql_close();
×
×
  • 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.