[PHP-DB] displaying result across 3 cells - where did I go wrong?
Hi All, I'm trying to display results across 3 cells - for example: #5 Perle Cotton 223 | 225 | 301 304 | 326 | 333 #12 Perle Cotton 211 | 223 | 224 225 | 356 | #4 Braid 95 | 100HL | 102 Right NOW it is displaying like: #5 Perle Cotton 223 | 225 301 | 304| 326 #12 Perle Cotton 211 | 223 224 | 225| 356 #4 Braid 95 | 100HL 102 This is the code I am working with: $z =0; while ($thread = db_fetch($tresult)) { // if z is divisible by 3 echo ($z %3 == 0) ? 'tr' : ''; if ($thread_type != $thread['type']) { echo td colspan=\3\{$thread[type]}/td\n; while($z++ %3 !==0) { // if not enough tds - add empty tds until end of tr echo 'tdnbsp;/td'; } // everytime we get here - we have just filled a tr with tds, // so start new tr and output type, then start another new tr echo '/trtrtd colspan=3 type /td/trtr'; $thread_type = $thread[type]; } echo 'td '.$thread[colourID].' /td'; // end the tr on every third cycle echo (++$z %3 == 0) ? '/tr' : ''; } The HTML looks like: tr /tr tr td colspan=3 #5 Perle Cotton /td /tr tr td 223 /td td 225 /td /tr tr td 301 /td td 304 /td td 326 /td /tr tr td 333 /td tdnbsp;/td tdnbsp;/td /tr tr td colspan=3 #12 Perle Cotton /td /tr tr td 211 /td td 223 /td /tr tr td 224 /td td 225 /td td 356 /td /tr tr /tr tr td colspan=3 #4 Braid /td /tr tr td 95 /td td 100HL /td /tr tr td 102 /td can ANYONE see where I have gone wrong? Any guidance is appreciated. Thanks! Aaron
Re: [PHP-DB] displaying result across 3 cells - where did I go wrong?
From: Aaron Wolski [EMAIL PROTECTED] So.. do I need to use 2 different incrementors? $z and say $x for each part? I basically pieced this code together from several examples I found so forgive forgive the fact I don't know a whole lot about the code even though I've tried to understand it as much as possible *shrugs* You could try something like this: while($z % 3 !== 0) { $z++; ... } That way $z is only incremented when there are left over cells to be filled. You may have to play around with it for a bit. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] a bandwitch question
Hi, I have this site that uses PHP and mysql. Now I have a page that has 2 frames in it, a top frame and a bottom frame. Top frame loads a page from the server itself and the bottom frame loads an external website. (off the server) So top frame loads: http://localhost/blah.php And the bottom frame loads: http://www.getpaid2reademails.com/ (example) Now does the localhost generate the bandwitch for that visit from the bottom frame aswell or only the top frame? Cheers! http://personals.yahoo.com.au - Yahoo! Personals - New people, new possibilities! Try Yahoo! Personals, FREE for a limited period! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] maximum memory
Hi to all, The maximum memory size allocated to PHP scripts defaults to 8MB. For very big documents, especially with images, this limit may be reached (the file being built into memory). My question is: does anybody know what is the maximum size you can change php.ini? Thanks, Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Returns Error
UNIQUE gradient (gradient) This is causing your issue. You have stated that new records cannot match an already established record with the same name under gradient. HTH Aaron -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: August 5, 2003 1:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Returns Error Ok, that worked, Now the error I'm getting is Duplicate entry ' ' for key 1 Is this a SQL table error? Here's my Table as entered: CREATE TABLE gradients ( gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, kwo VARCHAR(10) NOT NULL, lsd VARCHAR(10) NOT NULL, date DATE DEFAULT '-00-00' NOT NULL, well VARCHAR(50) NOT NULL, field VARCHAR(25) NOT NULL, uni VARCHAR(30) NOT NULL, license VARCHAR(10) BINARY NOT NULL, formation VARCHAR(20) NOT NULL, perfs VARCHAR(20) NOT NULL, event VARCHAR(1) NOT NULL, fluid VARCHAR(2) NOT NULL, mode VARCHAR(2) NOT NULL, type VARCHAR(2) NOT NULL, vhd VARCHAR(10) NOT NULL, file VARCHAR(15) NOT NULL, kb VARCHAR(6) NOT NULL, grd VARCHAR(10) NOT NULL, open VARCHAR(1) NOT NULL, sour VARCHAR(1) NOT NULL, tube VARCHAR(10) NOT NULL, landed VARCHAR(6) NOT NULL, casing VARCHAR(6) NOT NULL, landed2 VARCHAR(6) NOT NULL, shut_date VARCHAR(10) NOT NULL, shut_time DATE DEFAULT '-00-00' NOT NULL, pres VARCHAR(15) NOT NULL, tag VARCHAR(15) NOT NULL, PRIMARY KEY (lsd), UNIQUE gradient (gradient) ); Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wednesday 06 August 2003 01:14, Jeff wrote: Well I did what you said, and now I get Parse error: parse error, unexpected T_ECHO in C:\FoxServ\www\encana_db.php on line 44 Try: $result = mysql_query($query, $link_id) OR die(mysql_error()); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Byte your tongue. */ -- 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] MySQL Returns Error
Hi... again. :P Been working on this code all weekend, and I did take everyone's advice, but I'm still getting the same error. Error retrieving records. From line $result = mysql_query($query, $link_id) OR DIE(Error retrieving records.); of my code. When I first put the insert query in, it allowed me to add one record, then started returning the error, and hasn't let me enter another record since. Here is the entire code. ?PHP $link_id = mysql_pconnect(localhost,admin,f1r3w0rks) or die(Unable to connect to SQL server); mysql_select_db(kodiak_db,$link_id) or die(Unable to select database); $PHP_SELF=$_SERVER['PHP_SELF']; foreach ($_POST as $var=$value) ${$var}=$value; ? HTML HEAD TITLEDB/TITLE /HEAD BODY BGCOLOR=white a href=index1.php Home /a|a href=list_db.php Display All /a|a href= Search /a BR Total Entries: BRdiv align=centerimg src=http://dataguy/logo_small.jpg BRbEncana Gradient Data Base/BBR/div div align=center FORM METHOD=post ACTION=?php echo $PHP_SELF; ? HRHR PRE b ?php $query = INSERT INTO gradients (kwo, lsd, date, well, field, uni, license, formation) values ('$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation'); $result = mysql_query($query, $link_id) OR DIE(Error retrieving records.); ? KWL WO#: INPUT TYPE=text NAME=kwo VALUE= LSD: INPUT TYPE=text NAME=lsd VALUE= Date Completed: input type=text name=date value= Well Name: INPUT TYPE=text NAME=well VALUE= Fieled/Pool: INPUT TYPE=text NAME=field VALUE= Unique: INPUT TYPE=text NAME=uni VALUE= License #: input type=text name=license value= Formation: input type=text name=formation value= Perfs: input type=text name=perfs value= Event No.: input type=text name=event value= Well Fluid Status: input type=text name=fluid value= Well Status Mode: input type=text name=mode value= Well Status Type: input type=text name=type value=Type V/D/H: input type=text name=vdh value= File Name: input type=text name=file value= KB: input type=text name=kb value= GRD: input type=text name=grd value= Open Hole: input type=text name=open value= Sour: input type=text name=sour value= Tubing Size: input type=text name=tube value= Landed @: input type=text name=landed value= Casing Size: input type=text name=casing value= Landed @: input type=text name=landed2 value= Shut In Date: input type=text name=shut_date value= Shut In Time: input type=text name=shut_time value= Pres TUB/CAS KPAg: input type=text name=pres value= Tag PBTD: input type=text name=tag value= br HRHR INPUT TYPE=submit VALUE=Submit /PRE/b /FORM /div BRBR /head /HTML -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] a bandwitch question
on 5/8/03 12:20 pm, JeRRy at [EMAIL PROTECTED] wrote: So top frame loads: http://localhost/blah.php And the bottom frame loads: http://www.getpaid2reademails.com/ (example) Now does the localhost generate the bandwitch for that visit from the bottom frame aswell or only the top frame? They are separate. Localhost knows nothing about the bottom frame as it is only loaded by the frameset when it is client side. It behaves the same way as if you had 2 browser windows open pulling in the two URLs. -- Mike Karthauser Managing Director - Brightstorm Ltd Email[EMAIL PROTECTED] Web http://www.brightstorm.co.uk Tel 0117 9426653 (office) 07939 252144 (mobile) SnailmailUnit 8, 14 King Square, Bristol BS2 8JJ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Returns Error
Change the gradient definition to: gradient MEDIUMINT(10) NOT NULL AUTO_INCREMENT, -Original Message- From: Jeff [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 1:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Returns Error Ok, that worked, Now the error I'm getting is Duplicate entry ' ' for key 1 Is this a SQL table error? Here's my Table as entered: CREATE TABLE gradients ( gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, . tag VARCHAR(15) NOT NULL, PRIMARY KEY (lsd), UNIQUE gradient (gradient) ); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL Returns Error
Ok, that worked, Now the error I'm getting is Duplicate entry ' ' for key 1 Is this a SQL table error? Here's my Table as entered: CREATE TABLE gradients ( gradient MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT, kwo VARCHAR(10) NOT NULL, lsd VARCHAR(10) NOT NULL, date DATE DEFAULT '-00-00' NOT NULL, well VARCHAR(50) NOT NULL, field VARCHAR(25) NOT NULL, uni VARCHAR(30) NOT NULL, license VARCHAR(10) BINARY NOT NULL, formation VARCHAR(20) NOT NULL, perfs VARCHAR(20) NOT NULL, event VARCHAR(1) NOT NULL, fluid VARCHAR(2) NOT NULL, mode VARCHAR(2) NOT NULL, type VARCHAR(2) NOT NULL, vhd VARCHAR(10) NOT NULL, file VARCHAR(15) NOT NULL, kb VARCHAR(6) NOT NULL, grd VARCHAR(10) NOT NULL, open VARCHAR(1) NOT NULL, sour VARCHAR(1) NOT NULL, tube VARCHAR(10) NOT NULL, landed VARCHAR(6) NOT NULL, casing VARCHAR(6) NOT NULL, landed2 VARCHAR(6) NOT NULL, shut_date VARCHAR(10) NOT NULL, shut_time DATE DEFAULT '-00-00' NOT NULL, pres VARCHAR(15) NOT NULL, tag VARCHAR(15) NOT NULL, PRIMARY KEY (lsd), UNIQUE gradient (gradient) ); Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wednesday 06 August 2003 01:14, Jeff wrote: Well I did what you said, and now I get Parse error: parse error, unexpected T_ECHO in C:\FoxServ\www\encana_db.php on line 44 Try: $result = mysql_query($query, $link_id) OR die(mysql_error()); -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Byte your tongue. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MySQL Returns Error
Jeff, First, let me apologize if I'm reiterating something already said, but I'm new to the newsgroup. What does mysql say the problem was? That is, if you put echo mysql_error(); immediately after the query, what does it say? Is it possible you have one of the fields set to be unique in your db and are trying to insert duplicate data? Bill Anderson Jeff wrote: Hi... again. :P Been working on this code all weekend, and I did take everyone's advice, but I'm still getting the same error. Error retrieving records. From line $result = mysql_query($query, $link_id) OR DIE(Error retrieving records.); of my code. When I first put the insert query in, it allowed me to add one record, then started returning the error, and hasn't let me enter another record since. Here is the entire code. ?PHP $link_id = mysql_pconnect(localhost,admin,f1r3w0rks) or die(Unable to connect to SQL server); mysql_select_db(kodiak_db,$link_id) or die(Unable to select database); $PHP_SELF=$_SERVER['PHP_SELF']; foreach ($_POST as $var=$value) ${$var}=$value; ? HTML HEAD TITLEDB/TITLE /HEAD BODY BGCOLOR=white a href=index1.php Home /a|a href=list_db.php Display All /a|a href= Search /a BR Total Entries: BRdiv align=centerimg src=http://dataguy/logo_small.jpg BRbEncana Gradient Data Base/BBR/div div align=center FORM METHOD=post ACTION=?php echo $PHP_SELF; ? HRHR PRE b ?php $query = INSERT INTO gradients (kwo, lsd, date, well, field, uni, license, formation) values ('$kwo', '$lsd', '$date', '$well', '$field', '$uni', '$license', '$formation'); $result = mysql_query($query, $link_id) OR DIE(Error retrieving records.); ? KWL WO#: INPUT TYPE=text NAME=kwo VALUE= LSD: INPUT TYPE=text NAME=lsd VALUE= Date Completed: input type=text name=date value= Well Name: INPUT TYPE=text NAME=well VALUE= Fieled/Pool: INPUT TYPE=text NAME=field VALUE= Unique: INPUT TYPE=text NAME=uni VALUE= License #: input type=text name=license value= Formation: input type=text name=formation value= Perfs: input type=text name=perfs value= Event No.: input type=text name=event value= Well Fluid Status: input type=text name=fluid value= Well Status Mode: input type=text name=mode value= Well Status Type: input type=text name=type value=Type V/D/H: input type=text name=vdh value= File Name: input type=text name=file value= KB: input type=text name=kb value= GRD: input type=text name=grd value= Open Hole: input type=text name=open value= Sour: input type=text name=sour value= Tubing Size: input type=text name=tube value= Landed @: input type=text name=landed value= Casing Size: input type=text name=casing value= Landed @: input type=text name=landed2 value= Shut In Date: input type=text name=shut_date value= Shut In Time: input type=text name=shut_time value= Pres TUB/CAS KPAg: input type=text name=pres value= Tag PBTD: input type=text name=tag value= br HRHR INPUT TYPE=submit VALUE=Submit /PRE/b /FORM /div BRBR /head /HTML -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] displaying result across 3 cells - where did I go wrong?
From: Aaron Wolski [EMAIL PROTECTED] while($z++ %3 !==0) [snip] echo (++$z %3 == 0) ? '/tr' : ''; The first time through your code, $z is zero. Since the thread titles don't match, your going to get to your while loop above. $z is zero, so your while loop isn't executed, but $z is incremented to one. Then, later in your code you increment $z to two and check for the modulus 3. So basically, every time you switch thread titles, $z is incremented one more than it should be and you miss out on one cell in the following row. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How do I make PHP aware of Interbase/Firebird?
Hi Please help. I have installed Apache and PHP, and they are working together. I have Firebird installed on a different server. I want to have my PHP pages to talk to the remote database, but when I try to use the Interbase functions, I get: Fatal error: Call to undefined function: ibase_connect() Clearly, my PHP does not know about Interbase/Firebird. Do I edit the php.ini file? Do I have to reinstall PHP? If I have to reinstall, is it possible to do it from YAST or will I have to compile the code with specific options? Is there documentation about this anywhere? Please assist. Thanks Evan Morris [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Table locks
Tim Best wrote: Anyone know how you set a lock in a MySQL table using PHP? I tried: $select = LOCK TABLES t1 WRITE;; $select .= select * from t1;; $select .= UNLOCK tables;; When I run mysql_db_query(db,$select,$conn); it always returns nothing. Any insights would be appreciated! Run one query at a time. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] dual-processors and php
My php scripts that work well on single-processor machines will not work when I put them on a dual-processor server running RedHat 8.0. Is this a matter of settings in php or in the mysql database that provides the data? I can connect to the database through the php.include scripts, but then I get the message no database in use from mysql_error() when it comes to making queries. I've tried these scripts on two different dual- processor machines and get the same result. I've also tried various combinations of the host name (localhost, 127.0.0.1, real IP address). Before upgrading to RedHat 8.0 on these machines, the scripts did work, however. Did you change any of the database settings? Are you getting an error after your call to mysql_select_db()? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php