[PHP-DB] Fw: PHP amd MYSQL
Following my earlier message I had some replies which suggested a way to solve my problem. Unfortuantelu I cannot seem to get the suggested code to work. This may well be because I have mistyoed something. The script I am running is: ? session_start(); ? html body user:?=$_SESSION['dbauser']?br password:?=$_SESSION['dbapassword']?br A HREF=modifycataloguerange.htm TARGET=LowerIMG SRC=/jpg/modify.jpg BORDER=0/A/LEFT A HREF=addcataloguerange.htm TARGET=LowerIMG SRC=/jpg/addnew.jpg BORDER=0/A/LEFT A HREF=deletecataloguerange.htm TARGET=LowerIMG SRC=/jpg/deleterow.jpg BORDER=0/A/LEFT ?php /* Connecting, selecting database */ $link = mysql_pconnect(localhost,$_SESSION['dbauser'],$_SESSION['dbapassword']) or die(Could not connect); print Connected successfullyP; mysql_select_db(stamps) or die(Could not select database); $result = mysql_query(SELECT * FROM CATALOGUE_RANGES); /* Table definition: CREATE TABLE catalogue_ranges( catalogue_range_key INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, sg_start_number VARCHAR(80) NOT NULL, sg_end_number VARCHAR(80) NOT NULL) TYPE=InnoDB ; */ /* print (TABLE BORDER=5 WIDTH=90%); print (TR); print (TD WIDTH=20% BID /B); print (TD WIDTH=30% BStart Number/B); print (TD WIDTH=30% BEnd Number/B); print (TD WIDTH=10% BModify/B); print (TD WIDTH=10% BDelete/B); */ foreach($result as $row){ echo 'trtda href=delete.php?id='.$row[catalogue_range_key].''.$row[sg_start_number].' /a/td/tr'; } ? /body /html The screen displays the icons and the connection message but nothing else The error log from apache is: [Fri Jun 07 16:07:55 2002] [info] Parent: Created child process -1734187 [Fri Jun 07 16:07:55 2002] [info] Parent: Duplicating socket 104 and sending it to child process -1734187 [Fri Jun 07 16:07:56 2002] [info] BytesRead = 372 WSAProtocolInfo = 020 [Fri Jun 07 16:08:38 2002] [error] PHP Warning: Invalid argument supplied for foreach() in c:\usr\www\my-domain\cataloguerangeslist.php on line 27 [Fri Jun 07 16:09:43 2002] [error] PHP Warning: Invalid argument supplied for foreach() in c:\usr\www\my-domain\cataloguerangeslist.php on line 27 [Fri Jun 07 16:10:08 2002] [info] master_main: Shutdown event signaled. Shutting the server down. [Fri Jun 07 16:10:10 2002] [info] removed PID file c:/usr/local/apache/logs/httpd.pid (pid=-1747971) Can anyone please tell me what the problem is. Is there any documentation which directly relates to using PHP with MySQL? Regards Peter Goggin - Original Message - From: Peter Goggin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 05, 2002 11:54 PM Subject: PHP amd MYSQL I am setting up a web page system which involves html pages, php pages and mysqldatabase. I have a number of questions and do not know where to find answers. If I display the rows from a database table in a php generated html table is it possible to mark a row so that it can be deleted or modified by calling another php page? If so is this documented anywhere? Is there any good source of information on setting up 'forms'to work like Oracle forms where database records can be inserted, updated or deleted? Regards Peter Goggin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fw: PHP amd MYSQL
On Friday 07 June 2002 14:27, Peter Goggin wrote: Following my earlier message I had some replies which suggested a way to solve my problem. Unfortuantelu I cannot seem to get the suggested code to work. This may well be because I have mistyoed something. OK we'll work back to front on this one. Is there any documentation which directly relates to using PHP with MySQL? Yes. Loads. Really. google - mysql php tutorial should turn up bucket loads of the stuff. The screen displays the icons and the connection message but nothing else It's good to isolate the parts of the log which indicates the error on hand The error log from apache is: [Fri Jun 07 16:07:55 2002] [info] Parent: Created child process -1734187 [Fri Jun 07 16:07:55 2002] [info] Parent: Duplicating socket 104 and sending it to child process -1734187 [Fri Jun 07 16:07:56 2002] [info] BytesRead = 372 WSAProtocolInfo = 020 Which is really just this one line: [Fri Jun 07 16:08:38 2002] [error] PHP Warning: Invalid argument supplied for foreach() in c:\usr\www\my-domain\cataloguerangeslist.php on line 27 And again because you ran the script again: [Fri Jun 07 16:09:43 2002] [error] PHP Warning: Invalid argument supplied for foreach() in c:\usr\www\my-domain\cataloguerangeslist.php on line 27 The error suggests something is wrong on line 27. Which is this part here: foreach($result as $row){ echo 'trtda href=delete.php?id='.$row[catalogue_range_key].''.$row[sg_start_number]. ' /a/td/tr'; } Please in future if the error messages mention a line number, _do_ indicate on your code which line that is. OK the error says that the argument(s) supplied to foreach is incorrect. Reading the manual entry for foreach() should reveal that the argument in question is $result. Where is $result being set? Here: $result = mysql_query(SELECT * FROM CATALOGUE_RANGES); Reading the manual entry for mysql_query() reveals that it returns a resource identifier. Further it says mysql_query() returns a new result identifier that you can pass to mysql_fetch_array() and other functions dealing with result tables. Can anyone please tell me what the problem is. Basically as it stands, $result is a pointer to a set of results returned from the DB. To get at the actual results themselves you need to run mysql_fetch_array() (or similar, see manual). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* This week only, all our fiber-fill jackets are marked down! */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Using PHP on Cygwin-apache on W2k
A few questions, on which I cannot find the answer myself :( - Where should I place my php.ini? (is it still c:\winnt\system32) - Where do I place the module needed for apache? - How do I include php in apache (the 'loadmodule...' and-so-on) Thnx for reading, hope anyone has an answer... Menno _ Meld je aan bij de grootste e-mailservice wereldwijd met MSN Hotmail: http://www.hotmail.com/nl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL won't return results to screen.
Edit your php.ini and log all errors to a file and then review the filesalso you can turn on all errors and warnings to be displayed---this has helped me many times... Thank you, RAY HUNTER -Original Message- From: Blaine Dinsmore [mailto:[EMAIL PROTECTED]] Sent: Friday, June 07, 2002 1:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL won't return results to screen. Im using PHP 4.2.1, MySQL 4.23.49 and IIS 4.0 on a Windows NT 4.0 Server machine. I have success when adding data to the database using PHP but getting it to report to the webpage I have had no luck. I only get a blank screen despite using error trapping for all mysql functions. Does anyone know what this could be? Thanks, Blaine -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Slow performance (PHP MYSQL)
PHP is known to be verry fast. MySQL as well. So your problem my be somewhere else. I am doing a similar thing on my site with thumbnails. Check it out on http://www.globosapiens.net Andy -- http://www.globosapiens.net Global Travellers Network! Radek Zajkowski [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am making pages for a client signed up with verio under signature hosting. The pages are very simple request from db for thumbnails, which are displayed 4 at a time etc. could it be because I'm generating the entire pages via PHP eg. echo(html) echo(head) echo(titleI'm so slow/title) echo(/head) etc. etc. as oppose to embedding the php into the html R Thanks in advance. --__-__-__ eat pasta type fasta -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL won't return results to screen.
Do you have SELECT permissions for your httpd user on the DB? Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: Blaine Dinsmore [mailto:[EMAIL PROTECTED]] Sent: Friday, June 07, 2002 2:44 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL won't return results to screen. Im using PHP 4.2.1, MySQL 4.23.49 and IIS 4.0 on a Windows NT 4.0 Server machine. I have success when adding data to the database using PHP but getting it to report to the webpage I have had no luck. I only get a blank screen despite using error trapping for all mysql functions. Does anyone know what this could be? Thanks, Blaine -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL problem on Yellow Dog Linux
On 6/6/02 4:48 PM, Jason Wong [EMAIL PROTECTED] wrote: On Friday 07 June 2002 04:36, Garrett Nelson wrote: I'm a relative newbie to the Linux/web server world, having worked with Macs most of my life. I recently installed the Server install of Yellow Dog Linux, with no window managers, CLI only. Everything is working pretty much correctly, except PHP interaction with MySQL. When I tried to install Invision Board, I got the following error Fatal error: Call to undefined function: mysql_connect() in /var/www/default/forums/sm_install.php on line 249 It means there's no support in php for mysql I figured this meant MySQL or PHP was configured incorrectly so I installed PhpMyAdmin to see if that would work, and I got the error message cannot load MySQL extension, please check PHP Configuration. ditto What needs to be configured? I was under the impression that MySQL support was built into PHP now and that it needs no extension. Yes and no. PHP has 'builtin' support for MySQL but it needs to be enabled at compile time. I downloaded the RPM of PHP 4.1.2 (the latest PPC RPM available at rpmfind) and it told me it was already installed. I then installed MySQL 3.23.41 to no effect. So what can I do to fix this? Try looking for an RPM with both 'php' and 'mysql' in its name. Eg for Redhat a suitable rpm would be named: php-mysql-4.1.2-7.i386.rpm. Hrm I now downloaded php-mysql-4.1.2-1a.ppc.rpm from rpmfinder, and again I get rpm -ivh php-mysql* Preparing...### [100%] package php-mysql-4.1.2-1a is already installed (Same error with -Uvh, too) So I suppose it's something else. Do I have to uninstall PHP first? Or, again, could it be something wrong with the PHP configs? Is php.ini the only config file that might need to be edited? -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Anyone know why this won't return results?
html head titleResults Test/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FF text=#00 ?php $server = mdotlims; $user = httpuser; $pass = pass; $db = mysql_connect($server,$user,$pass); if (!$db) { echo( pUnable to connect to the . database server at this time./p); exit(); } if (! mysql_select_db(lims_issues)) { echo(Unable to locate the issues . database at this time./p ); exit(); } $result = mysql_query(SELECT Notes FROM Bugs); if (!$result) { echo(pError performing query: . mysql_error() . /p); exit(); } While( $myrow = mysql_fetch_array($result) );{ echo (BR . $myrow[NOTES]); } mysql_free_result($result); ? /body /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Anyone know why this won't return results?
At 17:45 -0400 6/7/02, Blaine Dinsmore wrote: html head titleResults Test/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FF text=#00 ?php $server = mdotlims; $user = httpuser; $pass = pass; $db = mysql_connect($server,$user,$pass); if (!$db) { echo( pUnable to connect to the . database server at this time./p); exit(); } if (! mysql_select_db(lims_issues)) { echo(Unable to locate the issues . database at this time./p ); exit(); } $result = mysql_query(SELECT Notes FROM Bugs); if (!$result) { echo(pError performing query: . mysql_error() . /p); exit(); } While( $myrow = mysql_fetch_array($result) );{ You have a semicolon on the previous line, which terminates the while loop - a bit prematurely, I'd guess. :-) echo (BR . $myrow[NOTES]); } mysql_free_result($result); ? /body /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Anyone know why this won't return results?
Thanks Paul, You were absolutely right! I can't believe I didn't see that hidden in there. That explains why I never got any error messages. Thanks again, Blaine Paul DuBois [EMAIL PROTECTED] 06/07/02 05:55PM At 17:45 -0400 6/7/02, Blaine Dinsmore wrote: html head titleResults Test/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#FF text=#00 ?php $server = mdotlims; $user = httpuser; $pass = pass; $db = @mysql_connect($server,$user,$pass); if (!$db) { echo( pUnable to connect to the . database server at this time./p); exit(); } if (! @mysql_select_db(lims_issues)) { echo(Unable to locate the issues . database at this time./p ); exit(); } $result = @mysql_query(SELECT Notes FROM Bugs); if (!$result) { echo(pError performing query: . mysql_error() . /p); exit(); } While( $myrow = mysql_fetch_array($result) );{ You have a semicolon on the previous line, which terminates the while loop - a bit prematurely, I'd guess. :-) echo (BR . $myrow[NOTES]); } mysql_free_result($result); ? /body /html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] no subject
I have a huge database that some of the content need to be update weekly or even daily. I wrote a PHP script for that purpose. It's supposed to get the data from database, find the URL, fopen() it, find the information, then update it back into the database. Unfortunately, everytime I run the script I get an error message from browser saying attempt loading page MyPage's URL failed. Some guy indicated the problem is probably caused by PHP execution timeout. I tried to set the time longer, no luck. Tried to use flush() after each data, no luck. Now I gotta think of other ways to do this. I am thinking about using AppleScript (I am using OS X). Does anyone know how to communicate with MySQL via AppleScript, if possible? Thanks. Tony S. Wu [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Unique SQL query?????????????
Is there any SQL command that will return a list of *unique* entries from a fied. ie only repeat one for duplicates i have a database of products, each having a category, and obviously a lot of products have the same category and I want to create an index of all the different categories. thanks -- Regards, Georgie Casey [EMAIL PROTECTED] *** http://www.filmfind.tv Online Film Production Directory *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MyCC Problem
Hi all. I know that this isnt probably the best place to make this question, but I uses that some of you uses MyCC to connect to a remote MySQL DB. My connection is no problem, but when I issue a SQL command, which tells the DB to INSERT multiple rows into one table, It gives me an error every time. Imagine what it takes to pass a 1000 rows to the live DB one each time. Does anyone who uses MyCC had this problem before? Know how to solve this? Thanks in advance, Cesar mailto:[EMAIL PROTECTED] Aracena CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621
[PHP-DB] MS Access DB Open as file ?
Hi All, I'm new in PHP and I whether I can open a MS Access database file directly with PHP? There is a thing called ODBC but in the function odbc_connect(), The first parameter is something called dsn, what's that? And does that mean I can't open the MS Access database directly by somehow only giving it's path? Thanks. Ivan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Unique SQL query?????????????
On Saturday 08 June 2002 08:42, Georgie Casey wrote: Is there any SQL command that will return a list of *unique* entries from a fied. ie only repeat one for duplicates i have a database of products, each having a category, and obviously a lot of products have the same category and I want to create an index of all the different categories. SELECT DISTINCT category FROM products -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Ocean: A body of water occupying about two-thirds of a world made for man -- who has no gills. -- Ambrose Bierce */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] no subject
On Saturday 08 June 2002 07:02, Tony wrote: Please enter a subject when you post. I have a huge database that some of the content need to be update weekly or even daily. I wrote a PHP script for that purpose. It's supposed to get the data from database, find the URL, fopen() it, find the information, then update it back into the database. Unfortunately, everytime I run the script I get an error message from browser saying attempt loading page MyPage's URL failed. Some guy indicated the problem is probably caused by PHP execution timeout. I tried to set the time longer, no luck. Tried to use flush() after each data, no luck. If this is a php-db question post your code ... Now I gotta think of other ways to do this. I am thinking about using AppleScript (I am using OS X). Does anyone know how to communicate with MySQL via AppleScript, if possible? Thanks. ... if it's an AppleScript question, post on the AppleScript list (assuming there is one). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* share, n.: To give in, endure humiliation. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php