php-windows Digest 3 Oct 2002 22:58:45 -0000 Issue 1370
Topics (messages 16142 through 16149):
Getting last id from database
16142 by: Davy Obdam
16143 by: Mihail Bota
16144 by: Rich Gray
odbc_fetch_array function
16145 by: Pascal S.
Re: using exec on WIMP
16146 by: MWCT - Markus Weber
Need SQL Help for PHP_WIN and ODBC/Access
16147 by: Williams, Dewey
Using mail() with w2k/IIS5 with SMTP feature
16148 by: Georg Herland
16149 by: Manuel Lemos
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hiya people,..
I have a script and i need to get the last id from the database. I have
to get this id to determine whats the latest poll and display that poll
on the page. Now i use this:
if(!$poll)
{
$select = mysql_query("SELECT id FROM poll");
$poll = mysql_num_rows($select);
}
Well everything goes alright if u dont remove any polls.. this just
counts the mumber of rows in the database. Can anyone help me with and
idea how to get the latest id from the database, so that i am able to
delete polls from the database. I ve tried mysql_insert_id(); but i cant
get it to work. Thanks already for your help.
Thanks,..
Davy Obdam
mailto:[EMAIL PROTECTED]
url: http:///www.davyobdam.com
--- End Message ---
--- Begin Message ---
Davy,
maybe you can try something like "select max(id) as maxid from poll".
Mihai
On Thu, 3 Oct 2002, Davy Obdam wrote:
> Hiya people,..
>
> I have a script and i need to get the last id from the database. I have
> to get this id to determine whats the latest poll and display that poll
> on the page. Now i use this:
>
> if(!$poll)
> {
> $select = mysql_query("SELECT id FROM poll");
> $poll = mysql_num_rows($select);
> }
>
> Well everything goes alright if u dont remove any polls.. this just
> counts the mumber of rows in the database. Can anyone help me with and
> idea how to get the latest id from the database, so that i am able to
> delete polls from the database. I ve tried mysql_insert_id(); but i cant
> get it to work. Thanks already for your help.
>
> Thanks,..
>
> Davy Obdam
> mailto:[EMAIL PROTECTED]
> url: http:///www.davyobdam.com
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
why not
select id from poll order by id desc limit 1
HTH
Rich
-----Original Message-----
From: Davy Obdam [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2002 16:58
To: Php-Windows Mailing
Subject: [PHP-WIN] Getting last id from database
Hiya people,..
I have a script and i need to get the last id from the database. I have
to get this id to determine whats the latest poll and display that poll
on the page. Now i use this:
if(!$poll)
{
$select = mysql_query("SELECT id FROM poll");
$poll = mysql_num_rows($select);
}
Well everything goes alright if u dont remove any polls.. this just
counts the mumber of rows in the database. Can anyone help me with and
idea how to get the latest id from the database, so that i am able to
delete polls from the database. I ve tried mysql_insert_id(); but i cant
get it to work. Thanks already for your help.
Thanks,..
Davy Obdam
mailto:[EMAIL PROTECTED]
url: http:///www.davyobdam.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I have version 4.2.3 of PHP installed on a Windows server.
I am new to PHP. I did find the function
array odbc_fetch_array ( resource result [, int rownumber])
in the documentation, but it doesn't seem implemented in the version that I
use.
Do you know what I did wrong?
Thanks,
Pascal
--- End Message ---
--- Begin Message ---
Hello J Wynia,
your tipp was great. It works perfectly on my WIMP system:
function win_exec($command, $windowstate, $wait) {
$shell = new COM("WScript.Shell") or die("This thing requires Windows
Scripting Host");
$shell -> Run($command,$windowstate,$wait);
}
$command = getenv("COMSPEC").' /c c:\mysql\bin\mysql.exe <
E:/Inetpub/wwwroot/update/load_logs.sql >
E:/Inetpub/wwwroot/update/load_logs.log';
win_exec($command, 2, "0");
kind regards,
Markus Weber
=========================================================
"J Wynia" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Mwct - Markus Weber wrote:
> > Hi,
> >
> > may be someone can help me:
> >
> > I want to use the exec() function to run an executable as background
> > process. This means my php script should not wait for the end of the
> > background process. I tried a lot but without success. My script always
wait
> > for the end of the background process.
> >
> > My php script contains this line:
> >
> > exec(getenv("COMSPEC").' /c c:\mysql\bin\mysql.exe <
> > E:/Inetpub/wwwroot/update/load_logs.sql >
> > E:/Inetpub/wwwroot/update/load_logs.log');
> >
> > Regarding to the online documentation on php.net all screen output is
> > redirected to the file "load_logs.log".
> >
> > When I type in this string via command line the execution is successful.
> >
> > As I learned from the online documentation on php.net is that on LINUX
> > systems something like "2>1&" or ">/dev/null" will help - but not on
> > Windows.
> >
> > Any ideas ?
>
> If this script will only ever be run on Windows servers, you can use the
> Windows-specific shell capabilities through the COM interface.
>
> $shell = new COM("WScript.Shell") or die("This thing requires Windows
> Scripting Host");
> $shell -> Run($commandinquotes,$windowstate,$wait);
>
> Replace $commandinquotes with your commandline that you want to run. Put
> it in single quotes. Replace $windowstate with 1, 2 or 3 for normal DOS
> window, minimized or maximized and $wait with 0 in your case because you
> don't want PHP to wait for the process to finish.
>
> You could abstract it further by turning the COM "Run" into your own
> function. The below code hasn't been tested.
>
> function win_exec($command, $windowstate, $wait) {
> $shell = new COM("WScript.Shell") or die("This thing requires Windows
> Scripting Host");
> $shell -> Run($commandinquotes,$windowstate,$wait);
> }
>
> $command = getenv("COMSPEC").' /c c:\mysql\bin\mysql.exe <
> > E:/Inetpub/wwwroot/update/load_logs.sql >
> > E:/Inetpub/wwwroot/update/load_logs.log';
>
> win_exec($command, "2", "0");
>
--- End Message ---
--- Begin Message ---
HELP!
I am trying to write an sql statement to get data from my Access database
through ODBC. Everything works okay if I write a simple Select statement,
but I need to write a statement like:
"SELECT Files.Fileame, Products.ProdName FROM Products INNER JOIN Files ON
Products.bid = Files.bid WHERE Products.ProdName LIKE *" . $ProdVar . "*";
I need the WHERE statement to use LIKE and wrap the variable $ProdVar in *
so users can do a text search on the field.
This is where things get nasty. I have tried every combination of * "" .
LIKE etc and get no records returned or an Access ODBC driver error saying
that there were "too few parameters. Expecting 1."
If anyone has a clue on how to write this statement, what is wrong with the
above, what can be fixed, changed, etc in php to make it work ... I would
really appreciate a hand.
Thanks
Dewey Williams
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hi!
I'm trying to insert sending of a "notice-mail" whenever someone submits to
a buletinboard.
I've checked the SMTP service with a mail-client, and sending mail works
fine. When I try to send via the mail() function in my php script, it fails
with the following warning:
"Warning: Failed to Receive in
L:\root_www_leilighet\app_to_top_of_guestbook.php on line 32"
wich refers to the line where I use "mail($email_recipient, $email_subject,
$text);"
Should I impress a certain format to my variables contents?
My php.ini looks like this:
[mail function]
; For Win32 only.
SMTP = 10.0.0.2 ; for Win32 only
; For Win32 only.
sendmail_from = [EMAIL PROTECTED] ; for Win32 only
Can anyone please help?
Regards, Georg Herland
--- End Message ---
--- Begin Message ---
Hello,
On 10/03/2002 04:04 AM, Georg Herland wrote:
> I'm trying to insert sending of a "notice-mail" whenever someone submits to
> a buletinboard.
> I've checked the SMTP service with a mail-client, and sending mail works
> fine. When I try to send via the mail() function in my php script, it fails
> with the following warning:
>
> "Warning: Failed to Receive in
> L:\root_www_leilighet\app_to_top_of_guestbook.php on line 32"
>
> wich refers to the line where I use "mail($email_recipient, $email_subject,
> $text);"
>
> Should I impress a certain format to my variables contents?
>
> My php.ini looks like this:
>
> [mail function]
> ; For Win32 only.
> SMTP = 10.0.0.2 ; for Win32 only
Is there really a SMTP server running in this address?
> ; For Win32 only.
> sendmail_from = [EMAIL PROTECTED] ; for Win32 only
The mail() function is known to be very broken and to produce useless
error messages. You may want to try this class that even comes with a
wrapper named smtp_mail() that is an emulation of the mail() function.
If there is any problem, at least it will produce useful error messages:
http://www.phpclasses.org/mimemessage
You also need this:
http://www.phpclasses.org/smtpclass
--
Regards,
Manuel Lemos
--- End Message ---