Re: [PHP-DB] What are your DB driven/template strategies?
On Mon, 1 Sep 2003, Colin Kettenacker wrote: The only alternative I came up with is to use .htaccess to redirect to my single initialization PHP file, but I am not sure if this is a good technique and of course it will only work on Apache. What about using php.ini's setting for prepend_file... prepend a file before all scripts that will handle all requests? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Upload multiple files?
Very simple... Call you files being uplaoded file1, file2, fileX in the HTML form.. [html] form method=post action=uploadprocess.php enctype=multipart/form-data input type=file name=file1 size=20 input type=file name=file2 size=20 input type=file name=file3 size=20 input type=submit name=submit value=submit /form [/html] Then process with code like this: [code] $STARTFILE = 1; $ONFILE = file . $STARTFILE; while (isset($HTTP_POST_FILES[$ONFILE])) { // Try! $SrcPathFile = $HTTP_POST_FILES[$ONFILE][tmp_name]; $SrcFileType = $HTTP_POST_FILES[$ONFILE][type]; $DstFileName = $HTTP_POST_FILES[$ONFILE][name]; // File Processing if (file_exists($SrcPathFile)) { // handle it } $STARTFILE ++; $ONFILE = file . $STARTFILE; } [/code] You may want to update the $HTTP_POST_FILES - $_FILES depending on PHP version, etc... Code from: http://php.dreamwerx.net/forums/viewtopic.php?t=6 good luck.. On Fri, 29 Aug 2003, Chris Payne wrote: Hi there everyone, I have created a newsletter system where you can do lots of nice things, one of the things is to be able to upload your images for the newsletter via the interface, unfortunately you have to do them 1 at a time. Is it possible to be able to select multiple images in 1 go? The image info is stored in a DB and the images themselves are on the server, this way I can do lots of nice things to manage the images that have been uploaded without having to access the filesystem too much (I love PHP and MySQL, makes it so easy). Thanks everyone. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP-DB Mailserver listed in spamcop?
http://spamcop.net/w3m?action=checkblockip=216.92.131.4 I just got a warning from PHP-DB mailserver that it cannot deliver to me because my server is blocking.. I checked and it looks like the list mailserver has been listed in spamcop by somebody? One of the list managers might want to take a look at it.. I'm sure I'm not the only person using spamcop and was suprised to see php-db listed in it.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] php mssql tcpip
Thoughts... I've used mssql via PHP on linux via tcp/ip 1433 with good success and performance.. Never used named pipes (I'm assuming you have to be an entire ms environment to do that) You might check into timing the process, perhaps the tcp/ip login is taking longer for authentication against the mssql server as it could be anybody connecting. Might add some timing code into that.. Also depending on how busy things are, be sure all your webservers + sql systems are hooked together 100MB or faster fully switched network.. , using named pipes, the sqlserver I would assum On Thu, 21 Aug 2003, JD wrote: I used to use named pipes to connect to a remote sql server. My nt department removed anonymous access account and now I have to use tcpip. Since the change the performance of the php quering has decreased. it takes more time to load the page. anything to look at in the sql configs or in the php.ini file to speed up the tcpip query? Any other ideas would be great. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Browser timing out.
Perhaps change it to an offline report? I've done that in the past, it get's scheduled or backgrounded and the results are either emailed to the person, or generated report stored in the database for quick load later on (user gets email that report is ready for viewing).. On Thu, 21 Aug 2003, J. Michael Roberts wrote: Okay, I'm going mildly crazy now. I've got a huge query that runs and does all sorts of things...but the problem is that it's taking longer than the proxy server will allow to generate the HTML, thus the browser (IE) reports a timeout. I've successfully executed the entire script using Netscape, but Netscape appears to be a little more forgiving with it's buffer size than IE does. I've tried using a flush() call, but the output that is displayed to the user is fairly small in comparasion to all the stuff that's going on in the background. Is there a way to get IE to display the data it has received on the fly? If not, is there a way to force IE (and netscape) to use a smaller buffer size? I've thought about filling up the output buffer with some hidden garbage, but that would just be silly. Any thoughts would be greatly appreciated. --JMR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Browser timing out.
Look at using server side compression, mod_Gzip or similar, PHP4.something also has compression handler built in.. When dealing with compressing raw HTML pages, very high compression levels can be reached.. Snippit from my mod_gzip+apache+php logs: ip.ip.ip.ip - - [21/Aug/2003:17:17:01 -0400] GET / HTTP/1.1 200 3450 http://referrer; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Hotbar 4.3.1.0) mod_gzip: DECHUNK:OK In:15234 Out:3450:78pct. ^^ 78% compression can cut data transfer down pretty quick! On Thu, 21 Aug 2003, J. Michael Roberts wrote: unfortunately, it's not something that can be offline. What's actually happening is the database is being queried for information that allows the PHP script to find data files to be sent to the printer. The query really isn't the problem, it's the sending of data when there is ALOT of data being sent. Being that the actual data sent to the browser is minimal, both IE and Netscape wait until there is something worth printing before it renders the output. Basically, I need a way to force IE and Netscape to render the output so that the user doesn't get a timeout notification. --JMR [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Perhaps change it to an offline report? I've done that in the past, it get's scheduled or backgrounded and the results are either emailed to the person, or generated report stored in the database for quick load later on (user gets email that report is ready for viewing).. On Thu, 21 Aug 2003, J. Michael Roberts wrote: Okay, I'm going mildly crazy now. I've got a huge query that runs and does all sorts of things...but the problem is that it's taking longer than the proxy server will allow to generate the HTML, thus the browser (IE) reports a timeout. I've successfully executed the entire script using Netscape, but Netscape appears to be a little more forgiving with it's buffer size than IE does. I've tried using a flush() call, but the output that is displayed to the user is fairly small in comparasion to all the stuff that's going on in the background. Is there a way to get IE to display the data it has received on the fly? If not, is there a way to force IE (and netscape) to use a smaller buffer size? I've thought about filling up the output buffer with some hidden garbage, but that would just be silly. Any thoughts would be greatly appreciated. --JMR -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] storing images in a table or in a directory
I store alot in databases.. when you deal with filesystem there can be issues with multiple webservers (need replication using something like rsync, etc).. I've used the db/filesystem link method before aswell but typically go with database nowdays.. You do have to query each time to get images out, be sure to look at sending correct cache headers to ensure clients don't keep coming back, or implement a caching system so that the webserver doesn't have to go back to the database for a query each time an image is requested.. On Wed, 20 Aug 2003, hicham kersit wrote: Hi, I have to manage a large amount of images uploaded by users on my site. Using php/mysql I don't know if I should store the images in a directory within the server or in a dedicated table. What is the most suited method? Thanks, best regards. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Conection to MS SQL 2000 from PHP in Linux
Few options.. compile using sybase-ct libraries.. or use something like freeTDS, or install odbc support.. I'd look at using freetds first.. On Thu, 7 Aug 2003, Jean Fernando Ortiz wrote: Hi all! I need to know how I must connect to MS SQL Server 2000 in a Win 2000 Server from my Internet Server with Linux, PHP 4.0.4 + Apache 1.3.19. Thanks for your help. -- PEM Jean Fernando Ortiz Arana Coordinador de TI Centro Escolar El Roble APDE - Guatemala -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sending data through FTP in PHP
FTP is used to tranfer files, typically not an array of data.. Depending what you mean.. From the sounds of things you need a protocol gateway instead of using FTP.. Unless you are loading that array of data into a file on the remote server at which point something will slurp it up and wait for the next cycle.. There are lots of built in FTP functions in PHP that are easy to use.. make sure you compiled PHP with --enable-ftp .. On Mon, 28 Jul 2003, OpenSource wrote: Hey Guys, I need some assistance on this FTP stuff. I've got an array of data that I need to send via ftp to another server eg. $linea = array($sport.$rot1.$r_vl); This information is gotten from my database and needs to be sent to the other server every 5 seconds. I need to connect to the server then wait for a byte where 0 = valid and 1 = invalid than I am suppose to send the $linea info. can you give some pointers as to how I should go about doing this or if you guys has any pre-written functions that I can follow through. This is the first time I'm dealing with FTP in PHP. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] speeing up query and display...
A bit offtopic .. But 3000 X any kind of size = a good amount of rendered html data to be transmitted.. I'd make sure your using some kind of compression module on the server like mod_gzip ... that would cut down on download time dramatically (Especially for low bandwidth users) 3000 rows isn't much and the actual query/build time is probably nothing compared to the transmission time.. On Sun, 20 Jul 2003, John W. Holmes wrote: Aaron Wolski wrote: Hi Guys, I have the following query which unfortunately has to grab all records in a table (well over 3000) to display in a multiple select box. Code: ?php $manufQuery = db_query(SELECT manufacturer FROM kcs_threads); while ($manufResults = db_fetch($manufQuery)) { ? option value=?php echo $manufResults[manufacturer]; ?/option ?php $threadQuery = db_query(SELECT id,colour,colourID FROM kcs_threads LIMIT 10); while ($threadResults = db_fetch($threadQuery)) { $threadselectQuery = db_query(SELECT * FROM kcs_patternthreads WHERE pattern_index='$id'); while ($threadselectResult = db_fetch($threadselectQuery)) { ? option value=?php echo $threadResults[id]; ? ?php if ($threadselectResult[thread_index] == $threadResults[id]) echo checked; ??php echo $threadResults[colour]; ?/option ?php } } } ? Can ANYONE see a way to speed up the query and displaying of the results? Take a while on High Speed and WY to long on Dialup. Like someone else said, your nested queries approach is horrible. Here's the way to do it with one query. $query = select t.manufacturer, t.id, t.colour, t.colourID, p.thread_index from kcs_threads t LEFT JOIN kcs_patternthreads p ON t.id = p.thread_index where p.pattern_index = $id OR p.pattern_index IS NULL; $old_manufacturer = ''; $result = db_query($query); while($row = db_fetch($result)) { if($old_manufacturer != $row['manufacturer']) { echo option value=\\{$row['manufacturer']}/option\n; $old_manufacturer = $row['manufacturer']; } echo option value=\{$row['id']}\; echo empty($row['thread_index']) ? '' : ' selected'; echo {$row['colourID']}/option\n; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql_bind problem....
I used to use MSSQL.. I've always called the stored procedures like you would call any method/function.. Have you tried just: // ** Query for user details *** // $query = sp_StaffDetail $var1, $var2; $result = mssql_execute($query); On Mon, 21 Jul 2003, A.J.Masterton wrote: DB server: MSSQL 2000 System: RedHat Linux 8.0 Driver FreeTDS: 0.61 PHP_rev: 4.3.2 (also tried on 4.3.1 gives same problem) Apache 2.0.46 I'm having a problem with mssql_bind under this configuration it appears not to be binding variables specified to the stored procedure and I was wondering If anyone has come across this before. I have noted from a post in the user manual from the 27th April '03 (http://uk.php.net/manual/en/function.mssql-execute.php) that there was a bug in 4.3.2-RC1 for the mssql_bind statement I was wondering If this could also be causing a problem with the binding to stored procedures. I've looked on the bug list and I don't see anything referencing this problem. The code we are using is: $StaffSN = crl26; // ** Init return value *** // $ret = 1; // ** Set database vars *** // $myServer = sqlserver; $myUser = blah; $myPass = xx; $myDB = InTime; // ** Link to database *** // $serverLink = mssql_connect($myServer, $myUser, $myPass) or die(Could not connect to SQL Server on $myServer); $db = mssql_select_db($myDB, $serverLink) or die(Couldn't open database $myDB); // ** Query for user details *** // $query = mssql_init(sp_StaffDetail, $serverLink); mssql_bind($query, @ShortName, $StaffSN, SQLVARCHAR); mssql_bind($query, RETVAL, $ret, SQLINT4); $result = mssql_execute($query); The execute gives the error: Warning: mssql_execute(): message: Procedure 'sp_StaffDetail' expects parameter '@ShortName', which was not supplied. (severity 16) in /home/shares/staffweb/index2.php on line 46 Warning: mssql_execute(): stored procedure execution failed in /home/shares/staffweb/index2.php on line 4 I have turned on Debug output on FreeTDS and it seems to show the stored procedure being called without any bound variables (as indicated by the error from PHP) I'm not quite sure if it is PHP not binding the variables or FreeTDS ignoring them, but by the post in the PHP manual (http://uk.php.net/manual/en/function.mssql-execute.php) this was working previously with FreeTDS 0.61 so I can only assume it's either PHP, a coding error by the developer, or a set-up problem with FreeTDS. Does anyone have any ideas? Many thanks Andrew Masterton -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] mssql_bind problem....
I found this old piece of code.. not sure if it will still work: function calcExc($baseid, $targetid, $amount){ $sql = sp_curr_convert $amount, $baseid, $targetid; $res = sybase_query($sql); $obj = sybase_fetch_object($res); return $obj-AMOUNT; } I don't remember what the code was inside the stored procedure.. but I'm assuming it must have defined AMOUNT .. calced and returned it.. You might also try using mssql_fetch_array .. and see what's returned in 0,1 positions in it.. On Mon, 21 Jul 2003, A.J.Masterton wrote: It does work like that, (if you change mssql_execute to mssql_query), but the developer wants the return value from the stored procedure. From what I can tell there is no way to get it by executing stored procedures with mssql_query. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 21 July 2003 13:51 To: A.J.Masterton Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] mssql_bind problem I used to use MSSQL.. I've always called the stored procedures like you would call any method/function.. Have you tried just: // ** Query for user details *** // $query = sp_StaffDetail $var1, $var2; $result = mssql_execute($query); On Mon, 21 Jul 2003, A.J.Masterton wrote: DB server: MSSQL 2000 System: RedHat Linux 8.0 Driver FreeTDS: 0.61 PHP_rev: 4.3.2 (also tried on 4.3.1 gives same problem) Apache 2.0.46 I'm having a problem with mssql_bind under this configuration it appears not to be binding variables specified to the stored procedure and I was wondering If anyone has come across this before. I have noted from a post in the user manual from the 27th April '03 (http://uk.php.net/manual/en/function.mssql-execute.php) that there was a bug in 4.3.2-RC1 for the mssql_bind statement I was wondering If this could also be causing a problem with the binding to stored procedures. I've looked on the bug list and I don't see anything referencing this problem. The code we are using is: $StaffSN = crl26; // ** Init return value *** // $ret = 1; // ** Set database vars *** // $myServer = sqlserver; $myUser = blah; $myPass = xx; $myDB = InTime; // ** Link to database *** // $serverLink = mssql_connect($myServer, $myUser, $myPass) or die(Could not connect to SQL Server on $myServer); $db = mssql_select_db($myDB, $serverLink) or die(Couldn't open database $myDB); // ** Query for user details *** // $query = mssql_init(sp_StaffDetail, $serverLink); mssql_bind($query, @ShortName, $StaffSN, SQLVARCHAR); mssql_bind($query, RETVAL, $ret, SQLINT4); $result = mssql_execute($query); The execute gives the error: Warning: mssql_execute(): message: Procedure 'sp_StaffDetail' expects parameter '@ShortName', which was not supplied. (severity 16) in /home/shares/staffweb/index2.php on line 46 Warning: mssql_execute(): stored procedure execution failed in /home/shares/staffweb/index2.php on line 4 I have turned on Debug output on FreeTDS and it seems to show the stored procedure being called without any bound variables (as indicated by the error from PHP) I'm not quite sure if it is PHP not binding the variables or FreeTDS ignoring them, but by the post in the PHP manual (http://uk.php.net/manual/en/function.mssql-execute.php) this was working previously with FreeTDS 0.61 so I can only assume it's either PHP, a coding error by the developer, or a set-up problem with FreeTDS. Does anyone have any ideas? Many thanks Andrew Masterton -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MS-SQL = Exec stored procedures
my experience in the past is just: $SQL = sp_runthis $param1, $param2, $param3; $RES = mysql_query($SQL); may have to prefix with exec like you mentioned... change sp_runthis to your procedure name... probably still works the same.. On Wed, 16 Jul 2003, Stephen March wrote: Anybody have code that WORKS (hehe) for executing a MS-SQL stored proceedure through PHP? exec viewFacilities() Thanks in advance! ~Steve -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database connection
undefined function means you don't have mysql support compiled in... prefixing any function with @ suppresses any error messages... On Thu, 17 Jul 2003, Martin wrote: I'm trying to use PHP 4.2.3 in a database application. ?php print Connected?; $dbcnx = mysql_connect(localhost,root,asda); if (!$dbcnx) { echo(pUnable to connect to database server./p); exit(); }else { print Connected!; } ? Gives Connected? Fatal error: Call to undefined function: mysql_connect() in /var/www/html/irm/test.php on line 3 While changing the line to $dbcnx = @mysql_connect(localhost,root,asda); is in the MySQL example simply prints Connected? and nothing more happens. My app isn't using the database (later on). Never had this problem on 4.0.x which makes me a bit confused. What am i doing wrong? /M. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating/Populating DB
This should be as simple as a PHP script that opens a connection to the destination server (with rights to do all actions you mentioned).. Opens a text file with all the SQL commands you want to issue, and starts firing them off at the server 1 by 1... Once you create the database, you need to make sure: - might have to grant rights to it - change it to the current database for that connection, or disconnect and reconnect to desired database. On Tue, 17 Jun 2003, Gerard Samuel wrote: Im trying to make an install script that would run under MSSQL. I could make it either create a database or populate a database. I can't seem to do both. Has anyone been able to create and populate a MSSQL database via php in one shot?? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Debugging/monitoring traffic to MySQL
On the MySQL server (could be the same machine) start mysql with -l arguement. Which enables connection and query logging.. YOu can just sit there and tail -f the server.log file to see all the querys/connections being executed in realtime... good look reading anything on a busy server ;) On Fri, 19 Jul 2002, Clive Bruton wrote: Is there a way to see the traffic between PHP and MySQL, ie see the statements/raw data that is sent between the two processes. I've tried running the MYSQL client, but there doesn't seem to be any obvious command to do this. Some other terminal process? I'm running MacOS X. TIA. -- Clive -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php