Re: [PHP-DB] How to avoid: Warning: Page has Expired
Using the GET method is a great solution, but sometimes you just gotta POST! I have found the best solution to be using a separate file to do the processing. For example login.php submits 'user' and 'password' to auth.php. auth.php queries the db for 'user' and 'password' and redirects [via header()] to whatever.php or back to login.php if login was unsuccessful. olinux --- John Hughes <[EMAIL PROTECTED]> wrote: > I have the first part of the kids' soccer photo > database site up that I > mentioned in an earlier post. > > The site displays nine image thumbnails. You click > on the thumbnails and are > taken to a full size photo. Everything works as > expected for the first nine > images but when you go to the next page of > thumbnails, you start getting: > > Warning: Page has Expired The page you > requested was created using > information > you submitted in a form. This page is no > longer available. As a > security precaution, > Internet Explorer does not automatically > resubmit your information > for you. > > To resubmit your information and view this > Web page, click the > Refresh button. > > What causes this and how can I fix it so this > doesn't happen? > > The URL for this site is > http://fuzzheads.org/barcelona > > TIA > > John Hughes > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] LOBS with CURSOR_SHARING=FORCE gives core dump
I have the following php code. If I add the parameter CURSOR_SHARING=FORCE in my init.ora and while executing the program I get the "Segmentation fault". $ /usr/local/php4/bin/php -q curshare.php Segmentation fault (core dumped) Is there any work-around for this? Is this a bug? This seems to be happening only when LOB with returning clause is present. I tested a similar program from "C" program and is fine. Note: currently I have set the parameter (CURSOR_SHARING=FORCE ) only in the program/session level. Thanks, Prince. $ cat curshare.php #!/usr/local/php4/bin/php -q -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Mysql and memory issue
Trond Erling Hundal wrote: > Hi, maybe this list isn't the best place to ask for this but... This is the right place. > I keep getting "memory exhausted" errors from mysql, on a system running > as mail/mysql/apache+php server. (rh7.1) > Is it my queries that are inefficient? Is it my modelling-scheme that > sucks or could it be that mysql is leaking memory in some way? > Would it help to move mysql to a separate machine? If you do normal query, mysql store whole result in memory! You can avoid that. It's in the manual. -- Yasuo Ohgaki -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP tags in a MySQL echo
> Is there any way to work around this and get it to treat all the echoed rows > as PHP not just only text? Wrap the print around an eval(): print(eval($string)); -j. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP tags in a MySQL echo
Hello Everyone, I'm currently working on a simple template system, where, all the html and few php tags are called from a database so I can easily update the site content via a form, e.t.c., that works fine. However, when I echo the text, the html/php, the php tags to not process. I figure the PHP server is not treating the text as PHP code but regular text, because its just simple lines which include() other php files. Is there any way to work around this and get it to treat all the echoed rows as PHP not just only text? Adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] AOL Problems
Hello!! So is the old value of "new location" not being passed to the next page? OR Is the new "category" variable not being passed to the next page?? Dan On Tuesday, April 9, 2002, at 12:44 PM, [EMAIL PROTECTED] wrote: > Hi group, > > I wonder if anyone can help me with some problems I have just found out > with a website we have just put together. > > Our client unfortuntately uses the AOL browser on a MAC, so he is > running version 5 of AOL for the mac. > > Now we have a database driven website we have put together, and the > problem occurs as the values do not seem to be getting sent to the > database and so therefore he is not getting the correct results that he > should be. > > We have a bookstore, where you intially select your location in the > world, and then also a category to select the books. > > This is fine as it queries the database and returns the results to him. > Then on the results page we have the category list so that they can go > to another category, they do not have to select a new location as the > values are already carried over each page. But what happens is that > when they choose the new category and click submit, it does not change > anything on the page, so they get the same results even though they > have sent a new value to the server. > > Has anybody had this problem, and is there a fix? > > Help would be appreciated as this is the last problem we have to fix > before this site can go live. > > Many thanks > > > Barry Zimmerman > www.bzdpltd.co.uk > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Join?
Hi Volker, after studying your code (not so easy to find without formating and lots of html), I think what you want to do is somthing like this: $abfrage = 'SELECT A.id AS aid, A.autor AS aauthor, A.zeit,AS azeit' .' A.betreff AS abetreff, A.inhalt AS ainhalt,' .' U1.vorname AS autorv, U1.nachname AS autorn,' .' K.autor AS kautor, K.zeit AS kzeit, .' K.betreff AS kbetreff, K.inhalt AS kinhalt' .' U2.vorname AS autorkv, U2.nachname AS autorkn,' .' FROM ts_artikel AS A' .' INNER JOIN ts_users AS U1 ON A.author=U1.id' .' INNER JOIN ts_kommentar AS K ON A.id=K.artikel_id' .' INNER JOIN ts_users AS U2 ON K.author=U2.id' .' ORDER BY A.zeit, K.zeit DESC ' . $limit; $resultat = mysql_query($abfrage) or die (mysql_error()); while ($row = mysql_fetch_assoc($resultat)) { // take care if the article id is changing echo 'whatever'; } Ciao, Lutz [EMAIL PROTECTED] (Volker Hartmann) writes: > Hi, > > I've got a problem with database abstraction. There are two tables. One with > articles (id,content,author,time) and one with comments on those articles > (id,article_id,content,author,time). My script looks like this: > > function show_news($limit){ > /* get db parameters and connect to db */ > > require ("inc/db_parameter.inc.php"); > $connect = mysql_connect($dbhost,$dbuser,$dbpasswd) or die("Can't connect to > database"); >mysql_select_db($dbname,$connect) or die(mysql_error()); > > $abfrage = "SELECT id,autor,zeit,betreff,inhalt FROM ts_artikel ORDER BY > zeit DESC" . $limit; > $resultat = mysql_query($abfrage) or die (mysql_error()); > > /* get articles and display*/ > > While ($row = mysql_fetch_array($resultat, MYSQL_ASSOC)) { > > /* get author */ > > $abfrage2 = "SELECT vorname,nachname FROM ts_users WHERE id='" . > $row["autor"] ."'"; > $resultat2 = mysql_query($abfrage2) or die (mysql_error()); > list($autorv, $autorn) = mysql_fetch_row($resultat2); > > /* get comments */ > > $abfrage3 = "SELECT autor,zeit,betreff,inhalt FROM ts_kommentar WHERE > artikel_id='" . $row["id"] . "' ORDER BY zeit ASC"; > $resultat3 = mysql_query($abfrage3) or die (mysql_error()); > > /* generate display */ > > echo " style='width:100%;margin:0'> style='text-align:left;'>" . htmlentities($autorv). " " . > htmlentities($autorn); > echo "" . strftime("%A > %d.%m.%Y,%H:%M:%S", $row["zeit"]); > echo "" . nl2br(chop($row["betreff"])) . > ":" . nl2br(chop($row["inhalt"])) . ""; > /* get comments of there are some */ > if (!mysql_num_rows($resultat3) < 1) { > while ($row2 = mysql_fetch_array($resultat3)) { > $abfrage4 = "SELECT vorname,nachname FROM ts_users WHERE id='" . > $row2["autor"] . "'"; /*get author for comments */ > $resultat4 = mysql_query($abfrage4) or die (mysql_error()); > list($autorkv, $autorkn) = mysql_fetch_row($resultat4); > echo " src='img/arrow.png' border='0' height='10' width='10'> " . > htmlentities($autorkv) . " " . htmlentities($autorkn) . " class='commenthead' style='text-align:right'>" . strftime("%A > %d.%m.%Y,%H:%M:%S", $row2["zeit"]); > echo "" . > nl2br(chop($row2["betreff"])) . ":" . nl2br(($row2["inhalt"])); > echo ""; > } > } > echo "Kommentar > schreiben"; > } > } > > As you can see, there are some queries within while-loops. > > Is there a more elegant and performant way to do those queries? I thought of > JOIN, but I cannot see how to do it. > > Any help would be appreciated > > TIA Volker -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] If statement for sql statement
On Wednesday 10 April 2002 12:32, jas wrote: > Ok here is my question... I have a form that reads the contents of a > directory, places the resulting files into a select box within a form for > further processing, code is as follows: [snip] > What I need to know is if there is a way to create an if statement that > would either update or not update a selected field in the database. Below > is a piece I would assume would work however I am not sure of the mysql > command to not update anything. Any help would be great. > Jas > > if( $file_name = '--' ) $sql = "dont update table"; > else $sql = "UPDATE $table_name SET image01_t = \"$files\""; Am I missing something? Psuedo-code: if ($file_name != '--') { $sql = "UPDATE "; $result = $mysql_query($sql); etc; etc; } else { don't even need an else! } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* The sun never sets on those who ride into it. -- RKO */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] AOL Problems
Hi group, I wonder if anyone can help me with some problems I have just found out with a website we have just put together. Our client unfortuntately uses the AOL browser on a MAC, so he is running version 5 of AOL for the mac. Now we have a database driven website we have put together, and the problem occurs as the values do not seem to be getting sent to the database and so therefore he is not getting the correct results that he should be. We have a bookstore, where you intially select your location in the world, and then also a category to select the books. This is fine as it queries the database and returns the results to him. Then on the results page we have the category list so that they can go to another category, they do not have to select a new location as the values are already carried over each page. But what happens is that when they choose the new category and click submit, it does not change anything on the page, so they get the same results even though they have sent a new value to the server. Has anybody had this problem, and is there a fix? Help would be appreciated as this is the last problem we have to fix before this site can go live. Many thanks Barry Zimmerman www.bzdpltd.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: executing cgi
On Tuesday 09 April 2002 10:49, David Robley wrote: > In article <000d01c1df6c$962e8e20$0300a8c0@alex>, [EMAIL PROTECTED] > says... > > > hey guys, > > > > kinda OT for the db list, but since most ppl know a lot about php can > > somehow tell me how to execute a cgi script within a php page? > > > > Thanks! > > I could, but I'll just point you to the manual and the Program Execution > functions. For being OT. > > Mind turning word wrap on, please? And if you want further info, this was discussed at some length on the php-general list just last week. Search the archives. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* In Brooklyn, we had such great pennant races, it made the World Series just something that came later. -- Walter O'Malley, Dodgers owner */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function
On Wednesday 10 April 2002 00:12, Nick wrote: > Hi: > thank you for you e mail > I am using redhat7.2 > I am new to php and linux , do not know how to configure mysql into php Install: php-mysql-4.0.6-7.i386.rpm it's on the second disc. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Lying is an indispensable part of making life tolerable. -- Bergan Evans */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mysql and memory issue
Hi, maybe this list isn't the best place to ask for this but... I keep getting "memory exhausted" errors from mysql, on a system running as mail/mysql/apache+php server. (rh7.1) Is it my queries that are inefficient? Is it my modelling-scheme that sucks or could it be that mysql is leaking memory in some way? Would it help to move mysql to a separate machine? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] If statement for sql statement
Ok here is my question... I have a form that reads the contents of a directory, places the resulting files into a select box within a form for further processing, code is as follows: --"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "$file_name"; } } $file_list .= ""; closedir($dir); ?> This portion works great... now on index_done.php3 it takes the resulting selection and places it into the db table, code is as follows: http://localhost/images/";; $db_name = "database"; $table_name = "image_path"; $connection = @mysql_connect("localhost", "user_name", "password") or die ("Could not connect to database. Please try again later."); $db = @mysql_select_db("$db_name",$connection) or die ("Could not select database table. Please try again later."); $sql = "UPDATE $table_name SET image01_t=\"$file_var$files\""; $result = @mysql_query($sql, $connection) or die ("Could not execute query. Please try again later."); ?> What I need to know is if there is a way to create an if statement that would either update or not update a selected field in the database. Below is a piece I would assume would work however I am not sure of the mysql command to not update anything. Any help would be great. Jas if( $file_name = '--' ) $sql = "dont update table"; else $sql = "UPDATE $table_name SET image01_t = \"$files\""; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to avoid: Warning: Page has Expired
I've addressed this problem here: http://php.sitecreative.com/faq.php - Jonathan -Original Message- From: John Hughes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 12:30 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to avoid: Warning: Page has Expired I have the first part of the kids' soccer photo database site up that I mentioned in an earlier post. The site displays nine image thumbnails. You click on the thumbnails and are taken to a full size photo. Everything works as expected for the first nine images but when you go to the next page of thumbnails, you start getting: Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. What causes this and how can I fix it so this doesn't happen? The URL for this site is http://fuzzheads.org/barcelona TIA John Hughes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function
Hi: thank you for you e mail I am using redhat7.2 I am new to php and linux , do not know how to configure mysql into php I wrote a simple function to ask the user for two numbers and add them together and print them out, and it worked. But when I used predefined function, I get the error. where do I go from here? Thanks - Original Message - From: "Julie Meloni" <[EMAIL PROTECTED]> To: "Nick" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 09, 2002 9:44 AM Subject: Re: [PHP-DB] undefined function > N> Fatal error: Call to undefined function: mysql_connect() in > N> /var/www/html/action.php on line 13 > > > This indicates you do not have MySQL support built into PHP. Assuming > a non-Windows OS by the pathnames above, you must use --with-mysql when > issuing the configure command when building PHP. > > > > - Julie > > --> Julie Meloni > --> [EMAIL PROTECTED] > --> www.thickbook.com > > Find "Sams Teach Yourself MySQL in 24 Hours" at > http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to avoid: Warning: Page has Expired
If you change the form action to 'get' instead of 'post' this avoids the message. 'Get' data is displayed on the address line eg http://domain.com/script.php3?photoID=123&viewtype=full so it should be avoided for sensistive data like passwords or credit card numbers. This kind of data should always use 'post' HTH Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: John Hughes [mailto:[EMAIL PROTECTED]] > Sent: 09 April 2002 08:30 > To: [EMAIL PROTECTED] > Subject: [PHP-DB] How to avoid: Warning: Page has Expired > > > I have the first part of the kids' soccer photo database site up that I > mentioned in an earlier post. > > The site displays nine image thumbnails. You click on the > thumbnails and are > taken to a full size photo. Everything works as expected for the > first nine > images but when you go to the next page of thumbnails, you start getting: > > Warning: Page has Expired The page you requested was created using > information > you submitted in a form. This page is no longer available. As a > security precaution, > Internet Explorer does not automatically resubmit your information > for you. > > To resubmit your information and view this Web page, click the > Refresh button. > > What causes this and how can I fix it so this doesn't happen? > > The URL for this site is http://fuzzheads.org/barcelona > > TIA > > John Hughes > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] undefined function
N> Fatal error: Call to undefined function: mysql_connect() in N> /var/www/html/action.php on line 13 This indicates you do not have MySQL support built into PHP. Assuming a non-Windows OS by the pathnames above, you must use --with-mysql when issuing the configure command when building PHP. - Julie --> Julie Meloni --> [EMAIL PROTECTED] --> www.thickbook.com Find "Sams Teach Yourself MySQL in 24 Hours" at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] undefined function
Hi: in my code below, i get the error of undefined function. can anybody help please? Thanks /* Connecting, selecting database */ $link = mysql_connect("localhost", $user_name, $password) or die("Could not connect"); print "Connected successfully"; mysql_select_db($my_Database) or die("Could not select database"); Fatal error: Call to undefined function: mysql_connect() in /var/www/html/action.php on line 13 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] connect to filemaker via odbc
I haven't tried it, but the best solution seems to be the FX.php classes for connecting to FileMaker from PHP by Chris Hansen. For more information and to download, try: http://www.iviking.org/projects/FXdownload.php I believe you'll have to turn on Web Companion on FileMaker for this to work. Hope that helps, Joshua Hoover > Hi, > has anybody experience with connecting to filemaker via odbc. > thanx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] connect to filemaker via odbc
Hi, has anybody experience with connecting to filemaker via odbc. thanx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Newbie attack...
> Everything is working great except the fact that when > I put some php code into the 'text' field, in order to run > en extra sql command in the page, it hangs and just > prints the code as if it was just text. (shrug) so far as the database is concerned, it *is* just text. If you want returned code evaluated, you will have to explicitly evaluate it. Possible approaches: 1. Search for php code in your content: split the string appropriately and evaluate as needed. I would avoid this because it's a lot of extra work, and because it's quite possible to write 'interleaved' PHP code that requires several blocks working together; evaluating a single block at a time will just get you errors. 2. Evaluate all your content. You would have to be very careful about letting people contribute content, and it might be a bit slower; but it's very very simple. 3. Have markers in your content, referring to PHP code from another table. Would be a bit slower (have to do multiple queries to retrieve code as needed), but more secure - people can safely contribute to the HTML content table, you can let them reference standardized PHP fragments. 4. Half-way between #2 and #3: add a flag field to your database table, if the flag is set the content must be evaluated, otherwise it is plain HTML and can just be echoed. People can contribute content, but the flag stays off until you double-check any PHP code for safety. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie attack...
Hi. I'm Achilles from Greece and I have been into PHP for 3 or 4 weeks. So far I've read 2 books about it and a lot of the online manual. But now I've come onto a problem and I'm asking you for help. I've designed a site which is completely based onto PHP and mySQL. What I mean is that all the main links are actually records into a table with columns such as: id, title, contents etc. Every time a link is clicked the main page rebuilts itself using the id parameter of the link and by an SQL command finds the title and the text to show. So far so good. Everything is working great except the fact that when I put some php code into the 'text' field, in order to run en extra sql command in the page, it hangs and just prints the code as if it was just text. Propably because of some encoding that takes place by submitting the data from my form to the database. I've tried some urlencode() and htmlspec... combination but didn't actually make it... I hope that some of you are clever enough to understand what I'm saying (with my poor english) and kind enough to help me... Looking forward to hearing from you...
Re: [PHP-DB] Finding highest number in auto increment
Oh, forget to include that if you only want that one record, use the "LIMIT 1" keyword as well. Adam Voigt [EMAIL PROTECTED] P.S.: All of this is in the MySQL manual. On Tue, 09 Apr 2002 15:48:45 +0200, Lisi <[EMAIL PROTECTED]> wrote: > Each record in my table has a unique ID number generated by auto increment > each time a new record is added. This is stored in a field called ID. I > have a page that displays records as they are selected, but I want the > default to be the latest entry if none has been selected. > > How do I write the query to find the highest number an display that record? > > It should be something like this I think: > > SELECT organization FROM ayny WHERE ID ... > > how does this end? > > Thanks, > > -Lisi > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Finding highest number in auto increment
SELECT * FROM whatever ORDER BY id DESC; Ofcourse if you want Ascending order, it would be "ASC" instead of "DESC" Adam Voigt [EMAIL PROTECTED] On Tue, 09 Apr 2002 15:48:45 +0200, Lisi <[EMAIL PROTECTED]> wrote: > Each record in my table has a unique ID number generated by auto increment > each time a new record is added. This is stored in a field called ID. I > have a page that displays records as they are selected, but I want the > default to be the latest entry if none has been selected. > > How do I write the query to find the highest number an display that record? > > It should be something like this I think: > > SELECT organization FROM ayny WHERE ID ... > > how does this end? > > Thanks, > > -Lisi > > > -- > 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] Finding highest number in auto increment
Each record in my table has a unique ID number generated by auto increment each time a new record is added. This is stored in a field called ID. I have a page that displays records as they are selected, but I want the default to be the latest entry if none has been selected. How do I write the query to find the highest number an display that record? It should be something like this I think: SELECT organization FROM ayny WHERE ID ... how does this end? Thanks, -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Join?
Hi, I've got a problem with database abstraction. There are two tables. One with articles (id,content,author,time) and one with comments on those articles (id,article_id,content,author,time). My script looks like this: function show_news($limit){ /* get db parameters and connect to db */ require ("inc/db_parameter.inc.php"); $connect = mysql_connect($dbhost,$dbuser,$dbpasswd) or die("Can't connect to database"); mysql_select_db($dbname,$connect) or die(mysql_error()); $abfrage = "SELECT id,autor,zeit,betreff,inhalt FROM ts_artikel ORDER BY zeit DESC" . $limit; $resultat = mysql_query($abfrage) or die (mysql_error()); /* get articles and display*/ While ($row = mysql_fetch_array($resultat, MYSQL_ASSOC)) { /* get author */ $abfrage2 = "SELECT vorname,nachname FROM ts_users WHERE id='" . $row["autor"] ."'"; $resultat2 = mysql_query($abfrage2) or die (mysql_error()); list($autorv, $autorn) = mysql_fetch_row($resultat2); /* get comments */ $abfrage3 = "SELECT autor,zeit,betreff,inhalt FROM ts_kommentar WHERE artikel_id='" . $row["id"] . "' ORDER BY zeit ASC"; $resultat3 = mysql_query($abfrage3) or die (mysql_error()); /* generate display */ echo "" . htmlentities($autorv). " " . htmlentities($autorn); echo "" . strftime("%A %d.%m.%Y,%H:%M:%S", $row["zeit"]); echo "" . nl2br(chop($row["betreff"])) . ":" . nl2br(chop($row["inhalt"])) . ""; /* get comments of there are some */ if (!mysql_num_rows($resultat3) < 1) { while ($row2 = mysql_fetch_array($resultat3)) { $abfrage4 = "SELECT vorname,nachname FROM ts_users WHERE id='" . $row2["autor"] . "'"; /*get author for comments */ $resultat4 = mysql_query($abfrage4) or die (mysql_error()); list($autorkv, $autorkn) = mysql_fetch_row($resultat4); echo " " . htmlentities($autorkv) . " " . htmlentities($autorkn) . "" . strftime("%A %d.%m.%Y,%H:%M:%S", $row2["zeit"]); echo "" . nl2br(chop($row2["betreff"])) . ":" . nl2br(($row2["inhalt"])); echo ""; } } echo "Kommentar schreiben"; } } As you can see, there are some queries within while-loops. Is there a more elegant and performant way to do those queries? I thought of JOIN, but I cannot see how to do it. Any help would be appreciated TIA Volker -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP date calculations and db (slightly OT)
Hello list, I have a database where people can reserve our computer class. The columns are time_from, time_to, name_id, res_date, confirmed. I have a table (HTML, not db *g*) that's supposed to print out a=20 month, starting from day 1 to num_days_in_month, and print the numbers in the right spot as so: May, 2002 +-+-+-+-+-+-+-+ | Mon | Tue | Wed | Thu | Fri | Sat | Sun | +-+-+-+-+-+-+-+ | 29 | 30 | 1 | 2 | 3 =A6 4 | 5 | +-+-+-+-+-+-+-+ |...etc...| +-+-+-+-+-+-+-+ where 29 and 30 will be "grayed out", and if there's a reservation on, say, Friday, it'll show friday the 3rd bold (and as a link). I've got a function that returns a $dates array where I've saved the name of the first day of the month, number of days in month, name of the month and number of the month. Now I'm confused as to how I would=20 parse the information when printing out the (HTML-)table. What I've got so far is for($w=3D1;$w<=3D5;$w++) { // max. 5 weeks in a month echo(""); // table row for($d=3D1;$d<=3D7;$d++) { // days in week for($res=3D0;$res<=3D$num_rows;$res++) { // counter for array from db now the problem is, that if I work further on this, I end up with about four-five for-loops, which doesn't seem to be such a good idea. The other problem is that I really don't have a clue as to where I'd smack in a counter for the number of days in the month. However much I ponder this I can't reach a sensible conclusion. It seems that putting the loop just about anywhere would be a performance loss ;) Anyone ever done anything like this? Cheers, Markus -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library [EMAIL PROTECTED] +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] How to avoid: Warning: Page has Expired
I have the first part of the kids' soccer photo database site up that I mentioned in an earlier post. The site displays nine image thumbnails. You click on the thumbnails and are taken to a full size photo. Everything works as expected for the first nine images but when you go to the next page of thumbnails, you start getting: Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. What causes this and how can I fix it so this doesn't happen? The URL for this site is http://fuzzheads.org/barcelona TIA John Hughes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php