php-windows Digest 6 Feb 2004 08:50:36 -0000 Issue 2109
Topics (messages 22737 through 22741):
Re: Problem with form
22737 by: John Ellingsworth
22738 by: Disko_kex
SQL to select a set of records
22739 by: Herhuth, Ron
22740 by: Svensson, B.A.T. (HKG)
22741 by: Luis Moreira
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 ---
Is your question a javascript or PHP question?
For PHP you can do this:
$omr = $_POST['omr'] ;
if(is_array($omr))
{
for($k=0; $k<count($omr); $k++)
` {
$sql->Insert("insert into omr (omrID,omrNumber) values
('$omrID','$omr[$k]')");
$affected_rows = $sql->a_rows;
}
if ($affected_rows == 1)
{
echo "omr <font color=red>". $omrID . "</font> omr
successfully added to
the database.\n<BR />";
} else {
echo "omr <font color=red>". $omrID . "</font> omr was not
successfully
added to the database.<BR />Please try again.\n<BR />";
}
}
Thanks,
John Ellingsworth
http://mail.med.upenn.edu/~jellings/
AIM: vc2000support
-----Original Message-----
From: Disko_kex [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 10:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Problem with form
Hi
If a have a <select name="omr[]">, what is the name of the "select"? I
tried with both "omr" and "omr[]", but no one works. It works fine if
the name is "omr" but then it is only one value posted.
Maybe its easier to understand if you see it yourself:
http://www.lokalguiden.se/index2.php?action=ledigalokaler
It's the second select I must name omr[] to get all the values posted
but then the javascript doesn't understand the name omr[], what to do?
Thx.
--- End Message ---
--- Begin Message ---
Its not the progress of the form that's the problem. If a want to post
more the one value in a "<select>" the name must be "name =
"something[]" in php, but if the <select> is named with "[]" my
javascripts doesn't understand the name. So it's a javascript question.
This works:
<select Onchange="updateOrter(this.value,document.form_lediga.omr);">
//update "omr"
<select name="omr">
but then only one value from "omr" is posted with PHP
How can I get this work:
<select Onchange="updateOrter(this.value,document.form_lediga.omr);">
<select name="omr[]">
> -----Original Message-----
> From: John Ellingsworth [mailto:[EMAIL PROTECTED]
> Sent: den 5 februari 2004 16:10
> To: Disko_kex; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] Problem with form
>
> Is your question a javascript or PHP question?
>
> For PHP you can do this:
>
> $omr = $_POST['omr'] ;
> if(is_array($omr))
> {
> for($k=0; $k<count($omr); $k++)
> ` {
> $sql->Insert("insert into omr (omrID,omrNumber)
> values
> ('$omrID','$omr[$k]')");
> $affected_rows = $sql->a_rows;
> }
>
> if ($affected_rows == 1)
> {
> echo "omr <font color=red>". $omrID .
> "</font> omr successfully added to
> the database.\n<BR />";
> } else {
> echo "omr <font color=red>". $omrID .
> "</font> omr was not successfully
> added to the database.<BR />Please try again.\n<BR />";
> }
>
> }
>
>
>
> Thanks,
>
> John Ellingsworth
> http://mail.med.upenn.edu/~jellings/
> AIM: vc2000support
>
> -----Original Message-----
> From: Disko_kex [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 05, 2004 10:04 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Problem with form
>
>
> Hi
>
> If a have a <select name="omr[]">, what is the name of the "select"? I
> tried with both "omr" and "omr[]", but no one works. It works fine if
> the name is "omr" but then it is only one value posted.
>
> Maybe its easier to understand if you see it yourself:
> http://www.lokalguiden.se/index2.php?action=ledigalokaler
> It's the second select I must name omr[] to get all the values posted
> but then the javascript doesn't understand the name omr[], what to do?
>
> Thx.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I am trying to figure out how to bring back only a specific number of
records using a SQL statement in Microsoft SQL Server.
For example I know how to bring back the first x number of records from
the database:
SELECT Top x * FROM SQLTable
What I would like to do is to bring back only records 25-35 for example.
Is there a way to do this?
Thanks,
Ron
--- End Message ---
--- Begin Message ---
You can for instance insert the top 35 into a tmp table, then delete the top
10 with from-from in the temp table, and then finaly select the rest.
Alternative you can select top with decending order form the temp table, but
this depends on if you have an ordered set or not of course.
Another possiblility is to define a cursor, and then travers N rows, in it,
and then display N:th until the M:th rows, where N is low bondary and M your
high bondary.
I hope this gives you some insperation to spinn off with.
-----Original Message-----
From: Herhuth, Ron
To: [EMAIL PROTECTED]
Sent: 5-2-2004 20:58
Subject: [PHP-WIN] SQL to select a set of records
I am trying to figure out how to bring back only a specific number of
records using a SQL statement in Microsoft SQL Server.
For example I know how to bring back the first x number of records from
the database:
SELECT Top x * FROM SQLTable
What I would like to do is to bring back only records 25-35 for example.
Is there a way to do this?
Thanks,
Ron
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Not quite true.
>From the manuals :
The LIMIT clause can be used to constrain the number of rows returned by the
SELECT statement. LIMIT takes one or two numeric arguments. If two arguments
are given, the first specifies the offset of the first row to return, the
second specifies the maximum number of rows to return. The offset of the
initial row is 0 (not 1):
mysql> select * from table LIMIT 5,10; # Retrieve rows 6-15
If one argument is given, it indicates the maximum number of rows to return:
mysql> select * from table LIMIT 5; # Retrieve first 5 rows
Luis
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 05, 2004 9:57 PM
Subject: RE: [PHP-WIN] SQL to select a set of records
> You can for instance insert the top 35 into a tmp table, then delete the
top
> 10 with from-from in the temp table, and then finaly select the rest.
>
> Alternative you can select top with decending order form the temp table,
but
> this depends on if you have an ordered set or not of course.
>
> Another possiblility is to define a cursor, and then travers N rows, in
it,
> and then display N:th until the M:th rows, where N is low bondary and M
your
> high bondary.
>
> I hope this gives you some insperation to spinn off with.
>
>
> -----Original Message-----
> From: Herhuth, Ron
> To: [EMAIL PROTECTED]
> Sent: 5-2-2004 20:58
> Subject: [PHP-WIN] SQL to select a set of records
>
>
> I am trying to figure out how to bring back only a specific number of
> records using a SQL statement in Microsoft SQL Server.
>
> For example I know how to bring back the first x number of records from
> the database:
> SELECT Top x * FROM SQLTable
>
> What I would like to do is to bring back only records 25-35 for example.
>
> Is there a way to do this?
>
> Thanks,
> Ron
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---