Re: [PHP-DB] Advice for dataupload
Addressed to: Michael Andersson [EMAIL PROTECTED] [EMAIL PROTECTED] ** Reply to note from Michael Andersson [EMAIL PROTECTED] Fri, 12 Apr 2002 11:58:31 +0200 Jason Wong [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED]... On Monday 08 April 2002 19:15, Michael Andersson wrote: What happens to a blob field with lets say a image when dumping a mysql table to a file? I don't use BLOB fields. You try it and let me know ;-) Well now i tried, and it doesnt work at all, just so you know :) So now i have to fugure out a way to dump the table with blob:s in it to a file cause my isp dont allow me to dump to another mysql dbase over the net or any other way exept for a file... The FROM ISP doesn't allow it. What about the TO ISP? If you can get them to allow access from the old server: $Con1 = mysql_connect( 'oldhost', 'olduser', 'oldpassword' ); mysql_select_db( 'olddbname', $Con1 ); $Con2 = mysql_connect( 'newhost', 'newuser', 'newpassword' ); mysql_select_db( 'newdbname', $Con2 ); $R1 = mysql_query( SELECT * FROM tablename, $Con1 ); while( $Data = mysql_fetch_array( $R1 ); mysql_query( INSERT INTO tablename ~data~, $Con2 ); } Of course you will need to translate '~data~' into a valid SET or VALUES() block for each table, but this may allow you to get your data out of the old ISP's server without their help. Rick Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_num_rows
Hello All, I am struggling to understand why my query throws an error the code as below $link = mysql_connect ( db.localhost.org, $user , $pass ); if ( ! $link ) die ( Couldn't Connect to Mysql Server ); print Sucessfully connect to server p; $query = select * from users .where screen_name='$screen_name' . and passwd=password('$passwd'); $result = mysql_query($query, $link); if (mysql_num_rows($result) 0 ) When executed you get a little message back like this one Warning: Supplied argument is not a valid MySQL result resource in /usr/local/share/doc/apache/trial/authmain.php on line 20 What does this generally mean as I have noted that others use this syntax so what is my issue ? Any help or pointers to references would be most appreciated. Thanks Luke K -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: LOBS with CURSOR_SHARING=FORCE gives core dump
On Thu, Apr 11, 2002 at 06:09:02PM +0800, John Lim wrote: Hmm, I have also been having similar problems with LOBs. However it might not be cursor_sharing=force, because on my Win 2000 oracle, LOBs work fine with PHP with this parameter set. However on our Sun server, PHP crashes as you mention (yes cursor_sharing=force is set here too). PS: this is set in init.ora. could one of your please send me a backtrace o fthis crash? see: http://bugs.php.net/bugs-generating-backtrace.php re, tc Prince [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have the following php code. If I add the parameter CURSOR_SHARING=FORCE in my init.ora and while executing the program I get the Segmentation fault. $ /usr/local/php4/bin/php -q curshare.php Segmentation fault (core dumped) Is there any work-around for this? Is this a bug? This seems to be happening only when LOB with returning clause is present. I tested a similar program from C program and is fine. Note: currently I have set the parameter (CURSOR_SHARING=FORCE ) only in the program/session level. Thanks, Prince. $ cat curshare.php #!/usr/local/php4/bin/php -q ? //program name curshare.php $conn = OCILogon($dbuser, $dbpass, $dbname); //This is added to affect only the current session. $sql = alter session set cursor_sharing=force; $stmt = ociparse($conn,$sql); OCIExecute($stmt,OCI_DEFAULT); $lob = OCINewDescriptor($conn, OCI_D_LOB); $sqlstmt = insert into blob_test ( packageid, packagebody ) values('12344321123efd', EMPTY_BLOB()) returning packagebody into :packagebody; $stmt = OCIParse($conn, $sqlstmt) ; OCIBindByName($stmt, ':packagebody', $lob, -1, OCI_B_BLOB); OCIExecute($stmt, OCI_DEFAULT); OCICommit($conn); OCIFreeDesc($lob); OCIFreeStatement($stmt); OCILogoff($conn); ? -- 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: mysql_num_rows
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Hello All, I am struggling to understand why my query throws an error the code as below $link = mysql_connect ( db.localhost.org, $user , $pass ); if ( ! $link ) die ( Couldn't Connect to Mysql Server ); print Sucessfully connect to server p; $query = select * from users .where screen_name='$screen_name' . and passwd=password('$passwd'); $result = mysql_query($query, $link); if (mysql_num_rows($result) 0 ) When executed you get a little message back like this one Warning: Supplied argument is not a valid MySQL result resource in /usr/local/share/doc/apache/trial/authmain.php on line 20 What does this generally mean as I have noted that others use this syntax so what is my issue ? Any help or pointers to references would be most appreciated. This generally means there is a problem with your SQL syntax; add to your mysql_query line 'or exit(mysql_error()' and see waht you get. mysql_error should return a descriptive error message from mysql. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Closing curly brackets?
on 4/12/02 11:15 PM, Jennifer Downey at [EMAIL PROTECTED] appended the following bits to my mbox: I believe it has something to do with the first while statement's closing curly bracket placement but I can't seem to get it in the right place. Hi Jennifer, The first thing you should do is properly indent your code. If you do so, you'll be sure to find the missing bracket. Basically, for each new block, tab out again. It really helps to use a programmer's editor with syntax highlighting like vim or BBEdit. Here's an example using your code: === $id = $HTTP_GET_VARS[id]; $query = SELECT id, name, image, quantity, type FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $iid = $row['id']; $image = $row['image']; $name = $row['name']; $quantity = $row['quantity']; $type = $row['type']; if ($iid == $id) { $display_block =CENTERimg src=$image border=0brfont size=2$nameBR$quantityBR$type/font/CENTER; echo $display_blockBRBR; if ($type == food) { //if book or weapon is present then set an option and include in the form later $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION; } else { //if any other type is present then set a blank $thisoption=;} } // end option if statement } // end id if statement /* More code after this point */ } // end while if statement. === Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mysql_num_rows
I ran into the same problem on a script yesterday.. It turns out that one of the vars in my mysql_connect() command wasn't assigned.. It gave me no indication of this so I hadn't thought to look there.. I just happened to be reading back through the whole page to see what I could find and noticed that I hadn't set the var at the top.. Something else that I noticed in your code is that there doesn't seem to be a mysql_select_db() call.. Unless that is somewhere else in the code and just not shown here, you'll need it I believe.. Just a couple thoughts, Bob Weaver Luke Kearney [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello All, I am struggling to understand why my query throws an error the code as below $link = mysql_connect ( db.localhost.org, $user , $pass ); if ( ! $link ) die ( Couldn't Connect to Mysql Server ); print Sucessfully connect to server p; $query = select * from users .where screen_name='$screen_name' . and passwd=password('$passwd'); $result = mysql_query($query, $link); if (mysql_num_rows($result) 0 ) When executed you get a little message back like this one Warning: Supplied argument is not a valid MySQL result resource in /usr/local/share/doc/apache/trial/authmain.php on line 20 What does this generally mean as I have noted that others use this syntax so what is my issue ? Any help or pointers to references would be most appreciated. Thanks Luke K -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Closing curly brackets?
Thank you Paul, I have asked about atutorial on proper code formatting and got back a tutorial that was extremely hard to understand. While lots of people have screamed at me for my coding format no one has supplied an understandable answer. That is until this morning. The first thing you should do is properly indent your code. If you do so, you'll be sure to find the missing bracket. Basically, for each new block, tab out again. Thought that was the best tutorial I could ever get. Short and sweet and oh so easy to understand. I am using HTML_Kit as it has the same features as all the othere editors (color coding and such) but it also has a lot more. I can get plugins for anything I would ever need. Except a formatting tutorial ;) Thank for your help Jennifer Paul Burney [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 4/12/02 11:15 PM, Jennifer Downey at [EMAIL PROTECTED] appended the following bits to my mbox: I believe it has something to do with the first while statement's closing curly bracket placement but I can't seem to get it in the right place. Hi Jennifer, The first thing you should do is properly indent your code. If you do so, you'll be sure to find the missing bracket. Basically, for each new block, tab out again. It really helps to use a programmer's editor with syntax highlighting like vim or BBEdit. Here's an example using your code: === $id = $HTTP_GET_VARS[id]; $query = SELECT id, name, image, quantity, type FROM {$config[prefix]}_my_items WHERE uid={$session[uid]} ORDER BY id; $ret = mysql_query($query); while($row = mysql_fetch_array($ret)) { $iid = $row['id']; $image = $row['image']; $name = $row['name']; $quantity = $row['quantity']; $type = $row['type']; if ($iid == $id) { $display_block =CENTERimg src=$image border=0brfont size=2$nameBR$quantityBR$type/font/CENTER; echo $display_blockBRBR; if ($type == food) { //if book or weapon is present then set an option and include in the form later $thisoption=OPTION VALUE=\feed\Feed my pet\n/OPTION; } else { //if any other type is present then set a blank $thisoption=;} } // end option if statement } // end id if statement /* More code after this point */ } // end while if statement. === Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.344 / Virus Database: 191 - Release Date: 4/2/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: mysql_num_rows
$link = mysql_connect ( db.localhost.org, $user , $pass ) or die ( Couldn't Connect to Mysql Server ); $db = mysql_select_db( $dbname, $link ); $query = SELECT * FROM users WHERE screen_name = '$screen_name' AND ... That should work.. Bob Luke Kearney [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello All, I am struggling to understand why my query throws an error the code as below $link = mysql_connect ( db.localhost.org, $user , $pass ); if ( ! $link ) die ( Couldn't Connect to Mysql Server ); print Sucessfully connect to server p; $query = select * from users .where screen_name='$screen_name' . and passwd=password('$passwd'); $result = mysql_query($query, $link); if (mysql_num_rows($result) 0 ) When executed you get a little message back like this one Warning: Supplied argument is not a valid MySQL result resource in /usr/local/share/doc/apache/trial/authmain.php on line 20 What does this generally mean as I have noted that others use this syntax so what is my issue ? Any help or pointers to references would be most appreciated. Thanks Luke K -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL to Email and Line Breaks
I have a form where someone enters the body of an email message into a textarea part of a form to be sent out to a list. Then a script retrieves the body and sends it via email. However I can't get line breaks to show up (I'm using MS Outlook) even if I enter the \n into the textarea form and those \n show up in the database data. I must be missing something. Thanks for any help. Jeff Oien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL to Email and Line Breaks
check out nl2br() function [newline to break] http://www.php.net/manual/en/function.nl2br.php olinux Jeff Oien wrote: I have a form where someone enters the body of an email messageinto a part of a form to be sent out to a list. Then a script retrieves the body and sends it via email. However I can't get line breaksto show up (I'm using MS Outlook) even if I enter the \n into the textarea form and those \n show up in the database data. I must be missing something. Thanks for any help.Jeff Oien-- PHP Database Mailing List (http://www.php.net/)To unsubscribe, visit: http://www.php.net/unsub.php __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL to Email and Line Breaks
This isn't what I'm looking for because the output is to email not HTML. What I would like is the natural line breaks in the form input to be preserved and then result in line breaks in the email without having to add any \n, which didn't work anyway. Jeff Oien check out nl2br() function [newline to break] http://www.php.net/manual/en/function.nl2br.php olinux Jeff Oien wrote: I have a form where someone enters the body of an email messageinto a part of a form to be sent out to a list. Then a script retrieves the body and sends it via email. However I can't get line breaksto show up (I'm using MS Outlook) even if I enter the \n into the textarea form and those \n show up in the database data. I must be missing something. Thanks for any help.Jeff Oien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MySQL to Email and Line Breaks
You need a wrap= within your textarea.. You may need a couple if the browsers haven't come together on it yet.. But you can check it out here: http://www.blooberry.com/indexdot/html/tagpages/t/textarea.htm Just scroll down to wrap and check it out.. BTW, this seems like HTML help rather than PHP help.. Later, Bob Weaver Jeff Oien [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form where someone enters the body of an email message into a textarea part of a form to be sent out to a list. Then a script retrieves the body and sends it via email. However I can't get line breaks to show up (I'm using MS Outlook) even if I enter the \n into the textarea form and those \n show up in the database data. I must be missing something. Thanks for any help. Jeff Oien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: MySQL to Email and Line Breaks
I tried wrap=hard already. I should have mentioned that. Sorry if this is off topic. Jeff Oien You need a wrap= within your textarea.. You may need a couple if the browsers haven't come together on it yet.. But you can check it out here: http://www.blooberry.com/indexdot/html/tagpages/t/textarea.htm Just scroll down to wrap and check it out.. BTW, this seems like HTML help rather than PHP help.. Later, Bob Weaver Jeff Oien [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form where someone enters the body of an email message into a textarea part of a form to be sent out to a list. Then a script retrieves the body and sends it via email. However I can't get line breaks to show up (I'm using MS Outlook) even if I enter the \n into the textarea form and those \n show up in the database data. I must be missing something. Thanks for any help. Jeff Oien -- 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] Re: MySQL to Email and Line Breaks
On the wrap= option, I have an HTML reference that mentions that IE4 used wrap= off | physical | virtual.. i don't know if it supports it still but you might try it.. Bob Jeff Oien [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I tried wrap=hard already. I should have mentioned that. Sorry if this is off topic. Jeff Oien You need a wrap= within your textarea.. You may need a couple if the browsers haven't come together on it yet.. But you can check it out here: http://www.blooberry.com/indexdot/html/tagpages/t/textarea.htm Just scroll down to wrap and check it out.. BTW, this seems like HTML help rather than PHP help.. Later, Bob Weaver Jeff Oien [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a form where someone enters the body of an email message into a textarea part of a form to be sent out to a list. Then a script retrieves the body and sends it via email. However I can't get line breaks to show up (I'm using MS Outlook) even if I enter the \n into the textarea form and those \n show up in the database data. I must be missing something. Thanks for any help. Jeff Oien -- 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