Re: [PHP-DB] Novice to PHP. Database connection help needed
You might want to look at some of the free abstraction layers out there like ADODB (http://php.weblogs.com/ADODB). http://www.devshed.com/Server_Side/PHP/ has a couple nice articles on using ADODB. Good luck. Josh Hi everybody I am normally working with ASP and ASPX. Now I want to try PHP. I installed and tried some simple scripts and they are running fine. Now it is time to working with database but i could not find something helpful in the manual. Can someone give me a link or better a code how to connect to a database (SQl and ACCESS) Thanks in advance Raja -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Innodb and transactions.
One other obvious thing to remember is that you need to to use: create table (int id blah blah blah) type = InnoDB; Also, to take advantage of these features you will also need to update your /etc/my.cnf file (assuming you run some *nix flavored OS) so the InnoDB files are created on disk. I found that very slowly reading through the online docs at mysql.com/doc (see section 7.5.2) was adequate to get started. If you don't do this step and you try to create a InnoDB table, MySQL will just create a regular MyISAM table, but it won't even tell you it did that! Not very helpful. You can execute a SHOW TABLE STATUS to see what kind of table MySQL really created though. FYI, MySQL 3.23.51 also has InnoDB support for Foriegn Keys and Delete On Cascade, something I'm really excited to finally see in MySQL. Anyway, enough blabber. Hope you enjoy InnoDB, it's a little tough to get going, but solid once it's setup. Josh Hi, use InnoDB, because InnoDB supports row-level locking, and InnoDB also supports referential-integrity, bye, Steve Bradwell schrieb: So should I be using Innodb tables or BDB tables? Thanks, Steve. -Original Message- From: Michael Bretterklieber [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 2:49 AM To: Php-Db (E-mail) Subject: Re: [PHP-DB] Innodb and transactions. Hi, you have to do something like this: mysql_query('SET AUTOCOMMIT=0'); mysql_query('COMMIT'); or mysql_query('ROLLBACK'); mysql_query('SET AUTOCOMMIT=1'); bye, Steve Bradwell schrieb: Hi all, I have just figured out and set up my Innodb on my mysql server so I can use transactions Begin, commit, rollback. I'm now looking for examples on how to do this with php. I hit the php site and the best I could find was fbsql_commit etc... is this what I'm looking for? There's no documentation yet. I'm using php4 with mysql 3.23.49-max, and my tables are Innodb. I appologize if my lingo is somewhat confusing or just wrong but I'm pretty new to this stuff. Any input or examples would be greatly appreciated. Thanks, Steve. -- -- Michael Bretterklieber LCP JAWA Management Software GmbH Liebenauer Hauptstr. 200 A-8041 GRAZ Tel: ++43-(0)316-403274-12 Fax: ++43-(0)316-403274-10 GSM: ++43-(0)676-93 96 698 [EMAIL PROTECTED] homepage: http://www.jawa.at - privat --- E-mail: [EMAIL PROTECTED] homepage: http://www.inode.at/mbretter -- ...the number of UNIX installations has grown to 10, with more expected... - Dennis Ritchie and Ken Thompson, June 1972 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Josh Trutwin http://trutwins.homeip.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] retrieving one record at a time
Hi to all, I'm new to PHP. I'm trying to retrieve data from a database, but I just want to retrieve one record at a time and go through to the next records by click next record. I know how to retrieve all record by using the mysql_fetch_array, but I'm having problems to select one record at time. Any idea? Thanks in advanced Nato Nato, you can use the MySQL LIMIT feature as part of your SELECT statement to accomplish this. $SQL = SELECT * FROM my_data LIMIT 0, 1; The result that you get with mysql_fetch_array is only one record, the first record that the database returned from the SELECT statement. When your user presses NEXT, you would execute: $SQL = SELECT * FROM my_data LIMIT 1, 1; The second number is the number of records to limit by, in your case only one at a time. The first number is the index of the record that you want to have returned by the database. This number would be a variable in your case that would increment by one when they press NEXT and decrement by one when they press PREVIOUS. Hope that helps you out. Josh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascript problem
I am not a JavaScript expert, but I had a similar problem. I THINK that you need to reference your frames like this: window.parent.frames.rightFrame.document.open(); Give it a try, hope that helps... Josh hi all, i know this is not exactly the place to ask this, but i don't know where else to ask. i'm doing a multiframe project and i'm trying to get one of the pages to change the content of another frame when it loads. in the main.htm i have: html head titleA Global Village?/title ... script src=../../media/scripts/rightside.js type=text/javascript script type=text/javascript !-- rightopen(); rightwrite('Hello', 'www.yahoo.com', 'Yahoo is really good.'); rightclose(); //-- /script /script /head body ... /body /html the included rightside.js file has the three functions: function rightopen () { parent.rightFrame.document.open(); parent.rightFrame.document.write(!DOCTYPE html PUBLIC \-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\\n); parent.rightFrame.document.write( \http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\\n); parent.rightFrame.document.write(html\n); parent.rightFrame.document.write(head\n); parent.rightFrame.document.write(title\/title\n); parent.rightFrame.document.write(meta http-equiv=\Content-Type\ content=\text\/html; charset=iso-8859-1\ \/\n); parent.rightFrame.document.write(link rel=\stylesheet\ href=\media\/scripts\/sidelayout.css\ type=\text\/css\ \/\n); parent.rightFrame.document.write(link rel=\stylesheet\ href=\media\/scripts\/sidetext.css\ type=\text\/css\ \/\n); parent.rightFrame.document.write(script src=\media\/scripts\/scripts.js\ type=\text\/javascript\\/script\n); parent.rightFrame.document.write(\/head\n); parent.rightFrame.document.write(body\n); } function rightwrite (name, url, desc) { parent.rightFrame.document.write(p class=\rightlink\a href=\ + url + \ target=\_blank\ + name + \/abr \/); parent.rightFrame.document.write(desc + \/p); } function rightclose () { parent.rightFrame.document.write(\/body\n); parent.rightFrame.document.write(\/html\n); parent.rightFrame.document.close(); } when i start the file i get a javascript error saying expecting object i'm not sure what i'm doing wrong. any help is appreciated. thanks _ Do You Yahoo!? Get your free yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Josh Trutwin http://trutwins.homeip.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL_connect
On Wednesday 06 March 2002 15:53, [EMAIL PROTECTED] wrote: Hi, I'm new to MySql, when I try to connect my PHP-script with mysql_connect($host, $user, $pass) my script returns the error Fatal error: Call to undefined function: mysql_connect() I have given the user all rights in MySQL, both on host, DB, tables, and fields This might be easy for you, but I'm stuck..any help / comments are appreciated It means you do not have mysql support in PHP. If you compiled PHP yourself, recompile it to include mysql support. If you installed it via RPM then look for the appropriate RPMs from distro vendor. A great way to check this is to create a simple script called phpinfo.php with just this line in it, place it in your top level web directory: ? phpinfo(); ? Point your browser to http://localhost/phpinfo.php (assuming the computer you are using is your web server) You should see the ./configure command used to compile PHP, look for --with-mysql. Josh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Converting Image Data Directly from MySQL
Hello list, I've been stumped on this for a while, I have a large project where I am storing image data in a MySQL db for reasons I will not get into. The images are displayed as thumbnails in a table which are hyperlinks to a large file. The larger file is stored in the db as a BLOB type in GIF format. I have a nice freeware program for creating thumbnails called gifsicle. I thought the following code would work: // connect to db, set up SQL, etc. etc. etc. $image = $row[image_data]; // this is the binary GIF image data Header (Content-type: image/gif); if ($view_type == thumbnail) { passthru (/usr/bin/gifsicle --resize 320x240 . $image); } echo $image; flush(); This script works if called to view an image in full size, but if $view_type is set to thumbnail and the passthru command is executed, nothing is displayed. gifsicle generally works like this: /usr/bin/gifsicle --resize NNNxNNN src_image out_image. I have tried using system and exec as well, nothing seems to work except the following: $fp = fopen(/tmp/tmp.gif,w); fwrite($fp, $image); fclose($fp); passthru(/usr/bin/gifsicle --resize 320x240 /tmp/tmp.gif); This adds a LOT of file system I/O though as it has to write each full sized image stored in the db /tmp and slows things down quite a bit. Does anyone have any other suggestions? My goal is to store only one version of each image file and create smaller versions on the fly. PHP is 4.1.2 on a SuSE Linux 7.3 box, latest Apache server, MySQL 3.23.44. Thanks for your help! Josh Trutwin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php