[PHP-DB] Enhancement of script
Dear All (Here is the message again as I noticed that the attachments where not sent) I have recently downloaded a calendar from CST (which is no longersupported ) and I have made a few changes to the script.The calendar will be used to see when something is booked and you can assignmessages to it as well which the general user cannot see. In this respects Ihave created 2 pages - welcome .php for the general viewer and admin_welcomefor the updating of the calendar.What I would like to do is to be able to enter multiple dates in at the sametime - either saying from a start date for so many days or from a start dateto an end date.After spending hours looking at the code and in this forum I cannot seem toget it right - basically I cannot do it.I was wondering if someone could have a look and tell me where I am goingwrong.I have attached the files to this email along with the mySQL table file incase another column needs to be added.You can see the script running atwww.matrix-hosting.co.uk/prestige/welcome.php for the general view andwww.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.Any help would be appreciatedRayP.S. if any one also knows how to get it to display a 2 or 3 months at atime or even a year this would also be a bonus as I have tried to do this aswell. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Can't see the results
Hi you are using mysql_fetch_array which returns an array indexed by field name eg $row = mysql_fetch_array($result) $row[Author] will be 'fred bloggs' you are indexing using a number which needs mysql_fetch_row suggested simplified code is I have named the resulting field as 'author_full_name' for clarity If $code is not a number then it shold be quoted. $query_cat = select author.author_names || ' ' || author.author_surnames AS author_full_name from author, authorxcat where authorxcat.cat_code = $code and author.author_code = authorxcat.author_code ; $result_cat = mysql_query($query_cat) or die($mysql_error()); while($row = mysql_fetch_array($resultID)) { $content .='html code..' $content .= $row[author_full_name] $content .='html code..' }// end while **you could also do as Jim suggested $result_cat = mysql_query($query_cat) or die($mysql_error()); while($row = mysql_fetch_row($resultID)) { $content .='html code..' $content .= $row[0] $content .='html code..' }// end while --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net tel. 0121-242-1473 --- -Original Message- From: Wilmar Perez [mailto:[EMAIL PROTECTED]] Sent: 07 September 2002 00:38 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Can't see the results Hello again Well I followed Jim recomendation but it didn't work either, I think I'd better send the full code to you (don't worry is very short), so you can have a broader idea of what I'm intending to do, which is actually quite a simple thing, just to retrieve results from a database according to a selection made by the user. Any help will be highly appreciated. Well here is the code: Note: If you have a look to the part where the main IF condition is false (when the $code variable doesn't exist) you'll see that I'm doing something pretty simmilar but with a different mysql query. That part works alright. So, what am I missing in the second part? (when the $code variable exists) ?php require(../common/main_page_generator.php); //Create an instance of the class $colecciones = new Page(); $content = tr td bgcolor=\#00\ class=\font- small\a href=\index.php\nbsp;nbsp;Página principal/a/td /tr tr td table width=\100%\ border=\0\ cellpadding=\0\ cellspacing=\0\ tr td align=\center\ background=\../images/layout/background_left_column.gif\br; //Operations $query = select * from categories order by cat_name; $result = mysql_query($query); $num_results = mysql_num_rows($result); if($code){ $query_cat = select author.author_names || ' ' || author.author_surnames from author, authorxcat where authorxcat.cat_code = $code and author.author_code = authorxcat.author_code or die($mysql_error()); $result_cat = mysql_query($query_cat) or die($mysql_error()); $num_results_cat = mysql_num_rows($result_cat) or die($mysql_error()); for ($i=0; $i $num_results_cat; $i++) { $row = mysql_fetch_array($result_cat) or die($mysql_error()); $num_cols = count($row); //As suggested by Jim for($j=0; $j $num_cols; $j++){ $content .= $row[$j]; } } $content .= $num_results_cat./td/tr/table/td/tr; } else for ($i=0; $i $num_results; $i++) { if ($i==$num_results/2){ $content .= /td td img src=\../images/colecciones/central_image.gif\ width=\250\ height=\2\ /td td align=\center\ background=\../images/layout/background_right_column.gif\ br; } $row = mysql_fetch_array($result); $content .= a href=.$PHP_SELF.?code=.$row [cat_code]..htmlspecialchars(stripslashes($row [cat_name]))./abrbr; } $content .= /td/tr/table/td/tr; } //Send values $colecciones - SetTitle(Colecciones); $colecciones - SetContent($content); $colecciones - Display(); ? *
[PHP-DB] Enhancement of script
Dear All The calendar will be used to see when something is booked and you can assign messages to it as well which the general user cannot see. In this respects I have created 2 pages - welcome .php for the general viewer and admin_welcome for the updating of the calendar. What I would like to do is to be able to enter multiple dates in at the same time - either saying from a start date for so many days or from a start date to an end date. After spending hours looking at the code and in this forum I cannot seem to get it right - basically I cannot do it. I was wondering if someone could have a look and tell me where I am going wrong. (scripts at bottom of page) ng at www.matrix-hosting.co.uk/prestige/welcome.php for the general view and www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side. Any help would be appreciated Ray P.S. if any one also knows how to get it to display a 2 or 3 months at a time or even a year this would also be a bonus as I have tried to do this as well. The Scipts: mySQL Database File CREATE TABLE tablename ( id int(11) DEFAULT '0' NOT NULL auto_increment, username varchar(255), stamp datetime, subject varchar(255), description blob, PRIMARY KEY (id) ); welcome.php (this is what the end user sees) ? $mysql_hostname = 'localhost'; $mysql_username = ''; $mysql_password = ''; $mysql_database = ''; $mysql_tablename = ''; $currentday = date(j, time()); $currentmonth = date(m, time()); $currentyear = date(Y, time()); $lastday = 1; $database = mysql_connect($mysql_hostname, $mysql_username, $mysql_password); if (!$month) { $month = date(m, time()); $year = date(Y, time()); } mysql_select_db($mysql_database, $database); echo centerfont face=Arial size=2b; echo date('F', mktime(0,0,0,$month,1,$year)); echo $yearpfont size=3/bp; $firstday = date( 'w', mktime(0,0,0,$month,1,$year)); while (checkdate($month,$lastday,$year)) { $lastday++; } $nextmonth = $month+1; $nextyear = $year; if ($nextmonth == 13) { $nextmonth = 1; $nextyear = $year + 1; } $lastmonth = $month-1; $lastyear = $year; if ($lastmonth == 0) { $lastmonth = 12; $lastyear = $year-1; } echo tabletr; echo tdform method=post action=welcome.phpinput type=submit value='' input type=hidden name=month value=$lastmonth input type=hidden name=year value=$lastyear/form/td; echo tdform method=post action=welcome.phpinput type=submit value='' input type=hidden name=month value=$nextmonth input type=hidden name=year value=$nextyear/form/td/tr/table; echo table width=175 cellpadding=1 cellspacing=1 border=1; echo trtd width=25font size=2bSun/b/font/tdtd width=25font size=2bMon/b/font/td td width=25font size=2bTue/b/font/tdtd width=25font size=2bWed/b/font/td td width=25font size=2bThu/b/font/tdtd width=25font size=2bFri/b/font/td td width=25font size=2bSat/b/font/td/b/font/tr; for ($i=0; $i7; $i++) { if ($i $firstday) { echo td/td; } else { $thisday = ($i+1)-$firstday; if ($currentyear $year) { echo td valign=top align=center bgcolor=dd; } else if ($currentmonth $month $currentyear == $year) { echo td valign=top align=center bgcolor=dd; } else if ($currentmonth == $month $currentday $thisday $currentyear == $year) { echo td valign=top align=center bgcolor=dd; } else { echo td valign=top align=center bgcolor=white; } echo font size=2b$thisday/b/fontbr font size=3; $query2 = mysql_query(SELECT subject FROM $mysql_tablename WHERE stamp = \$year-$month-$thisday 00:00:00\ and stamp = \$year-$month-$thisday 23:59:59\ ORDER BY stamp); for ($j = 0; $jmysql_num_rows($query2); $j++) { $results = mysql_fetch_array($query2); if ($results[subject]) { echo font color=redb$results[subject]/b/font; } } if (mysql_num_rows($query2) 4) { for ($j=0; $j(4-mysql_num_rows($query2)); $j++) echo ; } echo /td; } } echo /tr\n; $nextday = ($i+1)-$firstday; for ($j = 0; $j5; $j++) { echo tr; for ($k = 0; $k7; $k++) { if ($nextday $lastday) { if ($currentyear $year) { echo td valign=top align=center bgcolor=dd; } else if ($currentmonth $month $currentyear == $year) { echo td valign=top bgcolor=dd; } else if ($currentmonth == $month $currentday $nextday $currentyear == $year) { echo td valign=top align=center bgcolor=dd; } else { echo td valign=top align=center bgcolor=white; } echo font size=2b$nextday/b/fontbr font size=3; $query3 = mysql_query(SELECT subject FROM $mysql_tablename WHERE stamp = \$year-$month-$nextday 00:00:00\ AND stamp = \$year-$month-$nextday 23:59:59\ ORDER BY stamp); for ($i = 0; $imysql_num_rows($query3)+4; $i++) { $results2 = mysql_fetch_array($query3); if ($results2[subject]) { echo font color=redb$results2[subject]/b/font; } else if ($i 4) { echo ; } } echo /td; $nextday++; } } echo /tr\n; } echo /tablefont size=3; ? admin_welcome.php (this is what the admin uses) ? $mysql_hostname = 'localhost'; $mysql_username = ''; $mysql_password = ''; $mysql_database = ''; $mysql_tablename = ''; $currentday = date(j, time()); $currentmonth = date(m, time()); $currentyear = date(Y,
[PHP-DB] Apache 2.X and PHP
Is it possible to run Apache 2.X with PHP? Julio Cuz, Jr. [EMAIL PROTECTED] Information Services Riverside Community College mailto:[EMAIL PROTECTED]
Re: [PHP-DB] Apache 2.X and PHP
Yes but support is experimental so you may notice strange behavior. Adam On Sat, 7 Sep 2002 [EMAIL PROTECTED] wrote: Is it possible to run Apache 2.X with PHP? Julio Cuz, Jr. [EMAIL PROTECTED] Information Services Riverside Community College mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL newbie
Hi, I'm using the following statements to insert a record into a table: $SQL_Exec_String = Insert Into Messages (ReplyID,Subject,Sender,Email,Message,Reviewed) Values ($ReplyID,'$Subject','$Sender','$Email','$Message',$Reviewed); $cur = odbc_exec( $cnx, $SQL_Exec_String ); This works great except when I have a string like don\'t get in my way which has an apostrophe in it and causes the statement to get confused. It seems to me that SQL should have an escape sequence of some kind. Can someone get me pointed in the right direction? Thanks! ___ John Long www.wiseheart.20m.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php