RE: [PHP-DB] MySQL/PHP dropping characters
-Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED]] Sent: 23 September 2002 18:09 I've been running into a strange problem on my server with scripts that take form input and reformat it into SQL. It only happens with statements that insert or update data, the first four characters of the POST variables starting at the fourth variable passed are dropped. There are several bug reports at http://bugs.php.net for this -- basically, it seems to be related to transparent multi-byte string encoding (or something like that). If you don't need that support, you should turn it off -- search the bug database for the appropriate bugs, which will give you more information than my brain can! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] getting mysql_fetch_row into array
-Original Message- From: LSC Exhibits Department [mailto:[EMAIL PROTECTED]] Sent: 23 September 2002 18:17 Going through brain-lock here. From this query Select count(deptid) from maintenance group by deptid ,I get 11 rows. What I need to do is get an array like $a=array(315,11,43,67,415,32,25,63,93,46,76) from this query, so that $a[0]=315 $a[1]=11 $a[2]=43 and so on. The best I can get is ; $a[0][0]=315 $a[0][1]=11 $a[0][2]=43 and so on. Does anyone have any ideas??? Won't that do? If you don't want to refer to it using the additional first subscript every time, just create a reference to it: $b = $a[0]; then $b[$x] is the same as $a[0][$x]. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle connection problem after call to unserialize()
I made a class called OracleCon that is used to connect to an Oracle server and provide some certain queries to the database When i create an object of that class and serialize it to add it to a cookie, if i echo the $object-connection attribute i get a Resource id #2 When after redirection due to succefull login, i need to use this object to run the queries i get an error like this: Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in c:\program files\apache group\apache\htdocs\php\OracleCon.inc on line 66 If i echo the $object-connection attribute again i get a 0 If i echo the other attributes, they have the same values as they were set before serialization of the object What is wrong with this? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Oracle connection problem after call to unserialize()
-Original Message- From: Valantis Kamayiannis [mailto:[EMAIL PROTECTED]] Sent: 24 September 2002 12:37 I made a class called OracleCon that is used to connect to an Oracle server and provide some certain queries to the database When i create an object of that class and serialize it to add it to a cookie, if i echo the $object-connection attribute i get a Resource id #2 When after redirection due to succefull login, i need to use this object to run the queries i get an error like this: Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in c:\program files\apache group\apache\htdocs\php\OracleCon.inc on line 66 What is wrong with this? You can't carry a connection resource from one page to another -- you have to script an OCILogon (or OCIPLogon) in every page that needs to access your database. (This is true not just for Oracle -- all the databases supported in PHP that I've looked at work the same way.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] BLOB retrieval
Go to www.php.net and type in the name of your database (mysql, postgres, oracle, mssql) in the search box. That will give you a list of all the functions available. Getting a blob is generally the same as getting any other data type. Here's the paradigm: 1. connect to the database 2. execute SQL statement 3. parse/display results WIth MySQL, this is done with the following functions: // 1. connect to the database mysql_connect( host, user, pass ); mysql_select_db( db_name ); // 2. execute SQL statement $result = mysql_query( sql ); // 3. parse/display results $array = mysql_fetch_array( results of above query ); Here are a couple pretty decent tutorials on using PHP and MySQL that will probably get you started: http://uug.clubs.byu.edu/articles.php?show_article=11 and http://uug.clubs.byu.edu/articles.php?show_article=53 But, of course, PHP.net is the ultimate source of excellent documentation on php. You should rarely need to go anywhere else (including google) to get most php info. Good luck. Let us know how it goes! --Dave chekmate (remove) wrote: Hi everyone, I am new to php. I have searched the net trying to find a basic code snippet that will demonstrate how to download BLOB's from a database. I am not looking for a solution exactly, but rather a good starting point. I want to learn this on my own. Maybe with a little help. :) Is there a resource you could point me to? Or could someone post a small sample of code that will get me started? Thanks in advance, Tim Eberly -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Searching for Datagrid
Paolo Zani [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi All! I'm searching for Datagrid component for php and mysql. Something like java ones. Does anyone knows one? Thanks Paolo Have a look at http://phplens.com/ It's a commercial software component. Regards, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC?
Hi there everyone, I have always used MySQL with PHP without any problems using the standard MySQL connection functionality. Is it possible to connect to a MySQL DB via ODBC? If so, what would the PHP Connection string be? I am curious as my email server allows you to use external databases for users accounts and I figure this way I could write a PHP script to control users email accounts. Thanks everyone, sorry if this sounds like a stupid question, not used ODBC before so even though I know quite abit about PHP/MySQL, I know diddly about ODBC :-) Chris Payne
Re: [PHP-DB] Oracle connection problem after call to unserialize()
I made a class called OracleCon that is used to connect to an Oracle server and provide some certain queries to the database When i create an object of that class and serialize it to add it to a cookie, if i echo the $object-connection attribute i get a Resource id #2 When after redirection due to succefull login, i need to use this object to run the queries i get an error like this: Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in c:\program files\apache group\apache\htdocs\php\OracleCon.inc on line 66 You cant't serialize a object that uses as a member a resource( let's say an handler ).When PHP end the script, it will close all handler's used( database connecitons, files, etc ). You have to store the login information in a session var or in the database. If i echo the $object-connection attribute again i get a 0 If i echo the other attributes, they have the same values as they were set before serialization of the object Handler's are not serializable var's. Miguel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: ODBC?
First make sure you have installed the MyODBC Driver Then make a odbc DSN to the MySQL database. Finally try something like this: odbc_connect($DSN_Name,$UserName, $Password) or die(Could not connect to the datasource); Hope this helps... Chris Payne [EMAIL PROTECTED] escribió en el mensaje 000801c263d1$2cf7fec0$f7fea8c0@chris">news:000801c263d1$2cf7fec0$f7fea8c0@chris... Hi there everyone, I have always used MySQL with PHP without any problems using the standard MySQL connection functionality. Is it possible to connect to a MySQL DB via ODBC? If so, what would the PHP Connection string be? I am curious as my email server allows you to use external databases for users accounts and I figure this way I could write a PHP script to control users email accounts. Thanks everyone, sorry if this sounds like a stupid question, not used ODBC before so even though I know quite abit about PHP/MySQL, I know diddly about ODBC :-) Chris Payne -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] CONNECT BY in mysql.
Go to http://www.thickbook.com and have a look at Julie Meloni's excellent tutorials. She uses MySQL and the whole process is documented and explained. There are also tutorials at www.php.net, and on WebMonkey, WeberDev, Zend ,etc. HTH - Miles Thompson At 05:23 PM 9/24/2002 +, Smita Manohar wrote: hii all... being new to php and mysql, i dont know can we use CONNECT BY in mysql. can anyone pls explain with example? thnx and regds, smita. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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] Copying or duplicating tables
Perfect. I thought there had to be some simple way to do that. Thanks a lot, Mark Rankin, Randy wrote: create table duplicatetablename as select * from mytable -Original Message- From: Mark Lee [mailto:[EMAIL PROTECTED] ] Sent: Tuesday, September 24, 2002 2:04 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Copying or duplicating tables In MySQL: I am looking for an easy way to create a table that will be identical to another table in the same database (except the table name, of course). I do not necessarily need the data duplicated, just the table structure. It seems like there should be some type of duplicate_table() or copy_table function, but have not found one. Any suggestions? Thanks, Mark -- 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
FWD: [PHP-DB] Copying or duplicating tables
-- Original Message -- From: Mark Lee [EMAIL PROTECTED] Date: Tue, 24 Sep 2002 13:04:12 -0600 In MySQL: I am looking for an easy way to create a table that will be identical to another table in the same database (except the table name, of course). I do not necessarily need the data duplicated, just the table structure. It seems like there should be some type of duplicate_table() or copy_table function, but have not found one. Any suggestions? Thanks, Mark -- 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: password function
When using aggregate functions in sql, it is good to name that expression using the AS keyword. Try this: $result = mysql_query(select password(.$_POST['password'].) AS pword); while ($p = mysql_fetch_array($result, MYSQL_ASSOC)){ $pswrd=$p['pword']; } Also, like David said, you should also have exception handlers (need not be advanced). If you're like me and hate having to type too much, chuck your db stuff in a function. A very simple one would be doing this (this is not tested, by the way): function query($sql){ return mysql_query($sql) or die(Error: . mysql_error()); } Then to call it, simply $sql = select password(.$_POST['password'].) AS pword; $result = query($sql); Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mysql vs postgresql
Hi peoples, The company I'm about to partner with for hosting my websites is using postgresql for their database server. I currently use mysql for all of mine. What I'm trying to find out is peoples experiences using postgresql, any plusses or minusses, is it worth using these guys or finding another company that will use mysql instead? Most of the sites are being rewritten at the moment anyway so changing the code isn't really a factor for me. Thanks in advance, -gav. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Mysql vs postgresql
Hi peoples, The company I'm about to partner with for hosting my websites is using postgresql for their database server. I currently use mysql for all of mine. What I'm trying to find out is peoples experiences using postgresql, any plusses or minusses, is it worth using these guys or finding another company that will use mysql instead? Most of the sites are being rewritten at the moment anyway so changing the code isn't really a factor for me. Thanks in advance, -gav. This comparation is a bit old but I think a lot still applies http://www.phpbuilder.com/columns/tim2705.php3 -- Adam Alkins http://www.rasadam.com --
Re: [PHP-DB] incrememnting an array
On Fri, 2002-09-20 at 16:49, John Coder wrote: On Fri, 2002-09-20 at 05:41, Martin Adler wrote: I hope the little script bellow helps you greet Martin ? $arr = array('a','b','c','d','e','f','g','h'); $arr2[] = $x = array_shift($arr); $arr2[] = $y = array_shift($arr); $arr2[] = $y; while($arr) { $arr2[] = $x.$y .= array_shift($arr); $arr2[] = $x.$y; } echo implode(',',$arr2); echo 'pre'; print_r($arr2); echo '/pre'; ? Unfortunately this concatates the numbers instead of summing them I need it to sum them.even if I type cast it to int it still concatates them. what I need is from the array: array(0,23,2,15,1,14,1,43,22) a new array having: array(0,23,23,25,25,40,40,41,41,55,55,98,98,120) think of angle and ) being the beginning 23 being the end then 23 being the begging of an angle haveing 2 degress so I need it to go to 25 and so forth. hope this explains it better. Getting back to those that helped. I ende up splitting the arrays one for start and one for end. I then added 0 to start and subtracted the last from start. here is the code I ended up with: $a=array(); while($d=mysql_fetch_array($start_angle_query)) { $a[]=$d[0]; } //copies mysql_fetch_array into an array $b=array(); $b =$a; // make two arrays one for start of angle 2nd for end of angle $degree_adjuster=360/array_sum($b); //constant for circle array_unshift($a,0 ); // add 0 for start angle $start_angle=array(); // new array to hold values for start vector $end_angle=array(); //new array to hold values for end vector array_pop($a); //trim one array for start so numbers don't end on 360 while($a) //iterate till array is empty { array_push($start_angle,(end($start_angle)+ $a[0])); /*enter numbers in array $start_angle adding the last number in array and adding the first number from modified original array*/ array_shift($a);//delete first value of array } while($b) { array_push($end_angle,(end($end_angle)+$b[0])); array_shift($b); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php