-
Posts
5,960 -
Joined
-
Last visited
-
Days Won
146
Everything posted by gizmola
-
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); }
-
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.
-
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.
-
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.
-
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.
-
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.
-
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
-
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.
-
[SOLVED] Speed up select statement
gizmola replied to stockton's topic in Other RDBMS and SQL dialects
Did you do an explain plan and look at that first? -
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']; ?>
-
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) .
-
[SOLVED] select distinct brings all the records from my table.
gizmola replied to sayedsohail's topic in MySQL Help
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. -
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.
-
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 }
-
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();
-
[!--quoteo(post=376098:date=May 22 2006, 11:28 AM:name=Celardore)--][div class=\'quotetop\']QUOTE(Celardore @ May 22 2006, 11:28 AM) [snapback]376098[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hey guys, I've been working on a new project for the past few days. [a href=\"http://www.heelyportal.com\" target=\"_blank\"]www.heelyportal.com[/a] The purpose of the site will be for heely skaters to be able to upload skating videos for all to be seen. Eventually it will also include generic tutorials, tips, forums etc. I seem to have a major issue with getting the sample video to play in IE... I don't know how to get around this, so if anyone has any tips!!! (quicktime plugin doesn't seem to function) Like I say, it's new so my feelings won't be hurt by a little critique of design / layout / function. Several features aren't working right now - just trying to sort the uploads but it's being a nightmare! Thanks for the tips. Celardore [/quote] I don't like your basic approach to "windowing". There's nothing wrong with a dark color scheme, although I would question the use of one for your particular site. Nevertheless, the way I like to think about a site is the site's "window" sits on top of a background. That background is sometimes an image, or just a basic color. The "window" should then be a different color, and one thing you should avoid is ever having panes that have the same color as the background color, because you're sending the message that there's a "hole" in your window. Your site is all black. So there's no sense that there is a "window" for your site. I don't think very many people will find it appealing, from a visual standpoint. You also have width and spacing issues. I have a large screen and the header, menu bar, and main content area don't line up.
-
Is this code secure or could it be made more secure?
gizmola replied to jasonc's topic in PHP Coding Help
[!--quoteo(post=373120:date=May 10 2006, 03:34 PM:name=jasonc)--][div class=\'quotetop\']QUOTE(jasonc @ May 10 2006, 03:34 PM) [snapback]373120[/snapback][/div][div class=\'quotemain\'][!--quotec--] <? $email = "abc@def.ghi"; $safeemail = mysql_real_escape_string($email); echo('.'.$safeemail.'.'); ?> i get the following .. meaning that it does not store the email, what exactly does this command do? how do i catch weather the email is invalid or if the text in the membersname variable is only letters upper or lower case. and if it is not i can tell them to correct it before it is sent to the database. thanks [/quote] Pretty much just what the manual page says it does... escapes a variety of characters. This is a *smart* function in that it is integrated into the mysql API so that it can be intelligent about the mysql character set being used. So in your example. you are missing a mysql database connection handle. The handle is an implied 2nd param, that you can specify. Either way you need a mysql database connection in your script to really see what the function does. -
[!--quoteo(post=373148:date=May 10 2006, 06:14 PM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 10 2006, 06:14 PM) [snapback]373148[/snapback][/div][div class=\'quotemain\'][!--quotec--] Ah cool. So... we all have them, but can only see our own unless we are a mod etc. Cool. Bit paranoid.... never noticed it before. ( and I know I can get a little hot headed at times) [/quote] It's a mechanism for group moderation that can eventually lead to automatic banning. When we have trouble with someone we can as mods raise their warning level. If it gets to 100% the person gets a ban. You can sleep easy, as your warn level is 0% -- you have never had a warning issued. When you do you recieve a PM, and the mod usually explains why they issued you the warning.
-
[!--quoteo(post=367348:date=Apr 21 2006, 03:41 PM:name=niza)--][div class=\'quotetop\']QUOTE(niza @ Apr 21 2006, 03:41 PM) [snapback]367348[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have a user registration area: new_member.php - script that executes the registration new_member.htm - contains the html registration form template.htm - html template If the user does not fill in all the required fields, new_member.htm is called in new_member.php, with the appropiate error message. Now, I have problems including my template.htm file. 1.If I include it in the new_member.htm, whenever the user does not fill in the required fileds, the error message are displayed on top of the template. 2.If I include it in the new_member.php, the form is not displayed properly. Any ideas? By the way, the script for user registration I am using is this: [a href=\"http://www.phpfreaks.com/tutorials/40/0.php\" target=\"_blank\"]http://www.phpfreaks.com/tutorials/40/0.php[/a] [/quote] I'm a bit confused as to what you're trying to do and why, and exactly what your problem is. Needless to say.. only PHP files will be parsed by the php interpreter server side. There is no way to include html files inside other html files without some server side language, so your description in that regards doesn't make much sense. Maybe it would help if you provided some source code.
-
You seem to be clear on the idea that php has page scope, and that a script creates variables and destroys them when the script is done executing. Thus there is a need for persistence/session. This isn't unique to PHP at all -- it's the nature of web development due to the design of HTTP. To demystify PHP sessions, they are basically files stored on the server. When you create a session variable by assigning a value to it, that value is stored in a session file on the server. Once a session variable is created in Script A, script B can use it, so long as you session_start(). The typical way this is achieved is that php assigns the browser/user a unique ID number called the session ID. This is what ties someone to a session. In most cases this ID is set as a cookie, which is why it appears that magically these otherwise invisible variables are persisting. The advantage over cookies alone is that the values don't have to cross the internet --- only the session ID is needed. Session variables are like any other variable in tnat you can change them or unset them. So your example above is exactly right. To remove a sessions variable called 'foo' -- unset($_SESSION['foo']); This example assumes that register globals is off, which it should be these days ;) Read the session portion of the php manual for more info.
-
Look into mysql_insert_id();
-
[!--quoteo(post=367315:date=Apr 21 2006, 02:05 PM:name=Michael2k5)--][div class=\'quotetop\']QUOTE(Michael2k5 @ Apr 21 2006, 02:05 PM) [snapback]367315[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello! I was wondering if there is a way to easilly pull something from an XML file onto a page. If you could help that would be great! Thanks here is the code [code]<?xml version="1.0" standalone="yes" ?> <SHOUTCASTSERVER> <CURRENTLISTENERS>0</CURRENTLISTENERS> <PEAKLISTENERS>3</PEAKLISTENERS> <MAXLISTENERS>32</MAXLISTENERS> <REPORTEDLISTENERS>0</REPORTEDLISTENERS> <AVERAGETIME>547</AVERAGETIME> <SERVERGENRE /> <SERVERURL>http://www.skynetx.com/radio/listen.php?dj=</SERVERURL> <SERVERTITLE>SkyNetX Radio</SERVERTITLE> <SONGTITLE>Rammstein - Laichzeit</SONGTITLE> <SONGURL /> <IRC>#shoutcast</IRC> <ICQ>0</ICQ> <AIM>N/A</AIM> <WEBHITS>3501</WEBHITS> <STREAMHITS>141</STREAMHITS> <STREAMSTATUS>1</STREAMSTATUS> <BITRATE>96</BITRATE> <CONTENT>audio/mpeg</CONTENT> <VERSION>1.9.5</VERSION> <WEBDATA> <INDEX>12</INDEX> <LISTEN>0</LISTEN> <PALM7>0</PALM7> <LOGIN>0</LOGIN> <LOGINFAIL>5</LOGINFAIL> <PLAYED>0</PLAYED> <COOKIE>0</COOKIE> <ADMIN>30</ADMIN> <UPDINFO>1027</UPDINFO> <KICKSRC>1</KICKSRC> <KICKDST>3</KICKDST> <UNBANDST>1</UNBANDST> <BANDST>1</BANDST> <VIEWBAN>2</VIEWBAN> <UNRIPDST>0</UNRIPDST> <RIPDST>3</RIPDST> <VIEWRIP>3</VIEWRIP> <VIEWXML>2408</VIEWXML> <VIEWLOG>1</VIEWLOG> <INVALID>4</INVALID> </WEBDATA> <LISTENERS /> <SONGHISTORY> <SONG> <PLAYEDAT>1145390097</PLAYEDAT> <TITLE>Rammstein - Laichzeit</TITLE> </SONG> <SONG> <PLAYEDAT>1145385323</PLAYEDAT> <TITLE>Rob Zombie - The Scorpion Sleeps</TITLE> </SONG> <SONG> <PLAYEDAT>1145385096</PLAYEDAT> <TITLE>Rob Zombie - American Witch</TITLE> </SONG> <SONG> <PLAYEDAT>1145384869</PLAYEDAT> <TITLE>Rob Zombie - 17 Year Locust</TITLE> </SONG> <SONG> <PLAYEDAT>1145384656</PLAYEDAT> <TITLE>Rob Zombie - Ride</TITLE> </SONG> <SONG> <PLAYEDAT>1145384649</PLAYEDAT> <TITLE>Rob Zombie - 100 Ways</TITLE> </SONG> <SONG> <PLAYEDAT>1145384467</PLAYEDAT> <TITLE>Rob Zombie - Foxy Foxy</TITLE> </SONG> <SONG> <PLAYEDAT>1145322513</PLAYEDAT> <TITLE>N.E.R.D. - Rock Star (Jason Nevins Remix Edit)</TITLE> </SONG> <SONG> <PLAYEDAT>1145322311</PLAYEDAT> <TITLE>Rob Zombie - American Witch</TITLE> </SONG> <SONG> <PLAYEDAT>1145322062</PLAYEDAT> <TITLE>Rob Zombie - Let It All Bleed Out</TITLE> </SONG> <SONG> <PLAYEDAT>1145321619</PLAYEDAT> <TITLE>Rob Zombie - The Devil's Rejects</TITLE> </SONG> <SONG> <PLAYEDAT>1145321411</PLAYEDAT> <TITLE>Rob Zombie - Foxy, Foxy</TITLE> </SONG> <SONG> <PLAYEDAT>1145314816</PLAYEDAT> <TITLE>System Of A Down - Forest</TITLE> </SONG> <SONG> <PLAYEDAT>1145314537</PLAYEDAT> <TITLE>System Of A Down - Holy Mountains</TITLE> </SONG> <SONG> <PLAYEDAT>1145301373</PLAYEDAT> <TITLE>N.E.R.D. - Rock Star (Jason Nevins Remix Edit)</TITLE> </SONG> </SONGHISTORY> </SHOUTCASTSERVER>[/code] yea so i want to easilly pull off parts of this, ex: <PEAKLISTENERS> that would be cool. [/quote] How to do this, and the relative ease with which it can be done is dependent on the version of php you have. If you have php5 then this should help you. [a href=\"http://us2.php.net/manual/en/ref.dom.php\" target=\"_blank\"]http://us2.php.net/manual/en/ref.dom.php[/a] PHP is a great tool for these types of things, and is well suited to webservices.
-
[!--quoteo(post=367313:date=Apr 21 2006, 02:03 PM:name=anthropos9)--][div class=\'quotetop\']QUOTE(anthropos9 @ Apr 21 2006, 02:03 PM) [snapback]367313[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello, My hosting company just changed servers and ever since then I've been getting this error: Here is the relavant code to go along with this: <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <?php require("includes/connect.php"); $id = $_GET['id']; $mid = $_GET['mid']; ?> Any help is welcome. Thanks. [/quote] I agree with bullmarky on this one. Those notices aren't errors, but rather warnings. The problem is that you're trying to reference 2 variables that won't exist unless they are passed to the script as url parameters. That may be a perfectly reasonable situation depending on what the script is suppossed to do.
-
How to build a url redirect that loads the file and sends it.
gizmola replied to flamerail's topic in PHP Coding Help
You're going to have to do a better job explaining what it is you want to do and why. -
Take a look at he many uses of the great substr function.