[PHP] PHP no longer logging errors
PHP appears to no longer be logging errors: My php.ini is unchanged: error_reporting = E_ALL display_errors = On display_startup_errors = On log_errors = On error_log = /var/log/apache/php.log Over the last few days, whenever I had a syntax error in my scripts, I was getting segmentation faults reported in the apache error logs. Now I dont get anything anywhere. Anyone know why all error reporting might suddenly disappear? Has my library grown too large? complex? TIA JEFF -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP no longer logging errors - found them!
Little Bo jeff has lost his logs, and doesn't know where to find them! Fix up the conf and they will come home dragging their hints behind them! I moved some php config values into httpd.conf so that I could manage my virtual sites better (e.g. phpMyAdmin needs globals) and assumed that the names and values would be the same as php.ini so I had php_value display_errors on php_value log_errors on This doesnt work! The following does work though: php_value display_errors 1 php_value log_errors 1 regards Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Sorry....sessions ... again...with code...
I have tried you code and cannot see any real problem? This is what I see happening: 1 one.php creates a session and sets the value of $a to 'a' 2 click on 2 and you get to two.php with the value set to 'a' 3 click on OFF and you get to off.php where the value is unset 4 click back and you go back to two.php, and $a has no value 5 click back and you go to one.php which then creates a new session and puts 'a' back into $a phpinfo() shows that the browser is sending you a PHPSESSID cookie, but as your variables are correctly unset, this should never be a problem. When you call session_start() php is automatically going to create a PHPSESSID cookie anyway, so even if you setcookie( 'PHPSESSID', '', time() ); all that happens is that you get a new one. Is the real issue that when you go back to one.php your code unconditionally recreates the value? Regards Jeff PS madness is a state of mine. -Original Message- From: Miguel Loureiro [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 9:28 AM To: php-gen Subject: [PHP] Sorrysessions ... again...with code... |Hello all, I'm mad with mesorry but see if can understand why I'm mad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] sql problem
Not sure what you are trying to do? Not sure what a Persal is (maybe an Arial?) Perhaps you want: select E.empname from employer E, badclient B where E.employercode = B.employercode and E.pesal='$Persal' Note there are two tables given aliases of E and B that are JOINED by the first condition in the where clause. Regards Jeff -Original Message- From: Wade Halsey [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 11:25 AM To: [EMAIL PROTECTED] Subject: [PHP] sql problem Hi ppl ("select empname from employer where empno = (select employercode from badclient where pesal = '$Persal')") Could anyone help me out with the syntax? Im running an interbase db and php4.04 Thanks Wade -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Date subtraction
Do it in MySQL = Fast Don't fiddle in PHP = waste of your time. Look into the following: select UNIX_TIMESTAMP(date1)-UNIX_TIMESTAMP(date1) as diff_secs, TO_DAYS(date1)-TO_DAYS(date1) as diff_days, PERIOD_DIFF(date1,date2)as diff_months, YEAR(date1) - YEAR(date2) as diff_years from MYTABLE where id=$id I'm not sure what select date1-date2 as date_diff returns? beware of the 2037 limitation using UNIX_TIMESTAMP() regards Jeff -Original Message- From: BlackLord [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 5:41 PM To: [EMAIL PROTECTED] Subject: [PHP] Date subtraction Hi! I want to subtract to date times from each other. Like : '2000 12 01 12:12:12' - '2000 11 10 11:39:59' Is there any function to do this subtraction or can i do it with MySQL's SELECT query ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to delete a row from MySql
curious of Hither Green writes: printf("a href=\"%s?id=%sdelete=yes\"(DELETE)/a/td/tr", $PHP_SELF, $myrow["id"]); Is there a reason why you're not using interpolation? This looks simpler to me, and I thought that a lot of effort went into optimising PHP interpolation. echo "A HREF='$PHP_SELF?id=$myrow[id]delete=yes'Delete $myrow[id]/A"; cheers, Jeff -Original Message- From: Peter Houchin [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 4:38 AM To: YoBro; [EMAIL PROTECTED] Subject: RE: [PHP] How to delete a row from MySql db connection here if ($delete){ $rs = "DELETE FROM users WHERE id=$id"; $result = mysql_query($rs); echo "font face=\"Helvetica, sans-serif\" size=\"3\" color=\"#003399\"Record Deleted P "; } $id = $myrow["id"]; printf("a href=\"%s?id=%sdelete=yes\"(DELETE)/a/td/tr", $PHP_SELF, $myrow["id"]); -Original Message- From: YoBro [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 3:29 PM To: [EMAIL PROTECTED] Subject: [PHP] How to delete a row from MySql Hello, Does anybody know how to make a text link delete items from a MySql Database. I have a PHP page that reads from the database and displays the results, but i want to include an option at then end of each row to delete that information. Alot like in phpMyAdmin. I have looked at that code, but can't figure it out. Any help on this would be really great. -- Regards, YoBro - DO NOT REPLY TO THIS VIA EMAIL PLEASE USE THE NEWSGROUP All emails sent to this address are automatically deleted. This is to avoid SPAM! - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Ack! Cookie Problems!
Why not just set the session start time in a session variable and then test against that? Something like: session_start(); # This array contains all the session items if (!isset($sesh)) { $sesh = array(); session_register('sesh'); $sesh[start] = time(); } if ( $PHP_SELF == '/login') { if (login_ok()) { $sesh[start] = time(); } } elseif ( time()-$sesh[start] 60 ) { headers("Location: /login"); exit; } -Original Message- From: Michael Champagne [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 1:25 AM To: PHP General Mailing List Subject: [PHP] Ack! Cookie Problems! Ok, I'm going through a cookie nightmare. I'm trying to create a session and then cut the user off from the session by setting the expiration of the cookie that I send out using session_set_cookie_params(). Here's my code: /* Start session and unset any previous session variables */ session_start(); session_unset(); session_set_cookie_params(time() + $cookie_expire * 60); // Parameter is in seconds The cookie never expires though! I set $cookie_expire to 1 (should expire in one minute) and I can keep right on accessing pages. BTW, all the pages do a session_start and check for a variable at the beginning and redirect to the login page if the var is not found. Does anyone know what's up with this? Thanks for your help in advance. -- Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: [EMAIL PROTECTED] hm: [EMAIL PROTECTED] ** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect the views or opinions of Capital Institutional Services, Inc. Capital Institutional Services, Inc. accepts no liability for any errors or omissions arising as a result of transmission. Use of this communication by other than intended recipients is prohibited. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] trim string - try array/join()
You have a hidden issue with the extra trailing comma. When I want a list of things, I prefer this approach: $db = mysql_select_db("tkenet_db"); $query = "SELECT app_name,status FROM approval_list where doc_no='6'"; $result = mysql_query($query,$db); $ccs=array(); while( $data = mysql_fetch_row($result) ){ $ccs[] = trim($h-get_email($data[0])); } $cc = join(",",$ccs); It seems happy with large arrays (10,000s). Regards Jeff -Original Message- From: Mark Maggelet [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 12:20 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] trim string On Wed, 21 Mar 2001 18:09:47 +0800, Wen Ni Leong ([EMAIL PROTECTED]) wrote: I need help in this basic string function. I query from the database by using while loop and the result in in array. I separated them by using "," . I want at the end of the string to be trim off. Unfortunately I tried all the string function such as chop,trim and substr but they seem like can't manage to trim the end of the string. Please help me. my coding are: $db = mysql_select_db("tkenet_db"); $query = "SELECT app_name,status FROM approval_list where doc_no='6'"; $result = mysql_query($query,$db); while($data = mysql_fetch_row($result)){ $cc .= $h-get_email($data[0]).","; if ($data[1] != 'Y') { $all_yes = 1;} } trim($cc); this doesn't do anything to $cc, you have to catch the return value: $cc=trim($cc); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: SV: [PHP] Booking by Date/Time in mySQL
Jon, not sure if I agree with you: locking - almost always a bad idea, atomicity is much faster and safer and usually indicates a better relational design. SQL is fundamentally set oriented, but newbies are almost always row oriented. mySQL locks table automagically, but it doesn't do row level locking, and transactions are only recently added. generate ids - let the db do this with ids. Almost all the number fountains I have seen are because of the inability of a 3GL to recieve the generated id efficiently, this is not a problem in mySQL. I do agree with you though if you are refering to having a decent relational data model Jeffs DB Maxims: In my db experience OS [DOS/WIN32/Unix/Mini/Mainframe] Type [relational/post-relational/object/network/hierarchical] * NEVER write SQL that requires programatic locking * minimise use of transactions [redesign! think lateral] * use sql atomicity whenever possible * don't be a pessimistic locker - optimism is so much more user friendly. * apply the twelve of codd with intelligence rather than obsession * all updates should be safely repeatable * 3NF is generally cool, but 14NF is overboard. [soapbox.off] Kiora -Original Message- From: Jon Snell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 21, 2001 10:54 PM To: Thomas Edison Jr. Cc: [EMAIL PROTECTED] Subject: RE: SV: [PHP] Booking by Date/Time in mySQL Yes, I would recommend locking your tables before doing this just in case. Another solution would be to create a unique-key based on the bed field and date field. This way you are guaranteed never to double book, and can just check for errors after insert rather than do an additional select statement and worry about race conditions... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] files with html extension
Yes it works in Apache - try it! You could also read the Apache documentation on Content Negotiation. The following is a quote - Note on hyperlinks and naming conventions If you are using language negotiation you can choose between different naming conventions, because files can have more than one extension... snip Looking at the table above you will notice that it is always possible to use the name without any extensions in an hyperlink (e.g., foo). The advantage is that you can hide the actual type of a document rsp. file and can change it later, e.g., from html to shtml or cgi without changing any hyperlink references. - On how it resolves conflicts? Not documented, but a quick fiddle seems to indicate that it does the following: if (no_specific_type_requested()) { get list of possible files in ALPHABETICAL order if (file_is_recognised_mime_type()) return this file recognised mime types come from /etc/mime.types Regards Jeff -Original Message- From: Harshdeep S Jawanda [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 11:06 AM To: Jeff Armstrong Cc: [EMAIL PROTECTED] Subject: Re: [PHP] files with html extension Jeff Armstrong wrote: This is exactly why http://www.w3.org recommend that you DONT SPECIFY A FILE TYPE TYPE in your HREFs. But doth that actually work - how many web servers are able to handle this type of link correctly? Ummm... and what happens (or is supposed to happen) to resolve xxx.html and xxx.php? -- Regards, Harshdeep Singh Jawanda. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] URIs as variables
Instead of using a HIDDEN form field (I assume you don't use this in any client side javascript), why not just use a session variable. Add this to the top of the relevant pages using include: ?php session_start(); # This array contains all the session items if (!isset($sesh)) { $sesh = array(); session_register('sesh'); } if (isset($url) and !$sesh[url]) $sesh[url] = $url; ? You can then use $sesh[url] in any php block to find what this value was set to on the first page. Regards Jeff -Original Message- From: Issac Goldstand [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 11:39 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] URIs as variables Nope. That gave me: INPUT TYPE="HIDDEN" NAME="url" VALUE="script2.php?var1=ab" I'd need to enumerate $HTTP_GET_VARS variable _keys_ too, but I don't know how... Also, how can I get it to work for both GET POST methods? Is that possible? Thanks, Issac ""almir"" [EMAIL PROTECTED] wrote in message 99b66u$q0o$[EMAIL PROTECTED]">news:99b66u$q0o$[EMAIL PROTECTED]... try with uri=? echo implode("", $HTTP_GET_VARS);? ""Issac Goldstand"" [EMAIL PROTECTED] schrieb im Newsbeitrag 99at42$5be$[EMAIL PROTECTED]">news:99at42$5be$[EMAIL PROTECTED]... Newbie question here. I am trying to pass a varaible containing a URI across a few scripts. Basically, the first script get's a query string including the URI (eg http://foo.bar/script1.php?url=script2.php?var1=avar2=b). Now, script1 contains a form pointing to script3 so basically, I have the user form and then: ? echo "INPUT TYPE=\"HIDDEN\" NAME=\"url\" VALUE=\"$url\""; ? (I have register-gloabls enabled and am not sure whether the call to script1 will be POST or GET) This creates a slight problem, as, using the above example once again, PHP will send the browser the line: INPUT TYPE="HIDDEN" NAME="url" VALUE="script2.php?var1=a" But it totally chops off everything from the "" and onwards. How can I fix it to get the entire URI? Thanks, Issac -- Internet is a wonderful mechanism for making a fool of yourself in front of a very large audience. --Anonymous Moving the mouse won't get you into trouble... Clicking it might. --Anonymous PGP Key 0xE0FA561B - Fingerprint: 7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Sessions help please
Apologies for the long post. I use this approach: (simplified) at the top of every page, before any HTML. Pop it into an include right at the top. I have not included all the util function e.g. LogQuietAlert() regards Jeff ?php #=== # Initialise session array session_start(); if (!isset($sesh)) { session_register('sesh'); $sesh = array(); } # If they are not logged in - send them to the /login page if ( !$sesh[_loggedin] and !isUtilityPage()) { $sesh[_target] = TopPage($PHP_SELF); # Remember where they were going gotoPage("/login"); } # This is updated by the login function if a login fails # Print it on your page somewhere to let the user know # that their login failed $message = ''; # I leave the action on my FORMs empty, so the user # will return to the same page when they press SUBMIT # $act is the name of the submit button/link etc if ( $act == 'login' ) { if ( !$UserName || !$Password ) { $message = "Missing Username or Password [From: $REMOTE_ADDR]"; } elseif ( login( $UserName, $Password ) ) { srand((double) microtime() * 100); $randval = rand(); setcookie( 'cookUserName', $UserName, time()+(180*86400),'','', 1); # Note that this is a session cookie, not persistant setcookie( 'cookSPID', $randval, 0, '','', 1); $sesh[_cookSPID] = $randval; $sesh[_sslSESH] = $SSL_SESSION_ID; gotoPage($sesh[_target]); } else { $message = "Invalid Username/Password [From: $REMOTE_ADDR]"; } } if (!isUtilityPage()) { # Check that the user is not attempting to spoof the session if ( $sesh[_cookSPID] != $cookSPID) { LogQuietAlert("$PHP_SELF $sesh[_email] at $sesh[_client_id] " . "has a cookSPID mismatch: Attempt to spoof session?BR"); gotoPage("/login"); } } #=== function login( $UserName, $Password ) { # Checks username/password global $sesh, $message, $REMOTE_ADDR; $sesh[_user]= $UserName; $sesh[_loggedin]= 0; $sesh[_user_id] = ''; $sesh[_role]= ''; $sesh[_name]= ''; $sesh[_client_id] = ''; if ( !$UserName or !$Password ) { return 0; } $UserName = strtolower( $UserName ); $sth = runSQL('get_user_login',array( where = "user='$UserName' and password=PASSWORD('MySalt$Password')" )); $rows = mysql_num_rows( $sth ); if (!$rows) { # Invalid UserName/Password - log a quiet alert LogAlert("Login failure: $UserName from $REMOTE_ADDR tried '$Password'BR"); $message = "Invalid username/password [from $REMOTE_ADDR]"; return 0; } $rec = mysql_fetch_array( $sth, MYSQL_ASSOC ); $sesh[_loggedin]= 1; $sesh[_user_id] = $rec[user_id]; $sesh[_email] = $rec[email]; $sesh[_role]= $rec[role]; $sesh[_name]= $rec[name]; $sesh[_client_id] = $rec[client_id]; return 1; } #=== function gotoPage( $page = "/index" ) { header("Location: $page"); exit; # Old browsers get no further! } #=== function isUtilityPage() { global $PHP_SELF; # returns true if this is a utility page # ie index, login, unavailable or error if ( stristr($PHP_SELF, 'login')) return 1; if ( stristr($PHP_SELF, 'index')) return 1; if ( stristr($PHP_SELF, 'unavail')) return 1; if ( stristr($PHP_SELF, 'error')) return 1; if ( stristr($PHP_SELF, 'disclaimer')) return 1; return 0; } #=== ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: SV: [PHP] Booking by Date/Time in mySQL
One problem is that you are only checking the first booking. select * from booking where room='room' gives ALL bookings, and you look like you are just testing the FIRST one. why not turn it round and do: select * from booking where ('$start'=startdate and '$start'=enddate) or ('$end'=startdate and '$end'=enddate) This lets mySQL do the test for you. If it returns a row you already have a booking. -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 20, 2001 11:50 AM To: Peter Chr. Hansen Cc: [EMAIL PROTECTED] Subject: Re: SV: [PHP] Booking by Date/Time in mySQL Peter, what do you mean by Newdate between date1 date2?? the logic i'm using is that i'm checkin if the new Start Date End date lies between the old Start Date End Date or not. If it does, than entry is denied, else booking is succesfull. But things are not running, following is the code i'm using ... -- ?php $db = mysql_connect("localhost","root"); mysql_select_db("nidc_intranet",$db); $realsdate="$syear"."-"."$smonth"."-"."$stdate"; $realedate="$eyear"."-"."$emonth"."-"."$endate"; $realstime="$shh".":"."$smm"." "."$sttime"; $realetime="$ehh".":"."$emm"." "."$entime"; $result = mysql_query("SELECT * FROM booking where room='$rooms',$db); if ($myrow = mysql_fetch_array($result)) { do { if ($realsdate=$myrow[sdate]) ($realsdate=$myrow[edate]) ($realedate=$myrow[sdate]) ($realedate=$myrow[edate]) { echo "Sorry"; } else { $sql = "INSERT INTO booking (room,sdate,edate,stime,etime,purpose,reserved) VALUES ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$r es')"; $result = mysql_query($sql) or Die ("An unexpected error occured. Please go back and book again."); echo "font face=helvetica size=2 color=#140057bThank you! font color=#ff$rooms/font, has been booked from font color=#ff$realsdate/font to font color=#ff$realedate/font. brbr ** Entries will be deleted 2 weeks after the End Date. "; } } while ($myrow = mysql_fetch_array($result)); } ? Regards, T. Edison jr. --- "Peter Chr. Hansen" [EMAIL PROTECTED] wrote: Can't you use " Newdate between date1 and date2 -Oprindelig meddelelse- Fra: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sendt: 20. marts 2001 12:25 Til: [EMAIL PROTECTED] Emne: [PHP] Booking by Date/Time in mySQL I'm facing this problem. I have made a room booking application. There is a Start Date Time and End Date Time of Booking a room. Problem is that once booked, you can't book a room with a date or time that falls between an Already booked Date Time. For example, if someone's booked a room from 3rd March to 10th March between 4:00 p.m. to 12:00 p.m. , you can't book the same room for the any date between 3rd March to 10th March and between 4 pm 12 pm. How do i do that? Regards, T. Edison jr. = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED] Tel : 91-4546512/4522124 *** __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: SV: [PHP] Booking by Date/Time in mySQL
the logic goes: $start = some_start_date_a_keen_punter_entered(); $end = the_date_he_wants_to_leave(); select * from booking where ('$start'=startdate and '$start'=enddate) or ('$end'=startdate and '$end'=enddate) if (uh_ohh_I_got_a_row_back()) echo "Someone else is sleeping in the bed! No can do!", "Cheap discounts for those willing to share a bed!", "Are you gorgeous??"; else print "You got it!" insert good bits into database here Of course this is not guaranteed safe, as you can end up with double bookings in the pico seconds between the select and the insert - but hey, how many hits a second do you expect. Regards Jeff's Granny -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 20, 2001 5:08 PM To: Jeff Armstrong Cc: [EMAIL PROTECTED] Subject: RE: SV: [PHP] Booking by Date/Time in mySQL I do get your message Jeff, but tell me, after having used the following code .. select * from booking where ('$start'=startdate and '$start'=enddate) or ('$end'=startdate and '$end'=enddate) what code should be written to actually insert booking data into the table? Because this is basically picking up data or booking from the Table that fall in this period. What i want to do is to check if any booking has been made for this period that i'm inserting now T. Edison jr. --- Jeff Armstrong [EMAIL PROTECTED] wrote: One problem is that you are only checking the first booking. select * from booking where room='room' gives ALL bookings, and you look like you are just testing the FIRST one. why not turn it round and do: select * from booking where ('$start'=startdate and '$start'=enddate) or ('$end'=startdate and '$end'=enddate) This lets mySQL do the test for you. If it returns a row you already have a booking. -Original Message- From: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 20, 2001 11:50 AM To: Peter Chr. Hansen Cc: [EMAIL PROTECTED] Subject: Re: SV: [PHP] Booking by Date/Time in mySQL Peter, what do you mean by Newdate between date1 date2?? the logic i'm using is that i'm checkin if the new Start Date End date lies between the old Start Date End Date or not. If it does, than entry is denied, else booking is succesfull. But things are not running, following is the code i'm using ... -- ?php $db = mysql_connect("localhost","root"); mysql_select_db("nidc_intranet",$db); $realsdate="$syear"."-"."$smonth"."-"."$stdate"; $realedate="$eyear"."-"."$emonth"."-"."$endate"; $realstime="$shh".":"."$smm"." "."$sttime"; $realetime="$ehh".":"."$emm"." "."$entime"; $result = mysql_query("SELECT * FROM booking where room='$rooms',$db); if ($myrow = mysql_fetch_array($result)) { do { if ($realsdate=$myrow[sdate]) ($realsdate=$myrow[edate]) ($realedate=$myrow[sdate]) ($realedate=$myrow[edate]) { echo "Sorry"; } else { $sql = "INSERT INTO booking (room,sdate,edate,stime,etime,purpose,reserved) VALUES ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$r es')"; $result = mysql_query($sql) or Die ("An unexpected error occured. Please go back and book again."); echo "font face=helvetica size=2 color=#140057bThank you! font color=#ff$rooms/font, has been booked from font color=#ff$realsdate/font to font color=#ff$realedate/font. brbr ** Entries will be deleted 2 weeks after the End Date. "; } } while ($myrow = mysql_fetch_array($result)); } ? Regards, T. Edison jr. --- "Peter Chr. Hansen" [EMAIL PROTECTED] wrote: Can't you use " Newdate between date1 and date2 -Oprindelig meddelelse- Fra: Thomas Edison Jr. [mailto:[EMAIL PROTECTED]] Sendt: 20. marts 2001 12:25 Til: [EMAIL PROTECTED] Emne: [PHP] Booking by Date/Time in mySQL I'm facing this problem. I have made a room booking application. There is a Start Date Time and End Date Time of Booking a room. Problem is that once booked, you can't book a room with a date or time that falls between an Already booked Date Time. For example, if someone's booked a room from 3rd March to 10th March between 4:00 p.m. to 12:00 p.m. , you can't book the same room for the any date between 3rd March to 10th March and between 4 pm 12 pm. How do i do that? Regards, T. Edison jr. = Rahul S. Johari (Director) ** Abraxas Technologies Inc. Homepage : http://www.abraxastech.com Email : [EMAIL PROTECTED
RE: [PHP] files with html extension
I agree with Phill, don't make all your HTML into PHP unless you aint got much - but hey if you aint got much then you can fix the real problem! soapbox: { The issue here seems to derive from the fact that all the internal HREFs point to xxx.html This is exactly why http://www.w3.org recommend that you DONT SPECIFY A FILE TYPE TYPE in your HREFs. Cool URIs Dont change - http://www.w3.org/Provider/Style/URI Good!! A HREF=/somepage Some Page!/A NOT good! A HREF=/somepage.html Some Page!/A ^ Let the server decide which page to dish. Then it's easy peasy to replace xxx.html with xxx.php or even xxx.my_new_language_of_the_moment. }; Jeff -Original Message- From: Phillip Bow [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 20, 2001 6:35 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] files with html extension Personally I recommend people don't do this unless their web server is going to serve only(or mostly) php pages, and very few straight html pages. It will save you time mucking around on the server, but the increase in overhead isn't really worth it. IMHO of course. -- phill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Privilege system of Mysql...
The easiest way to do this is to use phpMyAdmin. Go to the mysql database on your server Insert a record into the table called 'user' * enter appropriate value for host (localhost or %) * fill in user name * when entering password, select the PASSWORD function from the pulldown and enter the plaintext initial password * give them the rights you want (Y=yes, N=no) * save the record in the database Go back to the main server page (Home in phpMyAdmin) Clock on Reload Server The rights granted in the mysql.user table are global to the server - i.e. they apply to all current and future databases. Regards Jeff -Original Message- From: David Bouw [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 11:28 AM To: Sven Huster Cc: [EMAIL PROTECTED] Subject: [PHP] Re: Privilege system of Mysql... Hi Sven, Yes, I just started playing with the GRANT syntax.. Only problem is that they first define a user with everything on 'N' And then they define a table in the DB with everything on Y... Problem is that you have to do this for all DB's which you want to allow. This means that newly created DB's should later be added.. This is though very secure, but I am wondering if there is a way to: allow EVERYTHING but the following in stead of allow NOTHING but the following Bye Bye David have you tried the GRANT syntax? maybe this helps take a look at the grant tables afterwards regards Am 11:48 19.03.2001 schrieben Sie: Hi there.. I am not understanding something how the mysql priviege system works: I want to do the following: Give a user access to all tables in an database (also tables which will be added in the future) except a few private tables like the mysql table itself This is the way I thought it should be done: Add a user: '%','username','password','Y',Y','Y','Y','Y','Y','N','N' etc// Then add the following to table db '%',mysql','username','N',N','N','N','N','N','N','N' etc// Run the Flush privileges command and try it.. This doesn't work! Or I am missing something.. When I think logically, I can maybe understand that the DB looks at the user table and sees that the uses has access to do everything and doesn't look further at de db table.. Is this correct? What is then the solution to do what I described above.. I looked at the manual, but I can't seem to figure out in what order the tables are checked.. Does it stop looking further when he finds permission to do something or does it stop at the first 'N'... PS: I am not planning to use the above example, but it will help me understand how the privilege system works.. Sven Huster Senior Unix System Administrator *BSD, Linux, Solaris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Query - Grouping Results
how about something like select distinct name, date_format(time, "%W %D %M %Y") as login from users, user_logins where user_logins.user_id = users.id order by name,time -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 1:43 PM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Query - Grouping Results Hi, I've got a table like: id user_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]