Re: [PHP-DB] Manipulate an image automatically
What is the quickest way to manipulate an image? With ImageMagick from PHP: ?php exec('convert my_image.jpg -gravity southeast -annotate 0 'My Text' result.jpg'); ? Lot's of good examples here: http://www.cit.gu.edu.au/~anthony/graphics/imagick/annotating/#watermarking -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] flash/php problem
Actually, I don't see why either method would work: The SWF is in a static HTML page. It requests an mp3, and loads it without having to refresh. So it needs an mp3 returned, not another SWF. Updating the DB from the SWF call sounds cool, but serverside wise requires the .htaccess updated to instruct .swf requests from that dir to be read as PHP. The PHP script would need to update the DB then open the mp3 and write the correct headers before returning it. What's the AMFPHP deal? Flash Remoting. Action Message Format. Like SOAP but better :D Tony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] flash/php problem
This question isn't really a PHP-DB thang is it? Anyway, it sounds like you have a lot of swfs on the page. One for each song, is that right? In that case your best bet would be something like what you already have: embed src='play.swf?ID=74...' i.e. push the variable into flash from the page that contains it. If you only have a small amount of info the swf needs you can just keep on with the theme ID=74URL=yourmama.comTITLE=YoMama etc. If you want to pull a lot more information from the DB after the page has loaded then you should take a look at PHPObject or AMFPHP. Hint, AMFPHP is a lot more robust and faster. And don't forget that you need to write the vars to a Param tag too. Tony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] flash/php problem
how can i update my DB through Flash, using PHP. The easy way... Flash: var info:String = YoMama; var id:Number = 12; getURL(http://myserver.com/my_db_update_page.php;, _self, GET); PHP [my_db_update_page.php]: ?php include_once('db_connection_script.php'); if ($_GET['info'] $_GET['id']){ $id = addslashes($_GET['id']); $info = addslashes($_GET['info']); $sql = update table_name set info='$info' where id='$id'; mysql_query($sql); } ? This won't tell you if there has been an error during the update. If you need confirmation use AMFPHP. Tony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] flash/php problem
On second thoughts you probably better off with load variables. Flash: var info:String = YoMama; var id:Number = 12; loadVariables(http://myserver.com/my_db_update_page.php?id=+id+info=+info+;, this); PHP [my_db_update_page.php]: ?php include_once('db_connection_script.php'); if ($_GET['info'] $_GET['id']){ $id = addslashes($_GET['id']); $info = addslashes($_GET['info']); $sql = update table_name set info='$info' where id='$id'; mysql_query($sql); if (!mysql_errno()) { print 'result=good'; exit; } } print 'result=bad'; ? The function for checking the result is in the flash manual: Actionscript Language Reference loadVariables() Tony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] flash/php problem
query(update hitcounter set plays = plays+1 where file = {$_GET['file']}); header(Location: play.swf?file={$_GET['file']}); Sorry I didn't read this thread thoroughly enough. This looks like a good solution to me. You just need to have the swf make the request and return the mp3 to the swf not a reference to another swf. query(update hitcounter set plays = plays+1 where file = {$_GET['file']}); if (!error) header(Location: {$_GET['file']}.mp3); Tony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sybase CALL statement problems
When retrieving ODBC results from Sybase SQL Anywhere 6 and 9 from a CALLed procedure, the output to the browser is being arbitrarily truncated. ?php $DataSourceUserID = user; $DataSourcePassword = pass; $DataSourceName = source; $ODBCConnect = odbc_connect($DataSourceName,$DataSourceUserID,$DataSourcePassword); $CallSQL = CALL mladselmeans( '', 0, , 0, , 0, , 'mladsite', 1 ); $CallTest = odbc_exec( $ODBCConnect, $CallSQL ); odbc_result_all($CallTest); ? The resulting output does contain proper data, but as I said, it simply gets chopped off at a seemingly random point (I have had it chop anywhere from 1500-25000 characters off). The amount of truncation seems to vary depending on the results of the CALL, and when the results are the same, the truncation is the same. Perhaps the strangest thing is that I know for a fact that all of the data is being returned by Sybase... If I use output buffering and send the contents of the buffer to a file before the end of the script, all of the data makes it into the file, but still not to the browser. Trying to free the odbc resource or close the connection results in no output at all. ANY thoughts on this matter would be appreciated. Anthony Robins Using PHP 4.3.4 on Windows 2000 Server. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sybase CALL statement problems
I have checked my logfiles, and everything seems to be running smoothly and error free. The truncation occurs wether I use the odbc_result_all function or something like: WHILE( odbc_fetch_row( $CallTest ) ): FOR( $ii = 1; $ii = odbc_num_fields( $CallTest ); ++$ii ): PRINT (odbc_field_name( $CallTest, $ii ) . = . odbc_result( $CallTest, odbc_field_name( $CallTest, $ii ) ) . br); ENDFOR; PRINT (brbr); ENDWHILE; So it is not a problem with odbc_result_all. I have compared the source of the resulting page with the output buffering generated file and it is definitely truncating, no -- or span display=none or anything similar... In one case, the browser page source was 12,196 characters in length compared to 37,127 characters in the output buffer file. As you said, there are some 'hackish' things that I have tried such as tacking on several thousand characters of whitespace to the end of the output, which still truncates, but ends up truncating in the middle of the whitespace... I refuse to resort to something like this. The parameters for mladselmeans? nothing too fancy, just passing it a bunch of minimum and maximum values for various lookups and calculations that the CALLed statement does... Anthony Robins Original Message From: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: Re: [PHP-DB] Sybase CALL statement problems Date: Tue, 29 Mar 2005 09:33:53 -0600 Anthony Robins wrote: When retrieving ODBC results from Sybase SQL Anywhere 6 and 9 from a CALLed procedure, the output to the browser is being arbitrarily truncated. ?php $DataSourceUserID = user; $DataSourcePassword = pass; $DataSourceName = source; $ODBCConnect = odbc_connect($DataSourceName,$DataSourceUserID,$DataSourcePassword); $CallSQL = CALL mladselmeans( '', 0, , 0, , 0, , 'mladsite', 1 ); $CallTest = odbc_exec( $ODBCConnect, $CallSQL ); odbc_result_all($CallTest); ? The resulting output does contain proper data, but as I said, it simply gets chopped off at a seemingly random point (I have had it chop anywhere from 1500-25000 characters off). The amount of truncation seems to vary depending on the results of the CALL, and when the results are the same, the truncation is the same. Perhaps the strangest thing is that I know for a fact that all of the data is being returned by Sybase... If I use output buffering and send the contents of the buffer to a file before the end of the script, all of the data makes it into the file, but still not to the browser. Trying to free the odbc resource or close the connection results in no output at all. A number of possibilities come to mind - some hackish unfortunately. You say with output buffering the contents make it into the file, but not the web browser. Have you checked your logfiles to see if there is anything - perhaps the script is terminating early, etc. Print something after the table as well, see if that doesn't help. It certainly sounds like something is being buffered. There are reports that this function doesn't return the total number of rows correctly, but nothing more on that as to whether that indicates a problem or not. http://www.php.net/manual/en/function.odbc-result-all.php Also - you may want to view the source, or open that output buffering generated file in a web browser - and see if the same problem persists. It could just be bad data inside the database that's causing for e.g. !-- or span display=none or who knows what - to make it *appear* that the content is truncated. Obviously - you could try something hackish where you output buffer to a file, then emit the file to the browser - but if its all getting into the file I'd say the problem lies elsewhere, and that *shouldn't* work anyway, or if it does it's just a buffering problem in the first place. definitely check all logs. twice. Incidentally, what is with the parameters to mladselmeans - it looks very strange :) cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- 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] ODBC Column Name Truncation
When retrieving ODBC results from Sybase SQL Anywhere 6 and 9, the column names are being truncated to 31 characters. -- ?php $DBN = 'thedbn'; $UID = 'theuid'; $PWD = 'thepws'; $CONN = odbc_connect( $DBN, $UID, $PWD ) or die( Cannot connect to $DBN.); $sql = select * from crap; $result = odbc_exec( $CONN, $sql ); for( $i = 1 ; $i = odbc_num_fields( $result ) ; $i++ ) { $name = odbc_field_name( $result, $i ); ${$name} = odbc_result( $result, $name ); print( $i: $name - ${$name}\n ); } ? Result: 1: key - 4 2: a_really_long_name_that_is_long - 5 3: longer_name - 6 I expected #2 to have the name: a_really_long_name_that_is_longer_than_31_characters -- This happens even if the column name is simply specified using sql 'AS' (i.e. select column as a_really_long_name_that_is_longer_than_31_characters from crap would still return a_really_long_name_that_is_long as the column name). Using PHP 4.3.4 on Windows 2000 Server. Have also tried on SUSE Linux as well as with PHP 5. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Inserting a large number of rows into mySQL
I'm writing an app where I must insert a large number of rows into a mySQL database individually. All the rows are related to each other, so I need to ensure that integrity is maintained. In the event that one of the inserts fails, I need to be able to roll back all the prior inserts. What is the best way to insert the rows individually, yet still have this ability? The rows will be inserted by looping though an array in PHP. Thanks. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle/PHP question...
Yes, you need to recompile PHP: ./configure --with-oci8=[your_oracle_home] -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 1:58 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Oracle/PHP question... I am now trying to setup connectivity to a remote Oracle database for my PHP/Apache web server. I am attempting to verify connectivity to the database by: ?php $connection = OCILogon(user, password) or die (Unable to logon to database.); ? I have installed the Oracle client on the system, and I have also setup the ORACLE_HOME and ORACLE_SID environment variables. Unfortunately at this point I am not even able to make a successful connection to the Oracle database. I am currently receiving the following error: Fatal error: Call to undefined function: ocilogon() in /www/DW/oratest.php on line 10 Do I need to recompile PHP to be Oracle aware or something? What is it I am missing at this point? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple Inserts with mySQL
hmm, I guess that would work. There is no way to have mySQL check for integrity for me is there? I read in a SQL book a while ago about wrapping multiple inserts in a select statement, that way if any part of the statement failed the whole thing would be rolled back. From my research though, it doesn't look like mySQL supports this. Am I right here? So far it looks like your idea could be the most reliable suggestions I've gotten, so I'll start working on that for now. Thanks. - Anthony Peter Beckman wrote: Try this: $stack is an array of hashes: $stack[0] = array(0=tablename, 1=insertid()); For each insert you do, push an anonymous array on $stack which includes the tablename and insertid of the insert. Then as you continue your inserts, if any of them fail, call a function which takes that array $stack, and iterate through it, deleting the rows you just inserted. (see mysql_insert_id() function to get the insert ID) If none of them do fail, then you are in the clear. Either unset $stack or ignore it. Peter On Wed, 13 Nov 2002, Anthony wrote: I have to drop a lot of data into mySQL from PHP. It will go into quite a few different tables. How can I maintain integrity of the entire insert? I need to do about a dozen inserts on four tables and I need to insure that all the inserts are successful or that none of them get done. I'm sort of new at this, so please help me out. Thanks. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple Inserts with mySQL
hmm, I guess that would work. There is no way to have mySQL check for integrity for me is there? I read in a SQL book a while ago about wrapping multiple inserts in a select statement, that way if any part of the statement failed the whole thing would be rolled back. From my research though, it doesn't look like mySQL supports this. Am I right here? So far it looks like your idea could be the most reliable suggestions I've gotten, so I'll start working on that for now. Thanks. - Anthony Peter Beckman wrote: Try this: $stack is an array of hashes: $stack[0] = array(0=tablename, 1=insertid()); For each insert you do, push an anonymous array on $stack which includes the tablename and insertid of the insert. Then as you continue your inserts, if any of them fail, call a function which takes that array $stack, and iterate through it, deleting the rows you just inserted. (see mysql_insert_id() function to get the insert ID) If none of them do fail, then you are in the clear. Either unset $stack or ignore it. Peter On Wed, 13 Nov 2002, Anthony wrote: I have to drop a lot of data into mySQL from PHP. It will go into quite a few different tables. How can I maintain integrity of the entire insert? I need to do about a dozen inserts on four tables and I need to insure that all the inserts are successful or that none of them get done. I'm sort of new at this, so please help me out. Thanks. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] upload data to MySql
Just wrote an app that does this myself. Loads inmages/movies/audio and what not into a database. I've posted the code below, feel free to try it out. This file does all the uploading. It took me a while to figure out how to do this, so don;t worry it it seams like it's tough. I actualy store the files dirrectly in the databse in a longblob, it may be better to save the files in a folder (how I most people do it). Feel free to ask any questions you have. The app is in beta right now, it will go on www.supras.com when its done. HTH - Anthony ?php /* add.php -- part of the SOGI website media module writen by Knightrider version 1.0 9-24-02 This script will alow a user to upload files into the database */ // lets include some files so that this crap will work include 'database.inc'; include 'functions.inc'; // get some info from the config record so we know about upload settings getConfig(); //echo preDiag mode:BR; //print_r($HTTP_POST_VARS); if (empty($_POST['short']) || empty($_FILES['newfile']) || empty($_POST['gen']) || empty($_POST['category'])) { ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head titleSOGI Media Module - Upload a file/title link rel='stylesheet' type='text/css' href='media.css' /head body table border='0' width='100%' tr td width='50%' valign='top'class='pageheader' Media - Add a file /td td width='50%' /td /tr /table HR class='headertxt' table width='500' class='border' tr td align='center' form method='post' action='add.php' enctype='multipart/form-data' Upload an Image File Please fill in the details below to upload your file.BR Fields shown in font class='bad'red/font are mandatory. ? if (isset($_POST['submit'])) echo p class='bad'You did not enter info into a required field!/p; ? table width='100%' class='border' col span='1' align='right' tr td valign='top' font class='bad'Short description:/font /td td input type='text' name='short' size=50BR /tr tr td Long Description /td td textarea rows='5' name='longdesc' cols='33'/textareaBR /td /trtr td Uploaded by: /td tdinput type='text' name='user' cols='33' /td /trtr td font class='bad'Select a Car Type/font /td tdselect size='1' name='gen' class='smalltext' option selected Select One/option ? catDropDown('1'); ? /select /trtr td font class='bad'Select a media depiction/font /tdtd select size='1' name='category' class='smalltext' option selected Select One/option ? catDropDown('2'); ? /select /td /tr tr tdfont class='bad'File:/font/td tdinput name='newfile' type='file'/td /tr tr td align='right' input type='hidden' name='MAX_FILE_SIZE' value='16777216' input name='submit' class='smalltext' type='submit' value='Upload your file' /td /tr /table /td /tr /table /form div align=center table border=0 width=300 cellspacing=0 cellpadding=0 tr td width=100% align=center class=smalltext hr class=headertxt a href=default.phpBrowse Media/a /td /tr /table /div /body /html ?php } else { $s=; // set the var blank to add to query // Was a file uploaded? if (is_uploaded_file($_FILES['newfile']['tmp_name'])) { // open and read the uploaded file $file1=fopen($_FILES['newfile']['tmp_name'], r); $file=fread($file1, $_FILES['newfile']['size']); // Escape special characters in the file $file=AddSlashes($file); $tmp=split('/',$_FILES['newfile']['type']); if ($tmp[0]=='image') { $size = getimagesize($_FILES['newfile']['tmp_name']); $s=,width='{$size[0]}', height='{$size[1]}'; } } else $file=NULL; $insertQuery = INSERT INTO media_files SET shortdesc='{$_POST['short']}', longdesc='{$_POST['longdesc']}', username='{$_POST['user']}', mimetype='{$_FILES['newfile']['type']}', filedata='{$file}', filesize='{$_FILES['newfile']['size']}', filename='{$_FILES['newfile']['name']}', uploaded=CURDATE(), category1='{$_POST['gen']}', category2='{$_POST['category']}' ; $insertQuery.=$s; // check for unknown file type, if it's unknown, automatically censor it. $foo=split(/,$_FILES['newfile']['type']); if (AUTOCENSOR or !($foo[0]==image or $foo[0]==video or $foo[0]==audio)) $insertQuery.=, censor='t'; if ((doQuery($insertQuery))) { // @ mysql_affected_rows() == 1) $lastid=mysql_insert_id(); $statement=INSERT INTO media_stats SET id=$lastid; if ((doQuery($statement))) { header(Location: receipt.php?status=Tfile=$lastid); } else { echo getError(); } } else echo getError(); } ? HTH - Anthony Boa Constructor wrote
Re: [PHP-DB] can i create an Access table or mdb with PHP?
You could use ODBC to do it. Create a template access DB, poulate it with ODBC, then read the file and send it to the user. After it's downloaded clear the table. the downside to this is that you would only be able to haev one user ata time get an access database. I'm sure there are better ideas, but this would work. - Anthony John A Davis wrote: I'm trying to supply our Contract Counties with mailing labels, already formatted. They log on to our website and PHP will hit our SQL Server and return a list of Public Water Systems for the County chosen. I would like a link on this page that says something like Send me an Access .mdb with mailing labels for these systems. PHP would delete whatever is in stock Access .mdb table somewhere on our system and replace the rows with newer, current ones, specific to the County chosen(same query that displays the systems in HTML). The Access .mdb that gets downloaded will have a report formatted for Avery 5160 labels, bound to the newer table that was filled. All they have to do is adjust their printer settings. Does anyone have an easier way of supplying data formatted for mailing labels? If they do, I'm all ears(eyes). Since this is a bonus service, we don't want to have to have people involved providing this stuff to our counties. tia John Davis IIS State of Oregon Drinking Water Program [EMAIL PROTECTED] 11/12/02 09:12PM On Tue, 12 Nov 2002, John A DAVIS wrote: Want to give the user the ability to download a dynamic Access.mdb file that has a table and linked report formatted for Avery 5160 labels. Know how to create all this stuff in VBA code, but not using PHP. It is better to give too much information than not enough. You are trying to generate a dynamic Access.mdb file on the fly, using PHP? Or you are trying to deliver this already existing file that changes sometimes with PHP? Or you are trying to do something else? If the first option, where is your data coming from? If the second, why are you trying to use PHP instead of just linking to the Access.mdb file via the web server? Peter --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle problem
Perhaps it would be easier to use bind variables instead. For example, $empno = 1234; $ename = O'Reilly; $conn = OCILogon('scott', 'tiger'); $sql = 'INSERT INTO emp (empno, ename) VALUES (:empno, :ename)'; $stmt = OCIParse($conn, $sql); OCIBindByName(':empno', $empno, -1); OCIBindByName(':ename', $ename, -1); OCIExecute($stmt); Check out Thies' presentation: http://conf.php.net/pres/index.php?p=slides%2Fociid=oci2 If you have questions, let us know. -Anthony From: Ford, Mike [LSS] [EMAIL PROTECTED] Date: Wed, 16 Oct 2002 12:14:58 +0100 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: [PHP-DB] Oracle problem -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 16 October 2002 08:51 To: [EMAIL PROTECTED] Has anyone out there using PHP and Oracle come across this problem? I have a text area that allows free-form text that I store in a varchar2 column. I have problems with apostrophes in the free-form text. Uh-oh! Standard can of worms no. 3! When users put in an apostrophe the SQL fails. If I force 3 apostrophes (the Shouldn't that be *two* apostrophes? That's how it works here, anyway! usual Oracle method of embedding apostrophes) the SQL fails. The only way to get round the problem is to strip them out (which I consider a work-around not a fix). You may also want to investigate the php.ini settings magic_quotes_gpc, magic_quotes_runtime and magic_quotes_sybase -- although personally I prefer not to use these as I'm averse to magic (well, other people's, anyway!). 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] Help MySQL server has gone away
ok, I have a script that takes files from a HTTP post and loads them into a mySQL database. Whenever I try to load a file greater than a meg ot two, I get mySQL error #2006, MySQL server has gone away. I checked upload_max_filesize in php.ini and that's not the problem, also MAX_FILE_SIZE input tag is not the problem. Anyone have any ideas? Here the basic code that does the upload. There is some other code that collects other info and some error checking. I'm not hitting max execution time. So what gives? Thanks in advance for your help. BTW, PHP 4.2.1, my SQL 3.23.49-nt $f1=fopen($_FILES['newfile']['tmp_name'], r); $file=fread($f1, $_FILES['newfile']['size']); $file=AddSlashes($file); $insertQuery = INSERT INTO media_files SET shortdesc='{$_POST['short']}', longdesc='{$_POST['longdesc']}', username='{$_POST['user']}', mimetype='{$_FILES['newfile']['type']}', filedata='{$file}', filesize='{$_FILES['newfile']['size']}', filename='{$_FILES['newfile']['name']}', uploaded=CURDATE(), category1='{$_POST['gen']}', category2='{$_POST['category']}' ; Please help. Thanks. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Need help getting record number off insert
I'm doing an insert and need to get the record number that is generated when the record in created. I'm accessing the database through ODBC. It's a DataFlex database and the driver i'm using is by Connex. I know that you can somehow insert a SQL statment inside an other statement. I was thinking if I could quesry the record inside the insert, then I could get the record number. I'm not sure how to do this though. I was also thinking that I might be able to get some info from the resourse identifier that is returned to PHP, but I don't know how to read it from an insert, odbc_result doesn't work. Anyone have any clue how I can do this? I'm kinda new to this, so please help me out. I'm running IIS/Win2k, PHP 4.2.1 using ODBC through Connex DataFlex driver 8.7. Thanks in advance for your help. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Updating a CLOB-- OCI_INVALID_HANDLE
Hello, Has anyone come across difficulty updating a CLOB in Oracle? I have been able to follow the documentation to insert a new clob by first inserting an EMPTY_CLOB() into the row, and then calling the save method of the OCINewDescriptor/CLOB locator: $conn = OCILogon(username, password, connect_string); $clob_loc = OCINewDescriptor($conn, OCI_D_LOB); $sql = INSERT INTO emp (empno, name, life_story) VALUES (emp_seq.NEXTVAL, :name, EMPTY(CLOB)) RETURNING life_story INTO :clob_loc; $stmt = OCIParse($conn, $sql); OCIBindByName($stmt, :name, $name, -1); OCIBindByName($stmt, :life_story, $clob_loc, -1, OCI_B_CLOB); OCIExecute($stmt, OCI_DEFAULT); $clob_loc-save($new_life_story); However, attempts to SELECT life_story INTO :clob_loc FROM emp WHERE empno = 123 FOR UPDATE have failed. Similarly, UPDATE emp SET name = 'NEW_NAME' WHERE empno = 123 RETURNING life_story INTO :clob_loc have also failed. The error message is the same: Warning: OCILobWrite: OCI_INVALID_HANDLE in /home/acarlos/update.php on line 16. However, if I update the row and set the CLOB column to anything new (including EMPTY_CLOB()), no error occurs. When it fails, I've checked the class of the OCINewDescriptor and it is indeed an object with 6 class methods (as it should be). Has anyone run into this? Is this a bug in PHP's implementation of OCI? Also, is there a limit to the amount of data that can be stored in the CLOB using this method? My uploads have been truncated to a little less than 32K. And I thought using a CLOB was supposed to give me access to 4GB... Thanks for any insight! Anthony Carlos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Question about ODBC databases
As far as I know, you can not connect to an ODBC source remotly. If I could do this (make a NT server running ODBC look like a SQL server), it would make the app I'm working on much easier to develop. I have found a program called ODBCSocketServer, that will send and recieve ODBC requests via an XML stream. This works ok, but is limited and difucult to work with. At the current time it it incapable of sending over a secure port also. If you happen to find a way to make the ODBC server take remote requests, please let me know (I will from then on refer to you as god). Hope this helps. - Anthony [EMAIL PROTECTED] Gerardo Morales wrote: I have a little problem. I must design a little system in a linux server, this should be in php. The system must read a MS Access DB in a remote server (Win NT). After a single process the system must update a MySQL DB in the same server (Linux) and the Access DB. The current code works fine in the Linux server, so i can update the MySQL DB, but it doesn't connect with the NT server. When i tried to connect to it i have the following error. Fatal error: Call to undefined function: odbc_connect() in /usr/local/etc/httpd/htdocs/vox/loginAccess.inc on line 14 I never developed with ODBC DB, only with MySQL. I was searching about what could be the problem, but i don't found it. The code in liginAccess is the following: $dbaccess = array(); $dbaccess[accessserver] = NT.server.ip.address; // Access server hostname $dbaccess[accessport] = ; // Access server port $dbaccess[accessusername] = user; // username $dbaccess[accesspassword] = password; // password $dbaccess[defaultdb] = database; // database $conexionAccess=odbc_connect($dbaccess[defaultdb],$dbaccess[accessusername],$dbaccesss[accesspassword],); In the code above i tried to inser the remote server address, port etc, and the error codee is the same I hope you cant help me. I don't who else can i ask for it. Thanks in advanced -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Question about ODBC databases
As far as I know, you can not connect to an ODBC source remotly. If I could do this (make a NT server running ODBC look like a SQL server), it would make the app I'm working on much easier to develop. I have found a program called ODBCSocketServer, that will send and recieve ODBC requests via an XML stream. This works ok, but is limited and difucult to work with. At the current time it it incapable of sending over a secure port also. If you happen to find a way to make the ODBC server take remote requests, please let me know (I will from then on refer to you as god). Hope this helps. - Anthony [EMAIL PROTECTED] Gerardo Morales wrote: I have a little problem. I must design a little system in a linux server, this should be in php. The system must read a MS Access DB in a remote server (Win NT). After a single process the system must update a MySQL DB in the same server (Linux) and the Access DB. The current code works fine in the Linux server, so i can update the MySQL DB, but it doesn't connect with the NT server. When i tried to connect to it i have the following error. Fatal error: Call to undefined function: odbc_connect() in /usr/local/etc/httpd/htdocs/vox/loginAccess.inc on line 14 I never developed with ODBC DB, only with MySQL. I was searching about what could be the problem, but i don't found it. The code in liginAccess is the following: $dbaccess = array(); $dbaccess[accessserver] = NT.server.ip.address; // Access server hostname $dbaccess[accessport] = ; // Access server port $dbaccess[accessusername] = user; // username $dbaccess[accesspassword] = password; // password $dbaccess[defaultdb] = database; // database $conexionAccess=odbc_connect($dbaccess[defaultdb],$dbaccess[accessusername],$dbaccesss[accesspassword],); In the code above i tried to inser the remote server address, port etc, and the error codee is the same I hope you cant help me. I don't who else can i ask for it. Thanks in advanced -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Question about ODBC databases
As far as I know, you can not connect to an ODBC source remotly. If I could do this (make a NT server running ODBC look like a SQL server), it would make the app I'm working on much easier to develop. I have found a program called ODBCSocketServer, that will send and recieve ODBC requests via an XML stream. This works ok, but is limited and difucult to work with. At the current time it it incapable of sending over a secure port also. If you happen to find a way to make the ODBC server take remote requests, please let me know (I will from then on refer to you as god). Hope this helps. - Anthony [EMAIL PROTECTED] Gerardo Morales wrote: I have a little problem. I must design a little system in a linux server, this should be in php. The system must read a MS Access DB in a remote server (Win NT). After a single process the system must update a MySQL DB in the same server (Linux) and the Access DB. The current code works fine in the Linux server, so i can update the MySQL DB, but it doesn't connect with the NT server. When i tried to connect to it i have the following error. Fatal error: Call to undefined function: odbc_connect() in /usr/local/etc/httpd/htdocs/vox/loginAccess.inc on line 14 I never developed with ODBC DB, only with MySQL. I was searching about what could be the problem, but i don't found it. The code in liginAccess is the following: $dbaccess = array(); $dbaccess[accessserver] = NT.server.ip.address; // Access server hostname $dbaccess[accessport] = ; // Access server port $dbaccess[accessusername] = user; // username $dbaccess[accesspassword] = password; // password $dbaccess[defaultdb] = database; // database $conexionAccess=odbc_connect($dbaccess[defaultdb],$dbaccess[accessusername],$dbaccesss[accesspassword],); In the code above i tried to inser the remote server address, port etc, and the error codee is the same I hope you cant help me. I don't who else can i ask for it. Thanks in advanced -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Reset ODBC Results
I am in desperate need of a way to reset ODBC results. If I check for results using odbc_fetch_row(), I need to reset the pointer before I loop through the results. Right now I'm loosing the 1st row! I read in the comments on the online manual that odbc_fetch_row($results,0) will reset the results, but it doesn't work. Please help me out, I'm in a real bind here! Thanks - Anthony [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Reset ODBC Results
I am in desperate need of a way to reset ODBC results. If I check for results using odbc_fetch_row(), I need to reset the pointer before I loop through the results. Right now I'm loosing the 1st row! I read in the comments on the online manual that odbc_fetch_row($results,0) will reset the results, but it doesn't work. Please help me out, I'm in a real bind here! Thanks - Anthony [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Oracle client on linux
There's a bunch of requirements that have to be met in order for the software installer to work. In case you're installing onto a remote machine, do you have XWindows running on your Linux machine? Does your terminal program support XWindows? From: aiQa [EMAIL PROTECTED] Date: Fri, 25 Jan 2002 14:03:54 +0200 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Oracle client on linux Hi, ..and Has anyone installed oracle 8i client on linux? When I start ./runInstaller, It says that it installs x.jde and hangs. Thanks, aiQa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Oracle Database procedures
Sridhar, Take a look at this documentation from Thies Arntzen. It's required reading for anyone using Oracle and PHP! I hope it gets you started. If not, ask for more help! Good luck, Anthony Carlos PS: It shows how to bind PHP variables to Oracle variables... From: Sridhar Moparthy [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Fri, 25 Jan 2002 09:03:21 -0500 To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle Database procedures Hi All, Could you please help me on how to call Oracle stored procedures from PHP4.X. Also how to get the returned data in PHP from Oracle stored procedure? Thanks In advance. Sridhar Moparthy. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Oracle Database procedures
Sridhar, Sorry, it's available at: http://conf.php.net/pres/index.php?p=slides%2Fociid=oci2 Good luck! --Anthony From: Anthony Carlos [EMAIL PROTECTED] Date: Fri, 25 Jan 2002 09:50:26 -0500 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Oracle Database procedures Sridhar, Take a look at this documentation from Thies Arntzen. It's required reading for anyone using Oracle and PHP! I hope it gets you started. If not, ask for more help! Good luck, Anthony Carlos PS: It shows how to bind PHP variables to Oracle variables... From: Sridhar Moparthy [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Fri, 25 Jan 2002 09:03:21 -0500 To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle Database procedures Hi All, Could you please help me on how to call Oracle stored procedures from PHP4.X. Also how to get the returned data in PHP from Oracle stored procedure? Thanks In advance. Sridhar Moparthy. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: Unable to Open ORACLE
John: Yes, CLOBs are a little more difficult to access. The best way I've used them is to use the DBMS_LOB package in Oracle. Here's a link on technet.oracle.com to some documentation. http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev. 817/a76940/adl03pr4.htm#146661 I suggest using this with stored procedures and bind variables. php.net has more info on using stored procedures bind variables. Good luck, Anthony Carlos From: John Kolvereid [EMAIL PROTECTED] Date: Mon, 03 Dec 2001 22:17:44 -0800 To: [EMAIL PROTECTED], John Kolvereid [EMAIL PROTECTED] Subject: [PHP-DB] Re: Unable to Open ORACLE Hi, Me again, My table has a CLOB in it. When I tried the same querry w/ another table w/o a CLOB it succeeded. Are CLOBs an issue? Please advise. Thanks. John Kolvereid wrote: Hi, I tried the following snippet from http://www.php.net/manual/en/ref.oracle.php $query = Select * from patients where clientid = 'DEMO'; ora_parse($curs, $query); ora_exec($curs); ora_fetch($curs); The parse executed successfully, but the exec complained that Ora_Exec failed (ORA-00932: inconsistent datatypes -- while processing OCI function OEXEC/OEXN) Earlier I had taken an example from Thies Arntzen's conf notes and successfully opened, parsed and fetehed, using the same query and the same db, only w/ OCI commands. Is there a problem w/ the ordinary Oracle functions, possibly w/ a mismatch between them and the undelying OCI codes? Please advise. Thank you. -- John Kolvereid http://www.odinfo.com http://www.kolvereid.com [EMAIL PROTECTED] 1.610.296.4485 -- John Kolvereid http://www.odinfo.com http://www.kolvereid.com [EMAIL PROTECTED] 1.610.296.4485 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] ORA-24365
This might help... 24365, 0, error in character conversion // *Cause: This usually occurs during conversion of a multibyte // character data when the source data is abnormally terminated // in the middle of a multibyte character. // *Action: Make sure that all multibyte character data is properly terminated. From: Alex [EMAIL PROTECTED] Reply-To: Alex [EMAIL PROTECTED] Date: Mon, 19 Nov 2001 15:37:01 +0100 To: [EMAIL PROTECTED] Subject: [PHP-DB] ORA-24365 I have following problem when I moved my PHP scripts from Windows IIS hosting to Linux Apache. Scripts are unchanged, all connections to database are working but when I try to execute simple StoreProcedure on Oracle, I'm getting this error: Warning: OCIStmtExecute: ORA-24365: error in character conversion in /usr/local/apache-novi/htdocs/broadcast.php on line 32 This is what I'm trying to execute. begin :ret_val := PKAccount.AlterAccount( 1, '|LOGIN|avarga|PASSWORD|b|', :outstr ); end; Thnx, Alex -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP Getting Variables from String
I need help. Say I have a string coming from a page via a form $search_var. I need it split up into multiple variables... e.g $string=These are some words I want it to turn into $var1=These, $var2=are, $var3=some, $var4=some I'm doing this for a search script. Want it to take the input, and search a mysql db for each of the keywords... Please e-mail a response to [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] help connecting to ODBC
I can't connect to an ODBC data source. I have done this before many times. I am now trying to connect to a new driver for new data. This is the first time I have tried to access a file DSN. I have the driver setup as a system DSN on win2k and IIS 5. PHP 4.06. when I attempt to connect to the data source I get SQL error: , SQL state S1000 in SQLConnect. What does this mean? does anyone know where I can get a list of SQL errors and their meaning? Thanks to anyone that can lend their thoughts. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] help connecting to ODBC
yes, I can use the source from other programs. The source is a System DSN, based on a file DSN for the driver. The I_USR_servername user has the correct access rights to the files being accessed and to the file DSN driver. Andrew Hill wrote: Anthony, Is the DSN usable from the ODBC Administrator control panel? E.g. test it there first. Also, you mention File DSNs? PHP can only use System DSNs on Windows, AFAIK. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Data Integration Technology Providers -Original Message- From: Anthony [mailto:[EMAIL PROTECTED]] Sent: Friday, October 19, 2001 1:01 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] help connecting to ODBC I can't connect to an ODBC data source. I have done this before many times. I am now trying to connect to a new driver for new data. This is the first time I have tried to access a file DSN. I have the driver setup as a system DSN on win2k and IIS 5. PHP 4.06. when I attempt to connect to the data source I get SQL error: , SQL state S1000 in SQLConnect. What does this mean? does anyone know where I can get a list of SQL errors and their meaning? Thanks to anyone that can lend their thoughts. - Anthony -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] php and Oracle database
Georgina: Based on your 2 enclosures, it appears that you have an html file called search1.html. When the user hits the submit button, it calls search1.php4. My question, therefore, is do you have output from search1.php4? Do you see any error messages? Thanks, Anthony Carlos From: GEORGINA ELAINE BAILEY [EMAIL PROTECTED] Date: Thu, 27 Sep 2001 12:20:17 +0100 To: [EMAIL PROTECTED] Subject: [PHP-DB] php and Oracle database I am very new to PHP and databases and have not really had very much programming practice. However, I am trying to create a Web page that retrieves data from an Oracle database and uses php to display the content in a HTML format. For some reason though my script just doesn't seem to work, despite the fact that I know there is data in teh database that matches the criteria, and only prints the final three HTML links at the bottom of the script. Any ideas? But please make them easy enough for a 3 year old to understand. Georgina Bailey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] USA Attacks
Hello, Steve. Thank you for your sentiments. As an American who drives past the Pentagon everyday to work, it means a lot. Anthony Carlos From: Steve Farmer [EMAIL PROTECTED] Date: Wed, 12 Sep 2001 12:28:28 +1000 To: [EMAIL PROTECTED] Subject: [PHP-DB] USA Attacks Hi, My heart goes out to all our American cousins in their time of tragedy. Steve Farmer -- --- Minds are like parachutes, they work best when open Support free speech; visit http://www.efa.org.au/ Heads Together Systems Pty Ltd http://www.hts.com.au Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] creating an Oracle variable...
Bona: You're using OCIParse incorrectly. It's used to parse SQL commands. The var statement that you quoted is a SQL*Plus command. That is, you're defining a variable in SQL*Plus. That's why you're getting an Invalid SQL Command error. Use the OCIBindByName to bind a PHP variable (you're using test) to an Oracle placeholder, which is denoted by a preceding colon. e.g., $sql = INSERT INTO emp (ename) VALUES (:ename_placeholder);; $stmt = OCIParse($conn, $sql); OCIBindByName($stmt,:ename_placeholder,$empno,32); $empno = Bona; OCIExecute($stmt, OCI_DEFAULT); Please let me know if this makes sense, Anthony Carlos From: [EMAIL PROTECTED] Date: Mon, 10 Sep 2001 11:10:04 -0800 To: [EMAIL PROTECTED] Subject: [PHP-DB] creating an Oracle variable... Hi, I creat the variable test using the sql plus: var test varchar2(10); I´ve been trying to do it wiht PHP: $comando1 = exec var test varchar2(10);; $controle = OCIParse ($connection, $comando1); if ($controle == false){ echo OCIError($controle).BR; } $result1 = OCIExecute ($controle); I tryed $comando1 using begin and without the exec... with and without the ; on the end... but I allways have the same message: Invalid SQL Command... can anybody help me??? thanks Bona __ Visite http://www.trama.com.br -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Photo Album Schema
I vote for one directory to simplify the programming side of things. What do you guys recommend for the filename convention? Would you let users determine it or would you force them into something like a primary key? Anthony Carlos -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 21, 2001 11:55 AM To: PHP-DB Subject: RE: [PHP-DB] Photo Album Schema I vote for a single directory. Then use Sheridan's naming suggestion. Richard Emery Excel Communications, Inc. IT Sr. Project Manager (972) 478-3398 (972) 944-0542 (pager) There is no trying... There is only Do or Not Do -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 21, 2001 10:49 AM To: PHP-DB Subject: RE: [PHP-DB] Photo Album Schema I should have said photo_filename. That was what I intended to do. Would you suggest one directory for all photos or separate directories for each user? Jeff Oien Rick: I don't see any .php tags there... plus just because someone else has done it doesn't mean he can't do it as well =) Jeff: The only critique I would give from the description you have given us thus far is the fact that you appear to be storing the photo in the DB. The biggest bottleneck in a server-side script is usually the DB calls. With this in mind, you want to limit these calls as much as possible. I would suggest setting up a naming and/or directory scheme to store the pictures on the website, and then store the URL of the picture in the DB, rather than the image itself. Then when outputing the page just do something like echo Img src=\$queryresult['location']\; Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: Rick Emery [EMAIL PROTECTED] To: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED] Sent: Tuesday, August 21, 2001 10:19 AM Subject: RE: [PHP-DB] Photo Album Schema This has been done. see http://www.photopoint.com This is a free service available to the public. rick Richard Emery Excel Communications, Inc. IT Sr. Project Manager (972) 478-3398 (972) 944-0542 (pager) There is no trying... There is only Do or Not Do -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 21, 2001 10:12 AM To: PHP-DB Subject: [PHP-DB] Photo Album Schema I want to make a photo album that will have users who sign up to create an album and then have the albums open to the public. I was thinking of doing it like this but I've never done a relational database before so if anyone thinks of anything I should change please let me know. Thanks. Jeff Oien Table1: -username -password -album_title -creation_date -id Table2: -id (from Table1) -photo (jpg or gif) -date -photo_title -description (limited length) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] oracle (oci8) intro
That's interesting. I haven't had to do too many queries with lots of computed columns. I'll defer to you and double check my queries. On the other hand, I have not run into any problems with truncated column data. With regards to the server side cursors, why not send an anonymous PL/SQL block? I don't suppose that it has to be a stored procedure... Perhaps you're talking about the ability to output the result set from a PL/SQL block to PHP. That's a curious puzzle. I haven't given it much thought, mainly because I'm not too good at writing dynamic SQL in PL/SQL (which is even less arbitrary, I believe, than the code I wrote below), but what would happen if you built a PL/SQL table or array and bound that to a PHP variable? Have you ever tried this? It's nice to see someone with a lot of Oracle experience-- sometimes I think that this is only for MySQL users! Thanks, Anthony Carlos -Original Message- From: Manuel Lemos [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 21, 2001 3:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] oracle (oci8) intro Hello, Anthony Carlos wrote: Here's what I'm using to do paged queries in Oracle: $min = minimum of range of records $max = maximum of range of records $field_list = the fields from the table separated by commas $table = the table from where you're selecting $where_clause and $order_by should be self-explanatory SELECT linenum, $field_list FROM (SELECT rownum AS linenum, $field_list FROM (SELECT $field_list FROM $table WHERE $where_clause ORDER BY $order_by)) WHERE linenum BETWEEN $min AND $max; I afraid that this doesn't work well with arbitrary queries. I tried this before and I recall there are problems with computed columns (COUNT(), SUM(), etc...). If I am not mistaken there is also the problem that Oracle truncates column names that are qualified with the table names. The right way to do that is using server side cursors, but I could not figure how to return to the client side, a server side cursor that I could use skip rows and get only those that I want. Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] oracle (oci8) intro
Here's what I'm using to do paged queries in Oracle: $min = minimum of range of records $max = maximum of range of records $field_list = the fields from the table separated by commas $table = the table from where you're selecting $where_clause and $order_by should be self-explanatory SELECT linenum, $field_list FROM (SELECT rownum AS linenum, $field_list FROM (SELECT $field_list FROM $table WHERE $where_clause ORDER BY $order_by)) WHERE linenum BETWEEN $min AND $max; I hope it helps, Anthony Carlos -Original Message- From: Graeme Merrall [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 19, 2001 7:34 PM To: Cynic Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] oracle (oci8) intro Quoting Cynic [EMAIL PROTECTED]: Hi there, I'm in a situation where I need to produce a small app on top of an Oracle server really quickly. I'm quite a seasoned developer, but have only experience with MySQL so far. It's my understanding that Oracle lacks the MySQL's LIMIT feature. Looking at the OCI section of the PHP manual, it also looks like there's no OCIDataSeek() or some equivalent. Since the app I need to build will be a standard report builder with paging, I need this functionality. What is the common way to achieve this? Always fetch all rows, cycling through the resultset, discarding the records that preceed the one I want to start displaying with, and quit when I reach the one where the page should end? Is there a PHP + OCI tutorial somewhere? I need an intro to Oracle, and I need it now. :( Thies has an Oracle/PHP tutorial online at http://conf.php.net/ which may be of some assitance. The LIMIT problem is a real bitch is Oracle. There are a few ways to get around it, the most obvious people use being ROWNUM. However, ROWNUM does not listen to sorting which makes life amusing. One option is to try a query like the following: SELECT * FROM (SELECT field1, field2 FROM table WHERE id10 ORDER BY field1 DESC) WHERE ROWNUM11 which gives you 10 rows, but still leaves the question of paging behind unless you use between values. I can't say I've tried paging record sets though. Cheers, Graeme -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Oracle CLOBs and carriage returns
Tom: I suspect that your problem is with the HTML, not the CLOB itself. Have you tried echoing $lob_data in between PRE tags or using the nl2br function in PHP? It converts nl's to BR tags. Hope it helps, Anthony -Original Message- From: Tom Tsongas [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 09, 2001 2:09 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle CLOBs and carriage returns Hi folks. I have an interesting problem with regards to data I am retrieving from a CLOB stored in my database. The data consists of several paragraphs of information with multiple carriage returns and other formatting mechanisms. Now when I attempt to retrieve the data and display it on the web page, it comes out as one giant line and all carriage returns and tabbing seems to have been obliterated. Here is the code I am using: $sql_comments = OCIParse($connection,SELECT COMMENTS FROM INCIDENT WHERE INCIDENT='$incident'); OCIExecute($sql_comments); while ( OCIFetchInto($sql_comments, $row, OCI_ASSOC+OCI_RETURN_NULLS)) { $lob_data = $row[COMMENTS]-load(); echo $lob_data; } I know the information is stored correctly since a SQL query from the command line works properly and all formatting is displayed. Any thoughts? Tom -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] long or LOBs in oracle ???
Andy: Go with the CLOB. As you stated, you can have more than one CLOB defined in a table. Also, you can pull out data randomly instead of sequentially. Plus, the data can reside inline (for less than 4KB) or out of line for bigger values. The key to making it work is using the DBMS_LOB package. See the Oracle documentation on this to get an idea, then ask a more specific question. If you're a member of technet, you'll be able to read this: http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev. 817/a76936/toc.htm If not, join up ASAP! (It's free). Good luck, Anthony From: Andreas Eckhoff [EMAIL PROTECTED] Date: Tue, 31 Jul 2001 15:09:52 +0200 To: [EMAIL PROTECTED] Subject: [PHP-DB] long or LOBs in oracle ??? Hi everybody, I have a little question. What is the best datatype to put large character data into (more than 5.000-20.000 letters). Maybe a CLOB or a long ? I am quiet new to oracle so I don't know so much about the LOBs and how Oracle handles it. On thing is, that I have to use more than one large field in one table, this means that I cannot use the long type, because only one is allowed, right. OK Then I think there is only a LOB Type (maybe the CLOB is the best for my stuff). I tried it, but I cannot put the data in the normal way into the field, like I am used to with MYSQL longtext type. How can I put LOB data into the DB via PHP or is there an other method to put large character data into the DB, can anybody help me thanx in advance, Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] problems connecting to remote oracle database
Phil, Perhaps I'm being nit-picky, but shouldn't it be OCILogon($user, $PASSWORD, $connect_string); ? Anthony From: [EMAIL PROTECTED] Date: Sat, 30 Jun 2001 09:39:11 -0700 To: [EMAIL PROTECTED] Subject: [PHP-DB] problems connecting to remote oracle database Hi folks, I'm having difficulties getting php4 to connect to a remote oracle database. I have an entry in tnsnames.ora, along the lines of shorthostname = (etc, etc) and I can use sqlplus user/name@shorthostname to connect just fine, as a regular user. Even without ORACLE_SID set, since I have it set in tnsnames.ora for that entry But when I try ocilogin(user,name,shorthostname); on a php page, I get a printout of oracle error 01017: authentication failed. The listener log on that oracle machine confirms that I am actually attempting to connect. But no details on what's going wrong. Any suggestions? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Oracle Client to connect to remote DB
Yes, it can be installed via command line. There is mention of it in the installation guide. I've never been able to make it work, however, and I don't believe that Oracle is supporting it as much as its GUI Universal Installer. On the other hand, I have used the Universal Installer over an ssh connection that forwards X-Windows packets. Therefore, I was able to use it remotely via an X-Windows terminal on my PC. Anthony -Original Message- From: Mindblender [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 27, 2001 10:58 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Oracle Client to connect to remote DB Do you know if the Oracle client can beinstalled via the command line? I don't have access to the box itself, only telnet access. Jeff Brian S. Dunworth [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jeff, As far as I know, you cannot get *only* the Oracle client for Linux. When I called Oracle Worldwide Support and asked for one, they sent me the whole Oracle 8i installation package for Linux. No problem, though -- when you start the install on your Linux machine, you can choose to install only the client. That's what I did, and it's working fine connecting to the Oracle 8i database on our Sun. -Original Message- From: Mindblender [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 12:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle Client to connect to remote DB I read a post on faqt.com that said that I could connect to a remote Oracle DB if I had the Oracle client installed. Does anyone know where I can get a copy of only the client for Linux? I don't want to install the whole Oracle package, I use MySQL on the server, but have a client that is needing to connect to an Oracle DB on their server from mine. Any suggestions? Thanks, Jeff - Brian S. Dunworth Sr. Software Development Engineer Oracle Database Administrator The Printing House, Ltd. (850) 875-1500 x225 [EMAIL PROTECTED] - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] error ORA-12699
Sang, Your tnsnames file appears to be misconfigured. It should look like this: ORCL = (DESCRIPTION= (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)) (CONNECT_DATA = (SID = ORCL))) The first line, ORCL =, lets you know what to use as your connect string. In this case, you're calling your connect string ORCL. When you try to login, you should use username/password@ORCL. In PHP, you set the third argument to OCILogon to ORCL. Here's what happens. When Oracle sees a connect string during a login attempt, it checks the tnsnames.ora file to resolve it into a protocol, address, and sid. In other words, ORCL is shorthand notation for all of the TCP/IP info and then some. I hope this makes sense, Anthony -Original Message- From: sang [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 27, 2001 9:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] error ORA-12699 I have read some doc. $connect_string is set to equal from tnsnames.ora. $connect_string=(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))(CONNECT_DATA = (SID = ORCL))); I can connect my local oracle server before when using OCILogon(system,manager); But now , i cannot connect local oracle server!! It is always said the ORA-12699 error! I donot know what is wrong. sang Anthony Carlos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Sang, Since you're trying to connect from another computer to the Oracle server, you probably need to specify a connect string in the OCILogon command. OCILogon('system', 'manager', $connect_string); What's the value for $connect_string? It depends on how you've set-up your Oracle networking. If you can access your DB from that client machine with SQL*Plus, then you must be loging in via the following format: sqlplus system/manager@connect_string Use the value of connect_string for $connect_string. It should be defined in your tnsnames.ora file on your client, and have a corresponding entry in your listern.ora file on your server. I suspect that your client machine is trying to access an Oracle database on itself, because no connect string was specified. Lemme know if this helps, Anthony From: sang [EMAIL PROTECTED] Date: Wed, 27 Jun 2001 18:59:31 +0900 To: [EMAIL PROTECTED] Subject: [PHP-DB] error ORA-12699 I have installed NT4+PHP+ORACLE8.0.4+APACHE in my computer. I want to access ORACLE server to another computer from web server. It is ok to access ORACLE SERVER with PERL, but i cannot access using PHP. The first error is ora-12514 , but i change, change and change, now it is always ORA-12699 Native service internal error . ?php ocilogon(system,manager,); ? Warning: _oci_open_server: ORA-12699:Native service internal error Thanks in advance. sang -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] error ORA-12699
Sang, Since you're trying to connect from another computer to the Oracle server, you probably need to specify a connect string in the OCILogon command. OCILogon('system', 'manager', $connect_string); What's the value for $connect_string? It depends on how you've set-up your Oracle networking. If you can access your DB from that client machine with SQL*Plus, then you must be loging in via the following format: sqlplus system/manager@connect_string Use the value of connect_string for $connect_string. It should be defined in your tnsnames.ora file on your client, and have a corresponding entry in your listern.ora file on your server. I suspect that your client machine is trying to access an Oracle database on itself, because no connect string was specified. Lemme know if this helps, Anthony From: sang [EMAIL PROTECTED] Date: Wed, 27 Jun 2001 18:59:31 +0900 To: [EMAIL PROTECTED] Subject: [PHP-DB] error ORA-12699 I have installed NT4+PHP+ORACLE8.0.4+APACHE in my computer. I want to access ORACLE server to another computer from web server. It is ok to access ORACLE SERVER with PERL, but i cannot access using PHP. The first error is ora-12514 , but i change, change and change, now it is always ORA-12699 Native service internal error . ?php ocilogon(system,manager,); ? Warning: _oci_open_server: ORA-12699:Native service internal error Thanks in advance. sang -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Oracle and PHP
TathitSA, You'll need to have the Oracle networking software (Net8) installed on your Web server. Then, compile PHP with the Oracle directive turned on. These are just general concepts, but if this is incomprehensible, then please ask more questions before proceeding. For more details, see the installation manual , and if you don't understand what they say, ask a more specific question. I'll be happy to help translate whatever I can. Anthony -Original Message- From: TathitSA [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 1:47 AM To: PHP General; PHP DB Subject: [PHP-DB] Oracle and PHP Hi, I'm a newbie in PHP, what should I do to connect to Oracle Database. Do I have to install a library to do that? Please anyone, help. Thanks, TathitSA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Oracle Client to connect to remote DB
Jeff, When you run the graphical Oracle Installer program (require X-Windows), you can choose a custom installation and specify what you want to install. I don't know if you can get just the client for Linux, but the server software includes the client software. You can demo the software from technet.oracle.com. I have no idea how much it costs by itself. Anthony -Original Message- From: Mindblender [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 26, 2001 12:35 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Oracle Client to connect to remote DB I read a post on faqt.com that said that I could connect to a remote Oracle DB if I had the Oracle client installed. Does anyone know where I can get a copy of only the client for Linux? I don't want to install the whole Oracle package, I use MySQL on the server, but have a client that is needing to connect to an Oracle DB on their server from mine. Any suggestions? Thanks, Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]