[PHP-DB] How to use the same MySQL Databse connection between tow different php page?
Well,I have to use the transaction on the MySQL 4.0.x, But as the manual said, I must use the same connection to the mysql server, but I could not do it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mssql_bind problem....
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-DB] PHP SMS for free
Someone can help me, please ? i'm looking for php sms for free, for my intranet, use proxy ?
RE: [PHP-DB] speeing up query and display...
John, I got it and it seems to work wonderfully. When you mentioned doing the whole process in one query I was sure a LEFT JOIN was going to be involved but to be honest.. I do not understand LEFT JOINS in the least.. where to apply them and why. Thanks so much for taking your valuable time to help. I am sure I'll be able to learn from what you've provided to take my developments that much further. Thanks once again. Aaron -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 20, 2003 4:48 PM To: Aaron Wolski Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] speeing up query and display... 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
[PHP-DB] Re: Help... PostgreSQL on Windows 98!
I've succeeeded with windows 2000 under cygwin.. Configuration took a lot of time and in the end however it was a bit slow.. so I ended up with an olde pentium 233 box with SUSE upon it. Works great pete Bruno wrote: Hi, I'm trying to use PostgreSQL on Windows98! Does anyone here succeded with it? Thanks Bruno (sorry.. my mistakes). -- 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....
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
[PHP-DB] export mysql table to .dbf
Hi all, does any one how export data from mysql to fox 2.0? I have to capture data from a php form and store in mysql database, and then export those data or generate a .dbf table. Thank´s a lot. Norma Ramirez
RE: [PHP-DB] in-line function?
Donny wrote: can we make simple codes in-line instead of function calls? or, it makes no help in PHP? Donny, can you please explain what you mean by this, perhaps with a code sample? I am not really sure what you are asking. Matthew Horn Principal Spielboy.com -- 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] mssql_bind problem....
Fetching the result as a array or object gives the data (a row returned from the database), but not the Return value of the stored procedure. The stored procedure is below if it helps - Stored Procedure -- CREATE PROCEDURE sp_StaffDetail @ShortName varchar(30) AS SET nocount ON SELECT TblStaff.StaffId, TblStaff.ShortName AS StaffSN, TblStaff.FullName AS StaffFN, TblStaff.Email , TblStaff.RetroDays FROM TblStaff WHERE TblStaff.ShortName = @ShortName AND TblStaff.Online = 'Y' IF @@Error 0 Return 0-- unspecified error ELSE Return 99 -- success GO -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 21 July 2003 14:43 To: A.J.Masterton Cc: '[EMAIL PROTECTED]' Subject: 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] mssql_bind problem....
I've managed to fix it from erroring by specifying the full mssql_bind command, I was looking at one of the comments under the mssql_bind that says if you Are sending a varchar you have to specify it's size so: mssql_bind($query, @ShortName, $StaffSN, SQLVARCHAR, FALSE, FALSE, 30); Works but, mssql_bind($query, @ShortName, $StaffSN, SQLVARCHAR, FALSE); Doesn't work. But the second bind: mssql_bind($query, RETVAL, $ret, SQLINT4, TRUE, FALSE); Doesn't give the correct return value, $ret is set as 1 earlier on in the code and is still 1 after the mssql_execute, I'm sure I'll work it out Eventually, thanks for the help. Andrew Masterton -Original Message- From: A.J.Masterton [mailto:[EMAIL PROTECTED] Sent: 21 July 2003 14:57 To: colbey; A.J.Masterton Cc: php-db Subject: RE: [PHP-DB] mssql_bind problem Fetching the result as a array or object gives the data (a row returned from the database), but not the Return value of the stored procedure. The stored procedure is below if it helps - Stored Procedure -- CREATE PROCEDURE sp_StaffDetail @ShortName varchar(30) AS SET nocount ON SELECT TblStaff.StaffId, TblStaff.ShortName AS StaffSN, TblStaff.FullName AS StaffFN, TblStaff.Email , TblStaff.RetroDays FROM TblStaff WHERE TblStaff.ShortName = @ShortName AND TblStaff.Online = 'Y' IF @@Error 0 Return 0-- unspecified error ELSE Return 99 -- success GO -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 21 July 2003 14:43 To: A.J.Masterton Cc: '[EMAIL PROTECTED]' Subject: 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
Re: [PHP-DB] export mysql table to .dbf
Norma, I have found the best strategy is to setup an ODBC link to an alternative to the database. As an example, I had a mysql database intranet, and I created an ODBC link to, with the MySQL ODBC drivers (from the mysql.com site), and then opened up Microsoft Access.Went file = get external data = import data, selected the tables, and bingo, they were in Microsoft Access, mdb format. I would expect you should be able to do the same thing with Fox 2.0, and any other database that you have a GUI for. I know most systems come with ODBC drivers for Foxpro, HTH ~Steve Norma Ramirez - TECNOSOFT wrote: Hi all, does any one how export data from mysql to fox 2.0? I have to capture data from a php form and store in mysql database, and then export those data or generate a .dbf table. Thank´s a lot. Norma Ramirez -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] export mysql table to .dbf
Thank´s Stephen, I gonna try it looks very useful... Norma Ramirez -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] htmlMimemail.php
Has anybody used this feature. I am trying to get it to send a file via email. It shows that it has found the file, but it will not send the file to the emails specified $mail['admin'] = [EMAIL PROTECTED]; $mail['from'] = [EMAIL PROTECTED]; $mail['subject']= Web Submission; $mail['text'] = Attached is your data, submitted on .date(m/d/Y).\n; $dir = dir($params['pdf_fldr']); while ($file_name = $dir-read()) { if (strpos($file_name, _at_) != false) {print match 13 :: . $file_name .\n; $mailer = htmlMimeMail(); $attach = $mailer-getFile($params['pdf_fldr']./.$file_name); $mailer-setSubject($mail['subject']); $mailer-setText($mail['text']); $mailer-addAttachment($attach, $file_name, 'application/pdf'); $mailer-setFrom($mail['from']); $result = $mailer-send(array($mail['admin'], str_replace(array('_at_','.com'), array('@','.com'), $ print \tmailed :: \n; $result = ($result == 1) ? 'Mail sent!br' : 'Failed to send mailbr'; unset($mailer); if ($params['pdf_mail'] != ) { $moved = copy($params['pdf_fldr'].$file_name, $params['pdf_mail'].$file_name); if ($moved != false) { print moved folder\n; } } unlink($params['pdf_fldr'].$file_name); } } When I look at the log that is created from the from the cron it tells me that was there and found, but it will not mail it out: X-Powered-By: PHP/4.1.2 Content-type: text/html match 13 :: ryan_at_hgilive.com.pdf So I am curious if anybody has played with something like this and knows where I am going wrong. I am pretty sure that it is something that I am going to kick myself for. Thanks Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] getting MySQL column header?
Hey all, I have a query (thanks John!)... $query = select t.manufacturer, t.id, t.colour, t.colourID, t.type, 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 ORDER BY t.colourID; $thread_manufacturer = ''; $result = db_query($query); while($thread = db_fetch($result)) { //DO STUFF HERE } How would one get the column name/header out of this query so that I could display it as the header for my columns? Is this even possible? Thanks! Aaron
Re: [PHP-DB] getting MySQL column header?
How would one get the column name/header out of this query so that I could display it as the header for my columns? Honestly, did you read the manual after I told you last time?? $num_fields = mysql_num_fields($result) for($x=0;$x$num_fields;$x++) { echo mysql_field_name($result,$x); } ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] getting MySQL column header?
Honestly, did you read the manual after I told you last time?? Umm.. am I missing something? I don't believe I've ever asked this question before? If so... my bad. I did have a gander at the manual and was unsure how I could grab the header info and not add an additional query to get this info. *shrugs* Thanks for the info, though! Aaron -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: July 21, 2003 4:24 PM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] getting MySQL column header? How would one get the column name/header out of this query so that I could display it as the header for my columns? Honestly, did you read the manual after I told you last time?? $num_fields = mysql_num_fields($result) for($x=0;$x$num_fields;$x++) { echo mysql_field_name($result,$x); } ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Find and Replace
Hi there everyone, I have a DB system which i've just rewritten for a travel website. Previously it used BR's for linebreaks but i've made it much more efficient. My problem it, there are 10+ travel guides which us BR's and I want to remove them on over 100 pages (In a MySQL DB). Using PHP, how can I write a simple script to go through all the entries for a column (Called articles) and remove all instances of br or BR ??? It would take far too long to do it page by page :-( Thanks for all your help everyone. Regards Chris Payne
Re: [PHP-DB] Find and Replace
Chris Payne wrote: I have a DB system which i've just rewritten for a travel website. Previously it used BR's for linebreaks but i've made it much more efficient. My problem it, there are 10+ travel guides which us BR's and I want to remove them on over 100 pages (In a MySQL DB). Using PHP, how can I write a simple script to go through all the entries for a column (Called articles) and remove all instances of br or BR ??? It would take far too long to do it page by page :-( I know this is a PHP list, but why use PHP? UPDATE table SET column = REPLACE(column,'BR',''); UPDATE table SET column = REPLACE(column,'br',''); -- ---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
Re: [PHP-DB] Find and Replace
Hi there, Ahhh thanks, that was a quick way to do it, I took the long way around LOL :-) I grabbed the data, did $article = str_replace(br, , $article); and then looped through all of the entries to change it, it seems to have worked though :-) Chris Chris Payne wrote: I have a DB system which i've just rewritten for a travel website. Previously it used BR's for linebreaks but i've made it much more efficient. My problem it, there are 10+ travel guides which us BR's and I want to remove them on over 100 pages (In a MySQL DB). Using PHP, how can I write a simple script to go through all the entries for a column (Called articles) and remove all instances of br or BR ??? It would take far too long to do it page by page :-( I know this is a PHP list, but why use PHP? UPDATE table SET column = REPLACE(column,'BR',''); UPDATE table SET column = REPLACE(column,'br',''); -- ---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
[PHP-DB] One last question on find and replace
Hi there everyone, Well I have it taking out the br and BR no problem, but there's one thing i've noticed. In the DB when I look at it, each line is seperated by a blank line, and each paragraph has 2 blank lines, how can I do the same with BR but to remove one of these line breaks out? Basically the 1 line break needs to dissapear and the text wrap, and where it's currently 2 line breaks it will be replaced with just a single one. I tried what I thought, which was the same with the BR but replacing the BR with /n OR with a nl2br but none of them appear to remove the blank lines / paragraph formatting. Any help would be appreciated :-) Chris
[PHP-DB] Inline extraction and exhibition of large objects
We have an internal document storage system that was developed over 6 months ago that uses PHP (4.2.0) on a Unix server with Apache to access a PostgreSQL database, with IE5.5 as the designated user browser. The system is used to store documents like .jpg, .doc, .html, .pdf, .xls etc, allowing users to search for relevant documents, downloading/viewing those documents they are interested in. This system has worked with no problems until 6-7 weeks ago when our administrators applied the Microsoft security patch Q323759 (MS02-047). Now IE5.5 and IE6 are unable to retrieve any documents that require another program to be opened for viewing, like PDFs and Word documents. On trying to access these documents the user is prompted to either Open or Save the document (an unwanted proecss, we want to just open every time where possible). Regardless of the option then chosen the following error is given: Internet Explorer cannot download 'filename' from 'server'. Internet Explorer was not able to open this Internet site. The required site is either unavailable or cannot be found. Please try again later. Please note that the 'filename' is being exhibited as the address to the page executing the download code (show_ind_doc.php?theid=185), and 'server' is the appropriate server name. Images like GIFs and JPEGs, and HTML documents still open OK as they are 'viewable' within IE, it's just those that require another program that don't work. This code still works in other browsers, like Netscape and Opera. The code is below, any assistance with configuring the 'header' sections would be appreciated, the other use contributed notes on the header section of php.net have not been able to help me at this time. ?php function do_con() { global $connection; $host = server; $user = username; $pass = password; $db = sedocs; $port = 5432; $connection = pg_connect (host=$host port=$port user=$user dbname=$db); if (!$connection) { die(Could not open connection to database server); } } do_con(); $id = $HTTP_GET_VARS[theid]; $result = pg_Exec($connection, select * from sedocs where id = .$id); $row = pg_fetch_row($result, 0); $num_rows = pg_num_rows($result); $id = $row[3]; $length = $row[6]; $filename = $row[7]; $doctype = $row[5]; header('Content-Type: '.$doctype); header('Content-Length: '.$length); header('Content-Disposition: inline; filename='.$filename.''); pg_exec ($connection, begin); $handle=pg_lo_open($connection, $id,r); $buffer=pg_lo_read($handle, $length ); pg_lo_close($handle); pg_exec ($connection, end); pg_close(); echo($buffer); ? Thanks very much Rob Robin Ellis Information Knowledge Department of Natural Resources and Mines PO Box 1167 Bundaberg QLD 4670 ph +61 7 4131 5771 fax +61 7 4131 5823 [EMAIL PROTECTED] The information in this e-mail together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any form of review, disclosure, modification, distribution and/or publication of this e-mail message is prohibited. If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] in-line function?
Matthew Horn wrote: Donny wrote: can we make simple codes in-line instead of function calls? or, it makes no help in PHP? Donny, can you please explain what you mean by this, perhaps with a code sample? I am not really sure what you are asking. Ohhh.. sorry for that. it's quite simple, i'm wondering if we can have something like those in-line functions in C++: class someCLASS { var $varLength; // other stuff inline function length() { return $this-varLength; } } i expect it will make PHP script speed up a bit, coding easier, etc... but not sure it will do or not. :) -- // Donny -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] in-line function?
Donny Lee wrote: Ohhh.. sorry for that. it's quite simple, i'm wondering if we can have something like those in-line functions in C++: class someCLASS { var $varLength; // other stuff inline function length() { return $this-varLength; } } i expect it will make PHP script speed up a bit, coding easier, etc... but not sure it will do or not. :) What would be the difference (besides putting the word inline in front of the function)? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] getting MySQL column header?
Hey John, This is another person asking the same question as I did.. thanks again for your help.. :) Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 4:24 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: Re: [PHP-DB] getting MySQL column header? How would one get the column name/header out of this query so that I could display it as the header for my columns? Honestly, did you read the manual after I told you last time?? $num_fields = mysql_num_fields($result) for($x=0;$x$num_fields;$x++) { echo mysql_field_name($result,$x); } ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] in-line function?
Leif K-Brooks wrote: Ohhh.. sorry for that. it's quite simple, i'm wondering if we can have something like those in-line functions in C++: class someCLASS { var $varLength; // other stuff inline function length() { return $this-varLength; } } i expect it will make PHP script speed up a bit, coding easier, etc... but not sure it will do or not. :) What would be the difference (besides putting the word inline in front of the function)? i'm not quite sure, so correct me if i'm wrong. in C++ definition, a length() statement, in this example, will be replaced directly by the value of $this-varLength at runtime, instead of passing control to the length() function, returning the value, exit and then returning control to up process. -- // Donny -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Inline extraction and exhibition of large objects
I'll bite.First of all, if Netscape / Opera browsers are running, you can be guarenteed that it is a problem with IE, especially since you just SP'd it. The URL for the fix you described is located at: http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-047.asp , which if you read - describes that it had a buffer-run in an Active-X component used to launch certain types.I'm not 100% sure, but it does make mention of: The patch eliminates the vulnerability by setting the kill bit on the affected ActiveX control. This action, which is discussed in more detail in Microsoft Knowledge Base Article Q240797 http://support.microsoft.com/default.aspx?scid=kb;EN-US;q240797, has the effect of preventing a particular ActiveX control from ever being executed within Internet Explorer, regardless of the security settings on the system. If I were looking into the problem, I'd take a look to make sure the patch didn't wipe out my mime settings for the formats you described, .pdf, .xls, etc. If your're not sure, simply point your browser with an absolute path to a file http://www.yourserver.com/yourfile.pdf and see if it opens properly. It might require that you re-image your machine, and test the patch before you apply it.You should slap your sys-admins knuckles for releasing a patch without testing it fully first :) Having said that, this is a PHP list and that's wy too much Windows talk :) HTH ~Steve Ellis Robin (Bundaberg) wrote: We have an internal document storage system that was developed over 6 months ago that uses PHP (4.2.0) on a Unix server with Apache to access a PostgreSQL database, with IE5.5 as the designated user browser. The system is used to store documents like .jpg, .doc, .html, .pdf, .xls etc, allowing users to search for relevant documents, downloading/viewing those documents they are interested in. This system has worked with no problems until 6-7 weeks ago when our administrators applied the Microsoft security patch Q323759 (MS02-047). Now IE5.5 and IE6 are unable to retrieve any documents that require another program to be opened for viewing, like PDFs and Word documents. On trying to access these documents the user is prompted to either Open or Save the document (an unwanted proecss, we want to just open every time where possible). Regardless of the option then chosen the following error is given: Internet Explorer cannot download 'filename' from 'server'. Internet Explorer was not able to open this Internet site. The required site is either unavailable or cannot be found. Please try again later. Please note that the 'filename' is being exhibited as the address to the page executing the download code (show_ind_doc.php?theid=185), and 'server' is the appropriate server name. Images like GIFs and JPEGs, and HTML documents still open OK as they are 'viewable' within IE, it's just those that require another program that don't work. This code still works in other browsers, like Netscape and Opera. The code is below, any assistance with configuring the 'header' sections would be appreciated, the other use contributed notes on the header section of php.net have not been able to help me at this time. ?php function do_con() { global $connection; $host = server; $user = username; $pass = password; $db = sedocs; $port = 5432; $connection = pg_connect (host=$host port=$port user=$user dbname=$db); if (!$connection) { die(Could not open connection to database server); } } do_con(); $id = $HTTP_GET_VARS[theid]; $result = pg_Exec($connection, select * from sedocs where id = .$id); $row = pg_fetch_row($result, 0); $num_rows = pg_num_rows($result); $id = $row[3]; $length = $row[6]; $filename = $row[7]; $doctype = $row[5]; header('Content-Type: '.$doctype); header('Content-Length: '.$length); header('Content-Disposition: inline; filename='.$filename.''); pg_exec ($connection, begin); $handle=pg_lo_open($connection, $id,r); $buffer=pg_lo_read($handle, $length ); pg_lo_close($handle); pg_exec ($connection, end); pg_close(); echo($buffer); ? Thanks very much Rob Robin Ellis Information Knowledge Department of Natural Resources and Mines PO Box 1167 Bundaberg QLD 4670 ph +61 7 4131 5771 fax +61 7 4131 5823 [EMAIL PROTECTED] The information in this e-mail together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any form of review, disclosure, modification, distribution and/or publication of this e-mail message is prohibited. If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network.
RE: [PHP-DB] Inline extraction and exhibition of large objects
Thanks Steve, Point taken about the PHP vs Windows mialing list. Having looked through mailing lists and tech docs (obviously unsuccessfully) I figured that the people more likely to have encountered this problem (and hence found a work around) would be those in the PHP/database interface community - I do apologise if this has caused any irritation. As a bit of further info (although it doesn't really solve the problem) all of these file types are still accessible through an absolute file path, as suggested below, and all MIME settings on the local machine appear to have been unchanged by the patch. The best I've been able to come up with as a solution is to use pg_lo_export to write out the files to temp directory on the server and then redirect the user there. It's not the most desireable solution and kind of defeats the purpose of a 'document depot', but it appears as though our hands are tied. Again, thanks for you suggestions Rob -Original Message- From: Stephen March [mailto:[EMAIL PROTECTED] Sent: Tuesday, 22 July 2003 2:10 PM To: Ellis Robin (Bundaberg) Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Inline extraction and exhibition of large objects I'll bite.First of all, if Netscape / Opera browsers are running, you can be guarenteed that it is a problem with IE, especially since you just SP'd it. The URL for the fix you described is located at: http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-047.asp , which if you read - describes that it had a buffer-run in an Active-X component used to launch certain types.I'm not 100% sure, but it does make mention of: The patch eliminates the vulnerability by setting the kill bit on the affected ActiveX control. This action, which is discussed in more detail in Microsoft Knowledge Base Article Q240797 http://support.microsoft.com/default.aspx?scid=kb;EN-US;q240797, has the effect of preventing a particular ActiveX control from ever being executed within Internet Explorer, regardless of the security settings on the system. If I were looking into the problem, I'd take a look to make sure the patch didn't wipe out my mime settings for the formats you described, .pdf, .xls, etc. If your're not sure, simply point your browser with an absolute path to a file http://www.yourserver.com/yourfile.pdf and see if it opens properly. It might require that you re-image your machine, and test the patch before you apply it.You should slap your sys-admins knuckles for releasing a patch without testing it fully first :) Having said that, this is a PHP list and that's wy too much Windows talk :) HTH ~Steve Ellis Robin (Bundaberg) wrote: We have an internal document storage system that was developed over 6 months ago that uses PHP (4.2.0) on a Unix server with Apache to access a PostgreSQL database, with IE5.5 as the designated user browser. The system is used to store documents like .jpg, .doc, .html, .pdf, .xls etc, allowing users to search for relevant documents, downloading/viewing those documents they are interested in. This system has worked with no problems until 6-7 weeks ago when our administrators applied the Microsoft security patch Q323759 (MS02-047). Now IE5.5 and IE6 are unable to retrieve any documents that require another program to be opened for viewing, like PDFs and Word documents. On trying to access these documents the user is prompted to either Open or Save the document (an unwanted proecss, we want to just open every time where possible). Regardless of the option then chosen the following error is given: Internet Explorer cannot download 'filename' from 'server'. Internet Explorer was not able to open this Internet site. The required site is either unavailable or cannot be found. Please try again later. Please note that the 'filename' is being exhibited as the address to the page executing the download code (show_ind_doc.php?theid=185), and 'server' is the appropriate server name. Images like GIFs and JPEGs, and HTML documents still open OK as they are 'viewable' within IE, it's just those that require another program that don't work. This code still works in other browsers, like Netscape and Opera. The code is below, any assistance with configuring the 'header' sections would be appreciated, the other use contributed notes on the header section of php.net have not been able to help me at this time. ?php function do_con() { global $connection; $host = server; $user = username; $pass = password; $db = sedocs; $port = 5432; $connection = pg_connect (host=$host port=$port user=$user dbname=$db); if (!$connection) { die(Could not open connection to database server); } } do_con(); $id = $HTTP_GET_VARS[theid]; $result = pg_Exec($connection, select * from sedocs where id = .$id); $row = pg_fetch_row($result, 0); $num_rows = pg_num_rows($result); $id = $row[3]; $length = $row[6]; $filename =
[PHP-DB] Wrapper classes
Hello all, I would like to know what is the best wrapper class for Mysql database interface. I need a kind of class which will return me results of query in an array and take care of all the cleaning of resources Thanks all Mohammad Saad