[PHP] Re: Help converting ASP->PHP
You should be able to do everything with PHP's date functions: http://www.php.net/manual/en/ref.datetime.php Pay particular attention to the mktime, date, and getdate functions. The script below might be helpful to you. __ Curt A. Gilman Richmond, Virginia, USA [EMAIL PROTECTED] "Mrbaseball34" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > PHP Newbie, so please don't flame me ! > > I am converting an organizer example from an ASP book to PHP > and need some help. > > Need some help with the following code : > > /* > intMonth and intYear are variables passed into a function > datCurrent, intCurrentMonthDays and intWorkDays are local > variables > */ > >datCurrent = CDate(intMonth & "/1/" & intYear) >intCurrentMonthDays = _ > Day(DateAdd("d", -1, DateAdd("m", 1, datCurrent))) >intWeekday = Weekday(datCurrent) > > I can't find any PHP functions to handle this type of day/date > manipulation... -- 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] Re: PHP/CGI problem: #!/path/php at top of CGI script appears in output
Philippe, Does the file name end in .php or something similar? If so, it is probably being handled by the Apache PHP module, since you have it installed, and not by the CGI. You could try changing the name to .cgi or something else and see what happens. Also, have you remembered to put the file in executable mode with chmod? for example:chmod a+x foo.bar Is it in a cgi-bin folder or similar folder where scripts will be executed? Do other CGI scripts in the same folder work? __ Curt A. Gilman Richmond, Virginia, USA [EMAIL PROTECTED] "Pour Mailings Lists - Pass Huitre" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > I've FreeBSD 4.2/Apache 1.3.9/PHP 4.0.6 > I've installed PHP in Apache, it works very well > I need to have too PHP 4.0.6 in CGI mode (With Suexec but I don't think it's > the problem) but I've a problem. > In CGI mode, the path of PHP is always written at the top of the result > > I'll take for example this script : > > #!/usr/local/bin/php > print "Hello World"; > ?> > > > When the file is called by the browser, the result is : > > #!/usr/local/bin/php > Hello World > > > Does someone know the problem and the solution ? > Have I forgotten something ? > > Thanks for your help > > Philippe > -- 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] Re: MySQL query
Try using a LEFT JOIN against the second table, returning only records with no match. Something like: SELECT DISTINCT A.username FROM user A LEFT JOIN task_assignment B ON (A.username = B.username) WHERE B.username IS NULL; See JOIN syntax in MySQL documentation for more information: http://www.mysql.com/doc/J/O/JOIN.html Good luck! __ Curt A. Gilman Richmond, Virginia, USA [EMAIL PROTECTED] "Srinivasan Ramakrishnan" <[EMAIL PROTECTED]> wrote in message 002001c157ee$c9bfaea0$[EMAIL PROTECTED]">news:002001c157ee$c9bfaea0$[EMAIL PROTECTED]... > Hi all, > > I'm looking at the following scenario: I have MySQL two tables with > usernames in both of them, I need to get usernames(A) - usernames(B) > > In Oracle I would use: > SELECT username FROM user > MINUS > SELECT username FROM task_assignment > > Since MySQL does not support MINUS, I tried using the following > > SELECT DISTINCT A.username FROM user A > WHERE A.username > NOT IN(SELECT B.username FROM task_assignment B); > > Here's what I get from MySQL: > > mysql> SELECT DISTINCT A.username FROM user A WHERE > A.username NOT IN(SELECT B.username FROM task_assignment B); > ERROR 1064: You have an error in your SQL syntax near 'SELECT B.username > FROM ta > sk_assignment B)' at line 1 > > It appears to me that MySQL's NOT IN cannot handle recordsets, so as a fix > I'm currently doing like so, which works, but I'd really like to get it as a > single MySQL statement. > > $query = "SELECT DISTINCT username FROM task_assignment"; > $db_result = mysql_query($query); > $data = mysql_fetch_array($db_result); > $not_in = $data[0]; > while($data = mysql_fetch_array($db_result)){ > $not_in .= ', ' . $data[0]; > } > > $query = "SELECT DISTINCT username FROM user"; > $query .= "WHERE username NOT IN($not_in)"; > > Any help will be appreciated. > > Cheers, > -Srini > -- > http://www.symonds.net/~sriniram > -- 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]