Re: [PHP-DB] how many databases should I create
On Mon, 18 Oct 2004 14:53:41 -0500, Norland, Martin [EMAIL PROTECTED] wrote: That all really depends on you. I would certainly say that, in general, any given database should only have one users table (with a separate table holding roles, permissions, etc.) In all likelihood - if all of these systems will be working together within a single company, and be built in a common way - you'll likely find it easier to have them all in one system. The counter to that, of course, is that information like payroll certainly shouldn't be easily accessed - so that might be one case where you might want a separate database. You'll really just have to weigh the benefits of having the data together (generally convenience, though there are reasons along the lines of joins and such) with the costs of any lost security or lax in responsibility. shouldn't a good rdbms take care of that though (with reasonable security measures)? can't you get fine grained user privs, at least with a proper db? postgres? Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INNO tables - will I have problems?
On Wed, 13 Oct 2004 15:26:12 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: right, so after you define the fields of the table, you add type=innodb simple as that dave Gerard Samuel [EMAIL PROTECTED] 10/13/2004 02:34 PM To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP-DB] INNO tables - will I have problems? [EMAIL PROTECTED] wrote: If the minimum requirement of mysql is version 4, then you will have no problems, as INNODB is the default type in mysql 4.x.x -- InnoDB is included by default in mysql 4 but the default is still MyISM. I looked over the manual, and I believe that you are correct. The default type is still MyISAM, but to create an INNODB table, one must specify it in the CREATE TABLE syntax... You can convert very easily afterwards also. Just a matter of a couple of lines of sql. You will have to add all the extra constraints and functionality after too... Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Dynamic pull down menus with PHP/Mysql
On Fri, 8 Oct 2004 01:12:06 -0400, GH [EMAIL PROTECTED] wrote: For a project in college that I had once did using ColdFusion and MSAccess (please dont kill me :)) I had the simular situation What I did was when the First Drop Down was changed... it had an onChange action or something of that nature (do not have my exact code infront of me) that went to a JS function which sent the value to another frame (window) you can use a hidden 1x1 iframe to conduct this... it then returned the values to the other page via JS I have to Dig for the code which unfortinately is buried at the moment On Tue, 5 Oct 2004 08:22:22 -0700, Ed Lazor [EMAIL PROTECTED] wrote: -Original Message- This may be a more javascript related topic, but it's also php/mysql. Apologies in advance if this is too far off topic. I'm trying to pull data from MySQL using PHP to sort the results into a form with a pull down menu. That works fine; I can do that. But I have a second pull down menu whose items need to display based on the item chosen from the first pull down menu. I can do two lists seperately, but I need the second pull down menu to be a result of the first, and I can't figure a way to do it in PHP without reloading the page, which I don't really want to do. Is this a javascript-dependent function, in that a js will have to make the call to the database via some sort of scripted php/mysql request? I really like to avoid javascript if possible, but I'm unsure there's an alternative. You're describing what I think is called Dynamic Options. Doing a Google for javascript dynamic option or javascript dynamic select will pull-up a few examples. Most of these solutions will expect you to load all data into javascript arrays. In other words, you don't have to reload the page, because all of the data is already present. This approach doesn't work well when dealing with large amounts of data. If you're running into this, use javascript's window.opener feature. It allows you to spawn a second window that retrieves data and sends it to the first window. Cripes! People are a bit slow today... what you are describing sounds like a hierselect to me: In pear,... http://pear.php.net/package/HTML_QuickForm/docs/3.2.1/HTML_QuickForm/_HTML_QuickForm-3.2.1_QuickForm_hierselect_php.html If you want to do it yourself just look at their code and get your inspiration from there - and yes, their solution is javascript based. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: [PEAR] Pear installation error
On 8 Oct 2004 17:03:15 -, Kevin Kraeer [EMAIL PROTECTED] wrote: I'm a one man band working for an ad agency...good times. At any rate, a client has requested that form values submitted through their website be written to an excel document. I investigated and decided PEAR was probably my best bet (there's an excel writer module if I understand correctly). So, I began what has become a quest to successfully install PEAR to our staging server. It's a Win2K Server running IIS and PHP 4.3.6. Whoever initially installed PHP 4 did not install PEAR along with it for some reason. So I decided to run the command line installer, with the following directories set up: Installation prefix - C:\PHP\pear Binaries Directory - $prefix\bin PHP code directory - $ prefix\docs Documentation base directory - $prefix\docs Data Base Directory - $prefix\data Tests Directory - $prefix\tests php.exe Path - C:\PHP\php.exe I then run the installer, and it does fine for a while. Then, after 'Extracting Installer' appears I get this: Warning: main(PEAR.php): failed to open stream: No such file or directory in C:\PHP\pear\Archive\Tar.php on line 21 Fatal error: main(): Failed opening required 'PEAR.php' (include_path='/C:\DOCUME~1\ADMIN~1.ORB\LOCALS~1\Temp\3\gop1c.tmp') in C:\PHP\pear\Archive\Tar.php on line 21 So it seems pretty clear that it's an include path problem to me. In my PHP.ini, go-pear added include_path=.;C:\php\pear So maybe I need to change that to someplace else? But I'm also not so sure about that forward slash in front of 'C:\DOCUME~`.' Any ideas or advice would be greatly appreciated. As I said, I'm on a solo mission over here - no IT guys, no programming dept. Just ME. heh. This is probably going to get me flamed terribly, or rather completely ignored... If it is just you, why on earth don't you upgrade to a real operating system? *nix + apache[1-2] + php is go beautifully together..., won't cost you anything in licencing (assuming you don't get a proprietary unix), and is much less likely to be troubled by viruses and whatnot... I say this because usually the installation of these three packages is done with about 5 clicks, and gets configured pretty much by itself (of course, if you want security and stuff, you have to change the config, but I am sure that is not different to IIS...). Just a suggestion. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] which DB to use?
On Fri, 01 Oct 2004 11:24:10 -0500, Matthew Perry [EMAIL PROTECTED] wrote: The latest version is still only alfa. Miles Thompson wrote: Check the MySQL docs - I *think* subqueries are supported in the latest version, but not triggers or stored procedures. But as I say, check. Alternatives? PostgreSQL or Firebird. HTH - Miles Thompson At 11:07 AM 10/1/2004, Matthew Perry wrote: Thank you very much for your help. If I had to choose between MS SQL Server or or mysql, which would you recommend? I prefer nested subqueries, triggers, procedures etc supported by SQL Server but am completely unfamiliar with any problems that may be accociated with using Microsoft's product and PHP. Ideally, I would use Oracle but it is probably outside of our budget. - matt Though I think you would be better to use postgres, as if you use the native tools you will get pretty good performance from php (instead of using an abstraction layer, I saw some nasty stats for pear db and postgres/mysql), don't dismiss oracle off-hand... I don't know what your price range is but my understanding is that their prices have dropped considerably in the last wee while. Otherwise use postgres, it has everything but a coffee-maker, which oracle is offering now, but is not really required. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: switch, if, or something to choose queries and echo formatting--PLEASE help
did that fix it? On Sun, 26 Sep 2004 18:56:59 +0200, Antoine [EMAIL PROTECTED] wrote: a href=subsections.php?section=design?page=animationimage/a I have just been testing and looking on a few fora (I know very little about php and html still) but you have two ?'s in that url. I believe the second one needs to be a . I did a little test of your logic and it seems to work if the second is replaced with the , but not if left as ?. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] [Newbie] switch, if, or something to choose queries and echo formatting--PLEASE help
So I attempted to do this: switch($_GET[page]){ $count=1; $table = mysql_query(SELECT * FROM thumbs,$db); echo(table border='0' cellspacing='1' cellpadding='1' width='300' align='center'tr); while ( $r = mysql_fetch_array($table) ) : if ($count==4){ echo (/trtrtd span='4'img src='images/spacer.gif' height='10' width='1'/td/trtr); $count=1; }else{ $id=$r[id]; $pic=$r[pic]; $thumb=$r[thumb]; $pname=$r[pname]; $pcom=$r[pcom]; echo(td align='left' valign='top' width='100'a href='$pic' target='blank'img src='$thumb' border='0' align='left'/abr clear='all'b$pname/bbri$pcom/i/td); $count++; } endwhile; break; Which did not work. I wondered if that was too much for the case or if you couldn't nest. PHP.net says The switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the switch block, or the first time it sees a break statement. Which made me think otherwise--but, hey, something's wrong. Yip, the logic of the switch statement. You simply don't have a case statement. I must confess I don't understand fully what you are trying to do yet but I don't think this is the way to go. The above extract should be enough to see what I mean... Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. You don't have one so... it won't ever start! Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql to postgres migration blues...
Hi, I am trying to get skilled up on postgres and decided to port a little movie database I wrote for mysql with php to access it. I used an auto converter for the bulk and then tried to tweak. The following code does not work but the error message it gives me is strange. It tells me that the connection string used on line 82 (where it calls pg_query in makelistboxentries) is invalid... but the same string/connection works just great in another script... any pointers appreciated. Cheers Antoine ?php /* Connect to database */ $link = pg_connect(dbname=movies host=localhost user=anton password=password) or die(Could not connect : . pg_result_error($link)); print TII div id=mybody Search by: BR TABLE border=1 cellpadding=10 cellspacing=10TR TD align=center ID: form name=input action=searchout.php method=post input type=text name=mychoice input type=hidden name = wherestring value= t1.ID = input type=hidden name = othertable value=movies input type=submit value=Submit /form /TD TD align=center Name: form name=input action=searchname.php method=post input type=text name=mychoice input type=submit value=Submit /form /TD/TR /TABLEBR TABLE border=1 cellpadding=10 cellspacing=10TR TII; makelistboxentries(Audio Language, lang, lang, audio , t2.movie = t1.ID and t2.lang = ); makelistboxentries(Subtitle Language, lang, lang, subtitles , t2.movie = t1.ID and t2.lang = ); makelistboxentries(Genre, Genre, Genre, moviegenre , t2.movie = t1.ID and t2.genre = ); print TINI /TD /TR/TABLE brbr PShow All:/P form name=input action=allout.php method=post input type=submit value=Submit /form /div div id=mymenu PA href=index.phpH3Back to main page/H3/A/P PA href=movie.phpAdd a movie/A/P Pa href=audio.phpAdd a movie's audio languages/a/P Pa href=subtitles.phpAdd a movie's subtitle languages/a/P Pa href=searchin.phpSearch the movies/a/P /div TINI; /* Close connection */ pg_close($link); function makelistboxentries($title, $mytable, $mycolumn, $othertable, $wherestring) { print TD align=\center\; print $title:; /* Perform SQL query */ $query = SELECT $mycolumn FROM $mytable; $result = pg_query($link,$query) or die(Query failed : . pg_result_error($link)); print form name=\input\ action=\searchout.php\ method=\post\; print SELECT NAME=\mychoice\; print option value=\zz\ SELECTEDSelect $title/option; while ($line = pg_fetch_array($result,$result_countt++,PGSQL_ASSOC)) { foreach ($line as $col_value) { print (OPTION VALUE=\.$col_value.\); print $col_value; print (/OPTION); } } print /select; print input type=hidden name = wherestring value=\$wherestring\; print input type=hidden name = othertable value=$othertable; print input type=\submit\ value=\Submit\; print /form; pg_free_result($result); } ? -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql to postgres migration blues...
On Thu, 23 Sep 2004 22:27:38 +0400, M Saleh EG [EMAIL PROTECTED] wrote: define the connection object as a global var in ur function function ( params) { global $ur_connection_obj; ... ... Damn you guys are quick! I like this list... declaring it as global didn't seem to work - global $link; /* Connect to database */ $link = pg_connect(dbname=movies host=localhost user=anton password=password) or die(Could not connect : . pg_result_error($link)); still didn't get it but passing it to the function did. I'll get there, but I pretty much copied and pasted all the php up until now so I have a little way to go... Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql to postgres migration blues...
On Thu, 23 Sep 2004 12:23:32 -0700, Andrew Kreps [EMAIL PROTECTED] wrote: On Thu, 23 Sep 2004 20:51:52 +0200, Antoine [EMAIL PROTECTED] wrote: declaring it as global didn't seem to work - global $link; /* Connect to database */ $link = pg_connect(dbname=movies host=localhost user=anton password=password) The global keyword works a little bit differently in PHP. You need to inform your function that your variable is global, as opposed to declaring it as global outside the function. Like: $link = database connection function processData () { global $link; ... Like i said, I'll get there ;-). Cheers! I hope you folks don't mind answering some rather basic questions... I am going to be starting some serious development soon and promise to search the docs first :-). I have just followed up on the suggestion of pear and it looks like a winner. That may mean a change of mailing list but all good for the moment. Cheers Antoine -- G System, The Evolving GUniverse - http://www.g-system.at -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] updating several rows with a single form
Hi all, Newbie's trouble: I can't figure out how to build a form and a script to update/delete several rows from a mysql table with a single form. I would need to list all the rows of a table, and be able to change the content of one column. With a single submission ... Any idea would be much appreciated Antoine -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php