|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help
lists.php.net
Date: Sat Mar 15 2008 - 05:20:44 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 15 Mar 2008 10:20:44 -0000 Issue 5349
Topics (messages 271620 through 271646):
Re: Is this the best way?
271620 by: TG
271621 by: Jason Pruim
271623 by: TG
271624 by: Jason Pruim
271625 by: Jim Lucas
Re: Posting Summary for Week Ending 14 March, 2008: php-general
lists.php.net
271622 by: Børge Holen
Newbie ' If Statement' Question
271626 by: cool7.hosting4days.com
271627 by: Nathan Nobbe
271628 by: Benjamin Darwin
Re: Sending multiple values from a form having same field names.
271629 by: Jim Lucas
271630 by: Eric Butera
<input type="checkbox">
271631 by: John Taylor-Johnston
271632 by: John Taylor-Johnston
271633 by: John Taylor-Johnston
271634 by: Robert Cummings
271635 by: John Taylor-Johnston
271636 by: John Taylor-Johnston
271637 by: John Taylor-Johnston
271638 by: John Taylor-Johnston
271639 by: Robert Cummings
271640 by: John Taylor-Johnston
271641 by: John Taylor-Johnston
271642 by: Robert Cummings
271643 by: John Taylor-Johnston
271644 by: John Taylor-Johnston
271645 by: Robert Cummings
Newbie Question on PHP-SOAP
271646 by: Chino Aureus
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
----- Original Message -----
From: Jason Pruim <japruim
raoset.com>
To: TG <tg-php
gryffyndevelopment.com>
Cc: "PHP General List" <php-general
lists.php.net>
Date: Fri, 14 Mar 2008 14:56:32 -0400
Subject: Re: [PHP] Is this the best way?
>
> On Mar 14, 2008, at 1:44 PM, TG wrote:
>
> >
> > What error are you getting? Maybe there's some way to fix that too.
>
> The error I get without checking the row count is this:
>
> You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'order by LName' at line 1
Ok so the next thing to check is your query. Maybe echo it out so you can
see what's actually attempting to execute.
I don't see an "ORDER BY" in the SQL listed below.
Usually when I get errors like this, it's because a variable I expect to be
populated isn't and it messes up the SQL by leaving a blank where it
expects something.
SELECT * FROM users WHERE username = 'tg' ORDER BY LName
If I had:
$user = "'tg'"
with the single-quotes inside the variable.. if I typo'd on $user and did
something like:
$query = "SELECT * FROM users WHERE username = $usr ORDER BY LName";
Then I'd get:
SELECT * FROM users WHERE username = ORDER BY LName
> >
> >
> > Just remember that errors and notices are like pain. It usually means
> > there's something wrong. If you're getting an error, there may be a
> > better
> > way of doing waht you're doing.
> >
> > Ideally, you should get zero results if there's no match in the user
> > database.
> >
> > Typically for a user lookup, you might do something like this:
> >
> > SELECT <whatever> FROM usertable WHERE username = '<username>' AND
> > password =
> > '<password>'
>
> Which is very simular to what I have:
>
> $loginQuery = "SELECT * FROM current WHERE loginName='".$user."' AND
> loginPassword='".$password."' LIMIT 0,1;";
> $loginResult = mysqli_query($link1, $loginQuery) or die("Wrong data
> supplied or database error" .mysqli_error($link1));
attached mail follows:
On Mar 14, 2008, at 5:03 PM, TG wrote:
>
>
>
> ----- Original Message -----
> From: Jason Pruim <japruim
raoset.com>
> To: TG <tg-php
gryffyndevelopment.com>
> Cc: "PHP General List" <php-general
lists.php.net>
> Date: Fri, 14 Mar 2008 14:56:32 -0400
> Subject: Re: [PHP] Is this the best way?
>
>>
>> On Mar 14, 2008, at 1:44 PM, TG wrote:
>>
>>>
>>> What error are you getting? Maybe there's some way to fix that too.
>>
>> The error I get without checking the row count is this:
>>
>> You have an error in your SQL syntax; check the manual that
>> corresponds to your MySQL server version for the right syntax to use
>> near 'order by LName' at line 1
>
> Ok so the next thing to check is your query. Maybe echo it out so
> you can
> see what's actually attempting to execute.
echo from my actual query
SELECT * FROM current WHERE loginName='japruim' AND
loginPassword='mybadpassword' LIMIT 0,1;
>
>
> I don't see an "ORDER BY" in the SQL listed below.
The ORDER BY actually comes from a different query that should ONLY be
done AFTER successful login... It's actually related to the sorting of
the records that should be retrieved.
>
>
> Usually when I get errors like this, it's because a variable I
> expect to be
> populated isn't and it messes up the SQL by leaving a blank where it
> expects something.
>
> SELECT * FROM users WHERE username = 'tg' ORDER BY LName
>
> If I had:
>
> $user = "'tg'"
>
> with the single-quotes inside the variable.. if I typo'd on $user
> and did
> something like:
>
> $query = "SELECT * FROM users WHERE username = $usr ORDER BY LName";
>
> Then I'd get:
>
> SELECT * FROM users WHERE username = ORDER BY LName
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
japruim
raoset.com
attached mail follows:
Then it's the other query (with the ORDER BY) that you want to look at to fix
the SQL error.
Don't forget to use (assuming MySQL) mysql_real_escape_string() on all
variables being used in the SQL query. That'll help prevent a problem with
single quotes or other bad characters showing up in your variables and
breaking your SQL. Not to mention the security benefits.
-TG
----- Original Message -----
From: Jason Pruim <japruim
raoset.com>
To: "TG" <tg-php
gryffyndevelopment.com>
Cc: "PHP General List" <php-general
lists.php.net>
Date: Fri, 14 Mar 2008 17:11:40 -0400
> > Ok so the next thing to check is your query. Maybe echo it out so
> > you can
> > see what's actually attempting to execute.
>
> echo from my actual query
> SELECT * FROM current WHERE loginName='japruim' AND
> loginPassword='mybadpassword' LIMIT 0,1;
> >
> >
> > I don't see an "ORDER BY" in the SQL listed below.
>
> The ORDER BY actually comes from a different query that should ONLY be
> done AFTER successful login... It's actually related to the sorting of
> the records that should be retrieved.
attached mail follows:
On Mar 14, 2008, at 5:40 PM, TG wrote:
>
> Then it's the other query (with the ORDER BY) that you want to look
> at to fix
> the SQL error.
>
> Don't forget to use (assuming MySQL) mysql_real_escape_string() on all
> variables being used in the SQL query. That'll help prevent a
> problem with
> single quotes or other bad characters showing up in your variables and
> breaking your SQL. Not to mention the security benefits.
All that's taken care of... The issue is though, that that query is
getting run even when the login wasn't successful... When you log in
with the proper username/password that query runs just fine...
>
>
> -TG
>
> ----- Original Message -----
> From: Jason Pruim <japruim
raoset.com>
> To: "TG" <tg-php
gryffyndevelopment.com>
> Cc: "PHP General List" <php-general
lists.php.net>
> Date: Fri, 14 Mar 2008 17:11:40 -0400
>
>>> Ok so the next thing to check is your query. Maybe echo it out so
>>> you can
>>> see what's actually attempting to execute.
>>
>> echo from my actual query
>> SELECT * FROM current WHERE loginName='japruim' AND
>> loginPassword='mybadpassword' LIMIT 0,1;
>>>
>>>
>>> I don't see an "ORDER BY" in the SQL listed below.
>>
>> The ORDER BY actually comes from a different query that should ONLY
>> be
>> done AFTER successful login... It's actually related to the sorting
>> of
>> the records that should be retrieved.
>
>
attached mail follows:
Jason Pruim wrote:
>
> On Mar 14, 2008, at 5:03 PM, TG wrote:
>
>>
>>
>>
>> ----- Original Message -----
>> From: Jason Pruim <japruim
raoset.com>
>> To: TG <tg-php
gryffyndevelopment.com>
>> Cc: "PHP General List" <php-general
lists.php.net>
>> Date: Fri, 14 Mar 2008 14:56:32 -0400
>> Subject: Re: [PHP] Is this the best way?
>>
>>>
>>> On Mar 14, 2008, at 1:44 PM, TG wrote:
>>>
>>>>
>>>> What error are you getting? Maybe there's some way to fix that too.
>>>
>>> The error I get without checking the row count is this:
>>>
>>> You have an error in your SQL syntax; check the manual that
>>> corresponds to your MySQL server version for the right syntax to use
>>> near 'order by LName' at line 1
>>
>> Ok so the next thing to check is your query. Maybe echo it out so you
>> can
>> see what's actually attempting to execute.
>
> echo from my actual query
> SELECT * FROM current WHERE loginName='japruim' AND
> loginPassword='mybadpassword' LIMIT 0,1;
obviously it isn't this SQL statement that is causing the problem, it doesn't
have the ORDER BY piece that is failing.
>>
>>
>> I don't see an "ORDER BY" in the SQL listed below.
>
> The ORDER BY actually comes from a different query that should ONLY be
> done AFTER successful login... It's actually related to the sorting of
> the records that should be retrieved.
Somehow it is getting to this statement and the variable that you are using just
before the ORDER BY part is empty, Why don't you show us that statement.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
attached mail follows:
On Friday 14 March 2008 21:24:30 Jason Pruim wrote:
> So... After this post gets sent... Does Dan have some code in here to
> kill all traffic on the list for a minimum amount of time? :)
no but he does some time travel.
merry christmas everyone! ;D
>
> Happy Friday everyone!
>
> On Mar 14, 2008, at 4:00 PM, PostTrack [Dan Brown] wrote:
> > Posting Summary for PHP-General List
> > Week Ending: Friday, 14 March, 2008
> >
> > Messages | Bytes | Sender
> > --------------------+--------------------+------------------
> > 480 (100%) 799678 (100%) EVERYONE
> > 39 (8.1%) 36359 (4.5%) Daniel Brown <parasane at
> > gmail dot com>
> > 30 (6.3%) 36149 (4.5%) tedd <tedd dot sperling at
> > gmail dot com>
> > 29 (6%) 27607 (3.5%) Greg Donald <gdonald at
> > gmail dot com>
> > 18 (3.8%) 26766 (3.3%) Robert Cummings <robert at
> > interjinn dot com>
> > 16 (3.3%) 19915 (2.5%) Aschwin Wesselius <aschwin
> > at illuminated dot nl>
> > 16 (3.3%) 10147 (1.3%) Richard Heyes <richardh at
> > phpguru dot org>
> > 15 (3.1%) 28839 (3.6%) Shawn McKenzie <nospam at
> > mckenzies dot net>
> > 14 (2.9%) 18288 (2.3%) Stut <stuttle at gmail dot
> > com>
> > 14 (2.9%) 24748 (3.1%) Jason Pruim <japruim at
> > raoset dot com>
> > 13 (2.7%) 16242 (2%) Thijs Lensselink <dev at
> > lenss dot nl>
> > 13 (2.7%) 24267 (3%) It Maq <itmaqurfe at yahoo
> > dot com>
> > 12 (2.5%) 8291 (1%) Per Jessen <per at computer
> > dot org>
> > 12 (2.5%) 22543 (2.8%) Zoltán Németh <znemeth at
> > alterationx dot hu>
> > 11 (2.3%) 21755 (2.7%) Eric Butera <eric dot butera
> > at gmail dot com>
> > 11 (2.3%) 17774 (2.2%) Alain Roger <raf dot news at
> > gmail dot com>
> > 10 (2.1%) 20007 (2.5%) Ray Hauge <ray dot hauge dot
> > lists at gmail dot com>
> > 9 (1.9%) 31225 (3.9%) Andrés Robinet <agrobinet at
> > bestplace dot biz>
> > 9 (1.9%) 10301 (1.3%) Wolf <LoneWolf at nc dot rr
> > dot com>
> > 8 (1.7%) 18532 (2.3%) TG <tg-php at
> > gryffyndevelopment dot com>
> > 8 (1.7%) 10605 (1.3%) Philip Thompson
> > <philthathril at gmail dot com>
> > 8 (1.7%) 5096 (0.6%) Bill <billlab51 at hotmail
> > dot com>
> > 7 (1.5%) 4871 (0.6%) Chris <dmagick at gmail dot
> > com>
> > 6 (1.3%) 9135 (1.1%) Nathan Nobbe <quickshiftin
> > at gmail dot com>
> > 5 (1%) 8546 (1.1%) Jim Lucas <lists at cmsws
> > dot com>
> > 5 (1%) 5191 (0.6%) Eric Gorr <mailist at
> > ericgorr dot net>
> > 5 (1%) 5025 (0.6%) Børge Holen <borge at
> > arivene dot net>
> > 5 (1%) 3873 (0.5%) Murat BEÅžER <murat at murat-
> > beser dot com>
> > 4 (0.8%) 7319 (0.9%) Larry Garfield <larry at
> > garfieldtech dot com>
> > 4 (0.8%) 6834 (0.9%) Adil Drissi <adil dot drissi
> > at yahoo dot com>
> > 4 (0.8%) 11467 (1.4%) Lamonte <php4food at gmail
> > dot com>
> > 4 (0.8%) 1985 (0.2%) Anup Shukla <anup dot shkl
> > at gmail dot com>
> > 4 (0.8%) 2192 (0.3%) Lamonte H <php4food at gmail
> > dot com>
> > 3 (0.6%) 4440 (0.6%) Lamp Lists <lamp dot lists
> > at yahoo dot com>
> > 3 (0.6%) 9173 (1.1%) Andrés Robinet <agrobinet at
> > bestplace dot biz>
> > 3 (0.6%) 3532 (0.4%) Dave Goodchild <buddhamagnet
> > at gmail dot com>
> > 3 (0.6%) 3389 (0.4%) Al <news at ridersite dot org>
> > 3 (0.6%) 6984 (0.9%) Stephane Ulysse <Stephanu at
> > bachrachgroup dot com>
> > 3 (0.6%) 4300 (0.5%) Angelo Zanetti <angelo at
> > elemental dot co dot za>
> > 2 (0.4%) 1060 (0.1%) Steven Macintyre <steven at
> > steven dot macintyre dot name>
> > 2 (0.4%) 3596 (0.4%) Willian Schubert Baldasso
> > <redesistema at gmail dot com>
> > 2 (0.4%) 2023 (0.3%) dev at lenss dot nl
> > 2 (0.4%) 2604 (0.3%) Børge Holen <borge at
> > arivene dot net>
> > 2 (0.4%) 1876 (0.2%) David Giragosian
> > <dgiragosian at gmail dot com>
> > 2 (0.4%) 2829 (0.4%) Matty Sarro <msarro at gmail
> > dot com>
> > 2 (0.4%) 2087 (0.3%) H u g o H i r a m <hugo at
> > hugohiram dot com>
> > 2 (0.4%) 878 (0.1%) Tim Daff <timdaff at gmail
> > dot com>
> > 2 (0.4%) 1917 (0.2%) John Comerford <johnc at
> > optionsystems dot com dot au>
> > 2 (0.4%) 1739 (0.2%) sinseven at aol dot com
> > 2 (0.4%) 1897 (0.2%) mathieu leddet <mathieu dot
> > leddet at mobilescope dot com>
> > 2 (0.4%) 5329 (0.7%) Edward Kay <edward at labhut
> > dot com>
> > 2 (0.4%) 1684 (0.2%) jeffry s <paragasu at gmail
> > dot com>
> > 2 (0.4%) 522 (0.1%) VamVan <vamseevan at gmail
> > dot com>
> > 2 (0.4%) 50180 (6.3%) Evone Wong<nbmopp at
> > streamyx dot com>
> > 2 (0.4%) 50180 (6.3%) Evone Wong<tduhfl at yahoo
> > dot com dot my>
> > 2 (0.4%) 623 (0.1%) John Taylor-Johnston <jt dot
> > johnston at USherbrooke dot ca>
> > 2 (0.4%) 5304 (0.7%) nihilism machine
> > <nihilismmachine at gmail dot com>
> > 2 (0.4%) 2170 (0.3%) Danny Brow <maillist at
> > fullmotions dot com>
> > 2 (0.4%) 50180 (6.3%) Evone Wong<rjcetc at sina
> > dot com>
> > 2 (0.4%) 993 (0.1%) Ian M dot Evans <ianevans
> > at digitalhit dot com>
> > 2 (0.4%) 797 (0.1%) John Taylor-Johnston <John
> > dot Taylor-Johnston at cegepsherbrooke dot qc dot ca>
> > 2 (0.4%) 2141 (0.3%) Ken Kixmoeller <Kixjaguar at
> > comcast dot net>
> > 2 (0.4%) 1759 (0.2%) Shelley <myphplist at gmail
> > dot com>
> > 1 (0.2%) 862 (0.1%) Dan Joseph <dmjoseph at
> > gmail dot com>
> > 1 (0.2%) 289 (0%) André Medeiros <andre dot
> > caum at gmail dot com>
> > 1 (0.2%) 730 (0.1%) Steve Finkelstein <sf at
> > stevefink dot net>
> > 1 (0.2%) 1883 (0.2%) Wolf <lonewolf at nc dot rr
> > dot com>
> > 1 (0.2%) 311 (0%) Colin Guthrie <gmane at
> > colin dot guthr dot ie>
> > 1 (0.2%) 567 (0.1%) Sn!per <sniper at home dot
> > net dot my>
> > 1 (0.2%) 1960 (0.2%) Virgil Hilts <sixty4rpm at
> > gmail dot com>
> > 1 (0.2%) 1222 (0.2%) Julio César GarcÃa
> > VizcaÃno <fuego216 at gmail dot com>
> > 1 (0.2%) 2328 (0.3%) Martin Jerga <martinjerga at
> > gmail dot com>
> > 1 (0.2%) 1345 (0.2%) Wolf <lonewolf at nc dot rr
> > dot com>
> > 1 (0.2%) 2603 (0.3%) Roland Häder <r dot haeder
> > at will-hier-weg dot de>
> > 1 (0.2%) 862 (0.1%) Gustavo Narea <me at
> > gustavonarea dot net>
> > 1 (0.2%) 1203 (0.2%) Manuel Lemos <mlemos at acm
> > dot org>
> > 1 (0.2%) 1922 (0.2%) Steve Edberg <sbedberg at
> > ucdavis dot edu>
> > 1 (0.2%) 2112 (0.3%) Suamya Srivastava <suamya
> > dot srivastava at connexios dot com>
> > 1 (0.2%) 869 (0.1%) Rick Pasotto <rick at niof
> > dot net>
> > 1 (0.2%) 1096 (0.1%) good_times <ukraine dot
> > believe at gmail dot com>
> > 1 (0.2%) 785 (0.1%) spacemarc <spacemarc at
> > gmail dot com>
> > 1 (0.2%) 849 (0.1%) Christoph Boget <christoph
> > dot boget at gmail dot com>
> > 1 (0.2%) 1704 (0.2%) Ken Kixmoeller dot com <ken
> > at kixmoeller dot com>
> > 1 (0.2%) 779 (0.1%) Thiago Pojda <thiago dot
> > pojda at softpartech dot com dot br>
> > 1 (0.2%) 1812 (0.2%) Arvids Godjuks <arvids dot
> > godjuks at gmail dot com>
> > 1 (0.2%) 2750 (0.3%) Mike <mmelvin0 at gmail dot
> > com>
> > 1 (0.2%) 1102 (0.1%) Roberto Mansfield <robertom
> > at sas dot upenn dot edu>
> > 1 (0.2%) 615 (0.1%) Samuel Marshall <smarshall
> > at cwjamaica dot com>
> > 1 (0.2%) 8193 (1%) PostTrack [Dan Brown]
> > <listwatch-php-general at pilotpig dot net>
> > 1 (0.2%) 430 (0.1%) cadaver at planethalflife
> > dot com
> > 1 (0.2%) 3091 (0.4%) Berno Eckols <recurred at
> > pareteweb dot com>
> > 1 (0.2%) 630 (0.1%) php at onsiteupdate dot com
> > 1 (0.2%) 3041 (0.4%) Ruvalcava Obermuller
> > <ultrafast at mexworx dot com>
> > 1 (0.2%) 3038 (0.4%) Hind Hort <chaeta at mambod
> > dot com>
> > 1 (0.2%) 1768 (0.2%) Warren Vail <warren at
> > vailtech dot net>
> > 1 (0.2%) 1443 (0.2%) Sofia Jacob (CA) <jacobsofia
> > at yahoo dot ca>
> > 1 (0.2%) 395 (0%) Gustavo Narea <me at
> > gustavonarea dot net>
> > 1 (0.2%) 1912 (0.2%) Zareef Ahmed <zareef at
> > zareef dot net>
> > 1 (0.2%) 1865 (0.2%) Shiplu <shiplu dot net at
> > gmail dot com>
> > 1 (0.2%) 1186 (0.1%) Hiep Nguyen <hiep at ee dot
> > ucr dot edu>
> > 1 (0.2%) 1390 (0.2%) Jean-Christophe Roux <jcxxr
> > at yahoo dot com>
> > 1 (0.2%) 504 (0.1%) Frank Arensmeier <frank dot
> > arensmeier at nikehydraulics dot se>
> > 1 (0.2%) 1341 (0.2%) Mr Webber <captain_webber at
> > hotmail dot com>
> > 1 (0.2%) 3143 (0.4%) bruce <bedouglas at
> > earthlink dot net>
> > 1 (0.2%) 1269 (0.2%) chetan rane <chetan dot d
> > dot rane at gmail dot com>
> > 1 (0.2%) 656 (0.1%) William Piper <billy at
> > kersting dot com>
> > 1 (0.2%) 222 (0%) Lamonte H <php4food at gmail
> > dot com>
> > 1 (0.2%) 581 (0.1%) Skip Evans <skip at
> > bigskypenguin dot com>
> > 1 (0.2%) 2940 (0.4%) Stephania Bejaran
> > <cordwainery at irishouse dot org>
> >
> >
> > NOTE: Numbers may not add up to 100% due to protection of names and
> > addresses upon request.
> >
> > DISCLAIMER: If you want your email address omitted from future
> > weekly reports,
> > please email me privately at parasane
gmail.com and it will be
> > removed.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> japruim
raoset.com
--
---
Børge Holen
http://www.arivene.net
attached mail follows:
Hello Folks,
I would like to be able to wrap a 'form' inside a php 'if statement' - so
that the form will appear if the 'if condition' is met.
- most likely I cannot have a <?php tag inside another one - and am sure
I'm doing other things wrong also...
- now I get the error - Parse error: syntax error, unexpected T_STRING in...
Q: What is the best way to accomplish this goal?
-----------------------
<?php if ($emp_row->getField('testfield') !="") {
print "<form name="edit" method="post" action="emp_edit_result2.php">
<input type="hidden" name="Status" value="Active"/>
<input type="hidden" name="The_Date" value=""/>
<input type="hidden" name="-recid" value="<?php echo
$emp_row->getRecordId(); ?>">
<input type="submit" name="edit_submit" value="Activate">
</form>
";}else {print "Non Print";} ?>
--
Thanks - RevDave
Cool7
hosting4days . com
[db-lists]
attached mail follows:
On Fri, Mar 14, 2008 at 7:56 PM, cool7
hosting4days.com <
cool7
hosting4days.com> wrote:
> Hello Folks,
>
> I would like to be able to wrap a 'form' inside a php 'if statement' - so
> that the form will appear if the 'if condition' is met.
>
> - most likely I cannot have a <?php tag inside another one - and am sure
> I'm doing other things wrong also...
> - now I get the error - Parse error: syntax error, unexpected T_STRING
> in...
>
> Q: What is the best way to accomplish this goal?
>
> -----------------------
>
> <?php if ($emp_row->getField('testfield') !="") {
> print "<form name="edit" method="post" action="emp_edit_result2.php">
> <input type="hidden" name="Status" value="Active"/>
> <input type="hidden" name="The_Date" value=""/>
> <input type="hidden" name="-recid" value="<?php echo
> $emp_row->getRecordId(); ?>">
> <input type="submit" name="edit_submit" value="Activate">
> </form>
>
> ";}else {print "Non Print";} ?>
>
something like this,
<?php if($emp_row->getField('testfield') != '') { ?>
<form name="edit" method="post" action="emp_edit_result2.php">
<input type="hidden" name="Status" value="Active" />
<input type="hidden" name="The_Date" value="" />
<input type="hidden" name="-recid" value="<?php echo
$emp_row->getRecordId(); ?> />
<input type="submit" name="edit_submit" value="Activate" />
</form>
<?php } ?>
// warning: typed directly into browser w/ no testing ;)
-nathan
attached mail follows:
On Fri, Mar 14, 2008 at 7:56 PM, cool7
hosting4days.com <
cool7
hosting4days.com> wrote:
> Hello Folks,
>
> I would like to be able to wrap a 'form' inside a php 'if statement' - so
> that the form will appear if the 'if condition' is met.
>
> - most likely I cannot have a <?php tag inside another one - and am sure
> I'm doing other things wrong also...
> - now I get the error - Parse error: syntax error, unexpected T_STRING
> in...
>
> Q: What is the best way to accomplish this goal?
>
>
> -----------------------
>
> <?php if ($emp_row->getField('testfield') !="") {
> print "<form name="edit" method="post" action="emp_edit_result2.php">
> <input type="hidden" name="Status" value="Active"/>
> <input type="hidden" name="The_Date" value=""/>
> <input type="hidden" name="-recid" value="<?php echo
> $emp_row->getRecordId(); ?>">
> <input type="submit" name="edit_submit" value="Activate">
> </form>
>
> ";}else {print "Non Print";} ?>
>
>
>
> --
> Thanks - RevDave
> Cool7
hosting4days . com
> [db-lists]
>
Your first mistake I'm finding is the use of quotes. You started the print
with a ", which means the print ends at name=", and it's expecting more PHP
code, rather than a HTML string. The first fix would be to either escape all
quotes in the HTML with a slash (\) before it, or to change your opening and
closing quotes on the print to a single quote (').
Second, yes, you cannot enclose PHP tags inside PHP tags. To do this,
change that portion to end the print, attach the two portions with a period
(.) and start up with the php function, then a period, and back to the
print.
Here's a fix that should work. I haven't tested it though, so I may have
missed one or two quotes.
<?php if ($emp_row->getField('testfield') !="") {
print "<form name=\"edit\" method=\"post\"
action=\"emp_edit_result2.php\">
<input type=\"hidden\" name=\"Status\" value=\"Active\"/>
<input type=\"hidden\" name=\"The_Date\" value=\"\"/>
<input type=\"hidden\" name=\"-recid\" value=\""$emp_row->getRecordId()."\">
<input type=\"submit\" name=\"edit_submit\" value=\"Activate\">
</form>
";}else {print "Non Print";} ?>
attached mail follows:
Eric Butera wrote:
> On Fri, Mar 14, 2008 at 6:02 AM, Zoltán Németh <znemeth
alterationx.hu> wrote:
>> 2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt Ãrta:
>>
>>> Hi,
>> >
>> > How can I send multiple values from a form to be stored in a database, as
>> > name of the fields is the same?
>> >
>> > For example:
>> >
>> > <?php
>> > foreach ($field_data as $field) {
>> >
>> > $field_name=$field["field_name"];
>> > $field_id=$field["field_id"];
>> > $datatype=$field["datatype_name"];
>> >
>> > ?>
>> > <input type="hidden" name="field_id" value="<?php echo $field_id;?>" />
>> > <tr>
>> > <td><strong><?php echo $field_name;?><strong></td>
>> > <?php
>> > if ($datatype=="text" || $datatype=="integer") {
>> > echo "<td><input type=\"text\" name=\"field_data\"></td>";
>>
>> make field_data an array indexed by field_id
>>
>> <input type="text" name="field_data[<?php echo $field_id; ?>]"
>>
>> greets,
>> Zoltán Németh
>>
>>
>>
>> > }
>> > elseif ($datatype=="textarea") {
>> > echo "<td><textarea rows=\"10\" cols=\"100\"
>> > name=\"field_data\"></textarea><br></td>";
>> > }
>> > echo "</tr>";
>> > }
>> > ?>
>> >
>> > This creates a form with field names and text box or textarea box next to
>> > each field name depending on the datatype. After the user enters the
>> > values in the text or textarea and clicks submit, the values should get
>> > stored in a database. But what is happening is that only the value entered
>> > in the last field of the form is getting entered into the database.
>> > This code is embedded in an application which is having an inbuilt
>> > structure of taking the values from a form in a hash. Since key is the
>> > same (i.e. field_id) everytime, the value gets overwritten and only the
>> > last value gets stored in db. But I am not able to work out a solution for
>> > this.
>> > I hope I am able to make my problem clear enough.
>> >
>> > Thanks,
>> > Suamya.
>> >
>> >
>> >
>> >
>> > -----------------------------------------------------------------------------
>> > DISCLAIMER:-
>> > "The information in this e-mail is confidential, and is intended
>> > solely for the addressee or addressees. If you are not the intended recipient,
>> > please delete the mail and kindly notify the sender of misdelivery. Any
>> > unauthorised use or disclosure of the contents of the mail is not permitted
>> > and may be unlawful."
>> > -----------------------------------------------------------------------------
>> >
>> > "Scanned By MailScanner"
>> >
>> >
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Since Zoltán give you the answer I might give you another fish. Which
> one is more readable:
>
> <input type="hidden" name="field_id" value="<?php echo $field_id;?>" />
> <tr>
> <td><strong><?php echo $field_name;?><strong></td>
> <?php
> if ($datatype=="text" || $datatype=="integer") {
> echo "<td><input type=\"text\" name=\"field_data\"></td>";
> }
> elseif ($datatype=="textarea") {
> echo "<td><textarea rows=\"10\" cols=\"100\"
> name=\"field_data\"></textarea><br></td>";
> }
> echo "</tr>";
> }
> ?>
>
>
> <input type="hidden" name="field_id" value="<?php echo
> htmlspecialchars($field_id); ?>" />
> <tr>
> <td><strong><?php echo htmlspecialchars($field_name); ?><strong></td>
>
> <?php if ($datatype=="text" || $datatype=="integer"): ?>
> <td><input type="text" name="field_data"></td>
> <?php elseif ($datatype=="textarea"): ?>
> <td>
> <textarea rows="10" cols="100" name="field_data"></textarea>
> <br>
> </td>
> <?php endif; ?>
>
> </tr>
This is more readable
<?php
while ( $row = mysql_fetch_row($result_set) ) {
# Extract all data fields from result set
list($datatype,$field_id,$field_name,etc...) = $row;
# Initialize or clear variable
$field = '';
# Check to see if it requires a text field
if ( $datatype == "text" || $datatype == "integer" ) {
# Create Text field
$field = '<input type="text" name="field_data[{$field_id}]" />';
# Check to see if it requires a text area
} elseif ( $datatype == "textarea" ) {
# Create Text Area
$field = '<textarea rows="10" cols="100" name="field_data[{$field_id}]">'.
'</textarea>';
}
# Display it all
echo <<<ROW
<tr>
<td><strong>{$field_name}</strong></td>
<td>{$field}</td>
</tr>
ROW;
}
?>
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
attached mail follows:
On Fri, Mar 14, 2008 at 8:12 PM, Jim Lucas <lists
cmsws.com> wrote:
>
> Eric Butera wrote:
> > On Fri, Mar 14, 2008 at 6:02 AM, Zoltán Németh <znemeth
alterationx.hu> wrote:
> >> 2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt Ãrta:
> >>
> >>> Hi,
> >> >
> >> > How can I send multiple values from a form to be stored in a database, as
> >> > name of the fields is the same?
> >> >
> >> > For example:
> >> >
> >> > <?php
> >> > foreach ($field_data as $field) {
> >> >
> >> > $field_name=$field["field_name"];
> >> > $field_id=$field["field_id"];
> >> > $datatype=$field["datatype_name"];
> >> >
> >> > ?>
> >> > <input type="hidden" name="field_id" value="<?php echo $field_id;?>" />
> >> > <tr>
> >> > <td><strong><?php echo $field_name;?><strong></td>
> >> > <?php
> >> > if ($datatype=="text" || $datatype=="integer") {
> >> > echo "<td><input type=\"text\" name=\"field_data\"></td>";
> >>
> >> make field_data an array indexed by field_id
> >>
> >> <input type="text" name="field_data[<?php echo $field_id; ?>]"
> >>
> >> greets,
> >> Zoltán Németh
> >>
> >>
> >>
> >> > }
> >> > elseif ($datatype=="textarea") {
> >> > echo "<td><textarea rows=\"10\" cols=\"100\"
> >> > name=\"field_data\"></textarea><br></td>";
> >> > }
> >> > echo "</tr>";
> >> > }
> >> > ?>
> >> >
> >> > This creates a form with field names and text box or textarea box next to
> >> > each field name depending on the datatype. After the user enters the
> >> > values in the text or textarea and clicks submit, the values should get
> >> > stored in a database. But what is happening is that only the value entered
> >> > in the last field of the form is getting entered into the database.
> >> > This code is embedded in an application which is having an inbuilt
> >> > structure of taking the values from a form in a hash. Since key is the
> >> > same (i.e. field_id) everytime, the value gets overwritten and only the
> >> > last value gets stored in db. But I am not able to work out a solution for
> >> > this.
> >> > I hope I am able to make my problem clear enough.
> >> >
> >> > Thanks,
> >> > Suamya.
> >> >
> >> >
> >> >
> >> >
> >> > -----------------------------------------------------------------------------
> >> > DISCLAIMER:-
> >> > "The information in this e-mail is confidential, and is intended
> >> > solely for the addressee or addressees. If you are not the intended recipient,
> >> > please delete the mail and kindly notify the sender of misdelivery. Any
> >> > unauthorised use or disclosure of the contents of the mail is not permitted
> >> > and may be unlawful."
> >> > -----------------------------------------------------------------------------
> >> >
> >> > "Scanned By MailScanner"
> >> >
> >> >
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > Since Zoltán give you the answer I might give you another fish. Which
> > one is more readable:
> >
> > <input type="hidden" name="field_id" value="<?php echo $field_id;?>" />
> > <tr>
> > <td><strong><?php echo $field_name;?><strong></td>
> > <?php
> > if ($datatype=="text" || $datatype=="integer") {
> > echo "<td><input type=\"text\" name=\"field_data\"></td>";
> > }
> > elseif ($datatype=="textarea") {
> > echo "<td><textarea rows=\"10\" cols=\"100\"
> > name=\"field_data\"></textarea><br></td>";
> > }
> > echo "</tr>";
> > }
> > ?>
> >
> >
> > <input type="hidden" name="field_id" value="<?php echo
> > htmlspecialchars($field_id); ?>" />
> > <tr>
> > <td><strong><?php echo htmlspecialchars($field_name); ?><strong></td>
> >
> > <?php if ($datatype=="text" || $datatype=="integer"): ?>
> > <td><input type="text" name="field_data"></td>
> > <?php elseif ($datatype=="textarea"): ?>
> > <td>
> > <textarea rows="10" cols="100" name="field_data"></textarea>
> > <br>
> > </td>
> > <?php endif; ?>
> >
> > </tr>
>
> This is more readable
>
> <?php
> while ( $row = mysql_fetch_row($result_set) ) {
>
> # Extract all data fields from result set
> list($datatype,$field_id,$field_name,etc...) = $row;
>
> # Initialize or clear variable
> $field = '';
>
> # Check to see if it requires a text field
>
> if ( $datatype == "text" || $datatype == "integer" ) {
>
> # Create Text field
> $field = '<input type="text" name="field_data[{$field_id}]" />';
>
> # Check to see if it requires a text area
> } elseif ( $datatype == "textarea" ) {
>
> # Create Text Area
> $field = '<textarea rows="10" cols="100" name="field_data[{$field_id}]">'.
> '</textarea>';
>
> }
> # Display it all
> echo <<<ROW
> <tr>
> <td><strong>{$field_name}</strong></td>
> <td>{$field}</td>
> </tr>
> ROW;
> }
> ?>
>
>
> --
> Jim Lucas
>
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
> by William Shakespeare
>
Not really. Also you aren't escaping your output.
attached mail follows:
Am coding something. Cannot quite clear my head. I know what my SQL
looks like. I just cannot see clearly to input it.
What is $_POST["checkregion"] going to look like? Is it going to have
all the convenient commas I will need in my SQL? Or do I have to parse
God knows how many checkboxes?
John
<input type="text" name="Name">
<label><input type="checkbox" name="checkregion" value="Knowlton">A</label>
<label><input type="checkbox" name="checkregion" value="Thetford
Mines">A</label>
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', 'Knowlton,Thetford Mines') ';
CREATE TABLE IF NOT EXISTS `GLApplications` (
`Name` varchar(200) NOT NULL,
set(''Knowlton','Thetford Mines','Clarenceville','Sawyerville','Laval')
NOT NULL,
`dummy` int(10) NOT NULL auto_increment,
PRIMARY KEY (`dummy`)
)
attached mail follows:
http://www.glquebec.org/English/test.php
When I check "Knowlton" and "Thetford Mines" or others, only "Thetford
Mines" shows up in phpinfo(). $_POST["checkregion"] only sees "Thetford
Mines".
What am I doing wrong? How do I parse value checkregion? Or set this up
differently?
> <input type="text" name="Name">
> <label><input type="checkbox" name="checkregion" value="Knowlton">A</label>
> <label><input type="checkbox" name="checkregion" value="Thetford
> Mines">A</label>
>
>
> CREATE TABLE IF NOT EXISTS `GLApplications` (
> `Name` varchar(200) NOT NULL,
> set(''Knowlton','Thetford Mines','Clarenceville','Sawyerville','Laval')
> NOT NULL,
> `dummy` int(10) NOT NULL auto_increment,
> PRIMARY KEY (`dummy`)
> )
attached mail follows:
$_POST["checkregion"] is supposed to be an array, no?
John Taylor-Johnston wrote:
> http://www.glquebec.org/English/test.php
> When I check "Knowlton" and "Thetford Mines" or others, only "Thetford
> Mines" shows up in phpinfo(). $_POST["checkregion"] only sees
> "Thetford Mines".
> What am I doing wrong? How do I parse value checkregion? Or set this
> up differently?
>
>> <input type="text" name="Name">
>> <label><input type="checkbox" name="checkregion"
>> value="Knowlton">A</label>
>> <label><input type="checkbox" name="checkregion" value="Thetford
>> Mines">A</label>
>>
>>
>> CREATE TABLE IF NOT EXISTS `GLApplications` (
>> `Name` varchar(200) NOT NULL,
>> set(''Knowlton','Thetford
>> Mines','Clarenceville','Sawyerville','Laval') NOT NULL,
>> `dummy` int(10) NOT NULL auto_increment,
>> PRIMARY KEY (`dummy`)
>> )
>
>
attached mail follows:
On Fri, 2008-03-14 at 23:14 -0400, John Taylor-Johnston wrote:
> $_POST["checkregion"] is supposed to be an array, no?
You want the following (otherwise each checked entry overwrites the
previous):
<input type="checkbox" name="checkregion[]" value="Knowlton" />
<input type="checkbox" name="checkregion[]" value="Thetford Mines" />
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Ah! ok,
Array
(
[0] => Hemmingford
[1] => Huntingdon
)
How do I set up my $sql?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '".implode(',', $_POST['myvalues']."') ';
... Hey!! What is this?
Diagnostic-Code: smtp; 550-5.7.1 mail rejected by policy. SURBL hit
550-Spammy
URLs in your message 550 See
http://master.php.net/mail/why.php?why=SURBL
Robert Cummings wrote:
> On Fri, 2008-03-14 at 23:14 -0400, John Taylor-Johnston wrote:
>> $_POST["checkregion"] is supposed to be an array, no?
>
> You want the following (otherwise each checked entry overwrites the
> previous):
>
> <input type="checkbox" name="checkregion[]" value="Knowlton" />
> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
>
> Cheers,
> Rob.
attached mail follows:
Ah! ok,
Array
(
[0] => Hemmingford
[1] => Huntingdon
)
How do I set up my $sql?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '".implode(',', $_POST['myvalues']."') ';
... Hey!! What is this?
Diagnostic-Code: smtp; 550-5.7.1 mail rejected by policy. SURBL hit
550-Spammy
URLs in your message 550 See
http://master.php.net/mail/why.php?why=SURBL
Robert Cummings wrote:
> On Fri, 2008-03-14 at 23:14 -0400, John Taylor-Johnston wrote:
>> $_POST["checkregion"] is supposed to be an array, no?
>
> You want the following (otherwise each checked entry overwrites the
> previous):
>
> <input type="checkbox" name="checkregion[]" value="Knowlton" />
> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
>
> Cheers,
> Rob.
attached mail follows:
Will this do it?
> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> values ('John', '".implode(',', serialise($_POST['checkregion'])."') ';
http://ca.php.net/manual/en/function.serialize.php
> Array
> (
> [0] => Hemmingford
> [1] => Huntingdon
> )
>
>> <input type="checkbox" name="checkregion[]" value="Knowlton" />
>> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
attached mail follows:
Sorry, will this work?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '".serialise($_POST['checkregion'])."') ';
John Taylor-Johnston wrote:
> Will this do it?
>
> > $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> > values ('John', '".implode(',', serialise($_POST['checkregion'])."') ';
>
> http://ca.php.net/manual/en/function.serialize.php
>
>
>> Array
>> (
>> [0] => Hemmingford
>> [1] => Huntingdon
>> )
>>
>>> <input type="checkbox" name="checkregion[]" value="Knowlton" />
>>> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
attached mail follows:
On Sat, 2008-03-15 at 00:18 -0400, John Taylor-Johnston wrote:
> Sorry, will this work?
>
> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> values ('John', '".serialise($_POST['checkregion'])."') ';
Depends on what you want to do with the data. But you've certainly
spelled serialize() wrong as it regards usage in PHP.
Cheers,
Rob.
>
>
> John Taylor-Johnston wrote:
> > Will this do it?
> >
> > > $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> > > values ('John', '".implode(',', serialise($_POST['checkregion'])."') ';
> >
> > http://ca.php.net/manual/en/function.serialize.php
> >
> >
> >> Array
> >> (
> >> [0] => Hemmingford
> >> [1] => Huntingdon
> >> )
> >>
> >>> <input type="checkbox" name="checkregion[]" value="Knowlton" />
> >>> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
>
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Robert,
>>>> Array
>>>> (
>>>> [0] => Hemmingford
>>>> [1] => Huntingdon
>>>> )
> You want the following (otherwise each checked entry overwrites the
> previous):
> <input type="checkbox" name="checkregion[]" value="Knowlton" />
> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
How would you proceed?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '". ?? ."') ';
I'm just guessing.
attached mail follows:
Robert,
>>>> Array
>>>> (
>>>> [0] => Hemmingford
>>>> [1] => Huntingdon
>>>> )
> You want the following (otherwise each checked entry overwrites the
> previous):
> <input type="checkbox" name="checkregion[]" value="Knowlton" />
> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
How would you proceed?
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', '". ?? ."') ';
I'm just guessing.
attached mail follows:
On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
> Robert,
>
> >>>> Array
> >>>> (
> >>>> [0] => Hemmingford
> >>>> [1] => Huntingdon
> >>>> )
> > You want the following (otherwise each checked entry overwrites the
> > previous):
> > <input type="checkbox" name="checkregion[]" value="Knowlton" />
> > <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
>
> How would you proceed?
>
> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> values ('John', '". ?? ."') ';
>
> I'm just guessing.
It depend son what you want to do with the data. It may be that you want
a row for every selected entry or it may be that you can just serialize
the data. Do you want to just have a snapshot of what the user chose? Or
do you want to be able to query the database about who selected
"Knowlton"? If the former, then you can get away with just serializing
the data, but if you want to be able to do queries, then you need to
store each entry in its own row.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Robert Cummings wrote:
> On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
>> Robert,
>>
>>>>>> Array
>>>>>> (
>>>>>> [0] => Hemmingford
>>>>>> [1] => Huntingdon
>>>>>> )
>>> You want the following (otherwise each checked entry overwrites the
>>> previous):
>>> <input type="checkbox" name="checkregion[]" value="Knowlton" />
>>> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
>> How would you proceed?
>>
>> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
>> values ('John', '". ?? ."') ';
>>
>> I'm just guessing.
>
> It depend son what you want to do with the data. It may be that you want
> a row for every selected entry or it may be that you can just serialize
> the data. Do you want to just have a snapshot of what the user chose? Or
> do you want to be able to query the database about who selected
> "Knowlton"? If the former, then you can get away with just serializing
> the data, but if you want to be able to do queries, then you need to
> store each entry in its own row.
>
> Cheers,
> Rob.
It would look like:
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', 'Montreal,Knowlton,anything') ';
checkregion[5] = "Montreal";
checkregion[7] = "Knowlton";
checkregion[55] = "anything";
I need to unarray checkregion[] and break it up into separate words and
then separate them by commas.
Hmm?
attached mail follows:
Robert Cummings wrote:
> On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
>> Robert,
>>
>>>>>> Array
>>>>>> (
>>>>>> [0] => Hemmingford
>>>>>> [1] => Huntingdon
>>>>>> )
>>> You want the following (otherwise each checked entry overwrites the
>>> previous):
>>> <input type="checkbox" name="checkregion[]" value="Knowlton" />
>>> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
>> How would you proceed?
>>
>> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
>> values ('John', '". ?? ."') ';
>>
>> I'm just guessing.
>
> It depend son what you want to do with the data. It may be that you want
> a row for every selected entry or it may be that you can just serialize
> the data. Do you want to just have a snapshot of what the user chose? Or
> do you want to be able to query the database about who selected
> "Knowlton"? If the former, then you can get away with just serializing
> the data, but if you want to be able to do queries, then you need to
> store each entry in its own row.
>
> Cheers,
> Rob.
It would look like:
$sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
values ('John', 'Montreal,Knowlton,anything') ';
checkregion[5] = "Montreal";
checkregion[7] = "Knowlton";
checkregion[55] = "anything";
I need to unarray checkregion[] and break it up into separate words and
then separate them by commas.
Hmm?
attached mail follows:
On Sat, 2008-03-15 at 01:00 -0400, John Taylor-Johnston wrote:
> Robert Cummings wrote:
> > On Sat, 2008-03-15 at 00:33 -0400, John Taylor-Johnston wrote:
> >> Robert,
> >>
> >>>>>> Array
> >>>>>> (
> >>>>>> [0] => Hemmingford
> >>>>>> [1] => Huntingdon
> >>>>>> )
> >>> You want the following (otherwise each checked entry overwrites the
> >>> previous):
> >>> <input type="checkbox" name="checkregion[]" value="Knowlton" />
> >>> <input type="checkbox" name="checkregion[]" value="Thetford Mines" />
> >> How would you proceed?
> >>
> >> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> >> values ('John', '". ?? ."') ';
> >>
> >> I'm just guessing.
> >
> > It depend son what you want to do with the data. It may be that you want
> > a row for every selected entry or it may be that you can just serialize
> > the data. Do you want to just have a snapshot of what the user chose? Or
> > do you want to be able to query the database about who selected
> > "Knowlton"? If the former, then you can get away with just serializing
> > the data, but if you want to be able to do queries, then you need to
> > store each entry in its own row.
> >
> > Cheers,
> > Rob.
>
> It would look like:
>
> $sql ='insert into `database`.`table` (`Nom` ,`checkregion`)
> values ('John', 'Montreal,Knowlton,anything') ';
>
> checkregion[5] = "Montreal";
> checkregion[7] = "Knowlton";
> checkregion[55] = "anything";
>
> I need to unarray checkregion[] and break it up into separate words and
> then separate them by commas.
$regions = implode( ',', $checkregion );
$sql =
"INSERT INTO `database`.`table` "
."( "
." `Nom`, "
." `checkregion` "
.") "
."VALUES "
."( "
." '".mysql_real_escape_string( $nom, $conn )."', "
." '".mysql_real_escape_string( $regions, $conn )."' "
.") ";
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
attached mail follows:
Hi All,
I'm trying to test create a soap clienet in PHP, here's my code:
<?php
$client = new SoapClient("
http://10.132.32.112:8080/axis2/services/TemperatureConverter?wsdl",
array('exceptions' => 0));
try {
$a = 32;
$result = $client->__soapCall("c2FConvertion",array($a));
#c2FConvertion("a");
print_r($result);
} catch (SoapFault $result) {
print_r($result);
}
?>
When I run this to invoke the service, I got this error:
SoapFault Object
(
[message:protected] => Exception occurred while trying to invoke service
method c2fConvertion
[string:private] =>
[code:protected] => 0
[file:protected] => /home/chino/Tests/soapclienet/GetTemp.php
[line:protected] => 5
[trace:private] => Array
(
[0] => Array
(
[file] => /home/chino/Tests/soapclienet/GetTemp.php
[line] => 5
[function] => __soapCall
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => c2FConvertion
[1] => Array
(
[0] => 32
)
)
)
)
[faultstring] => Exception occurred while trying to invoke service
method c2fConvertion
[faultcode] => soapenv:Client
[detail] =>
)
My Web Service basically does temperature convertion and is writting in java
using axis2. my java client can invoke
this service remotely. Here's the WSDL file:
<wsdl:definitions targetNamespace="http://example.ws">
<wsdl:documentation>TemperatureConverter</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://example.ws/xsd">
<xs:element name="c2fConvertion">
<xs:complexType>
<xs:sequence>
<xs:element name="cValue" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
$B!](B
<xs:element name="c2fConvertionResponse">
$B!](B
<xs:complexType>
$B!](B
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
$B!](B
<xs:element name="f2cConvertion">
$B!](B
<xs:complexType>
$B!](B
<xs:sequence>
<xs:element name="fValue" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
$B!](B
<xs:element name="f2cConvertionResponse">
$B!](B
<xs:complexType>
$B!](B
<xs:sequence>
<xs:element name="return" nillable="true" type="xs:double"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
$B!](B
<wsdl:message name="f2cConvertionMessage">
<wsdl:part name="part1" element="ns0:f2cConvertion"/>
</wsdl:message>
$B!](B
<wsdl:message name="f2cConvertionResponse">
<wsdl:part name="part1" element="ns0:f2cConvertionResponse"/>
</wsdl:message>
$B!](B
<wsdl:message name="c2fConvertionMessage">
<wsdl:part name="part1" element="ns0:c2fConvertion"/>
</wsdl:message>
$B!](B
<wsdl:message name="c2fConvertionResponse">
<wsdl:part name="part1" element="ns0:c2fConvertionResponse"/>
</wsdl:message>
$B!](B
<wsdl:portType name="TemperatureConverterPortType">
$B!](B
<wsdl:operation name="f2cConvertion">
<wsdl:input message="axis2:f2cConvertionMessage"
wsaw:Action="urn:f2cConvertion"/>
<wsdl:output message="axis2:f2cConvertionResponse"/>
</wsdl:operation>
$B!](B
<wsdl:operation name="c2fConvertion">
<wsdl:input message="axis2:c2fConvertionMessage"
wsaw:Action="urn:c2fConvertion"/>
<wsdl:output message="axis2:c2fConvertionResponse"/>
</wsdl:operation>
</wsdl:portType>
$B!](B
<wsdl:binding name="TemperatureConverterSOAP11Binding"
type="axis2:TemperatureConverterPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
$B!](B
<wsdl:operation name="f2cConvertion">
<soap:operation soapAction="urn:f2cConvertion" style="document"/>
$B!](B
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
$B!](B
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
$B!](B
<wsdl:operation name="c2fConvertion">
<soap:operation soapAction="urn:c2fConvertion" style="document"/>
$B!](B
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
$B!](B
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
$B!](B
<wsdl:binding name="TemperatureConverterSOAP12Binding"
type="axis2:TemperatureConverterPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
$B!](B
<wsdl:operation name="f2cConvertion">
<soap12:operation soapAction="urn:f2cConvertion" style="document"/>
$B!](B
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
$B!](B
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
$B!](B
<wsdl:operation name="c2fConvertion">
<soap12:operation soapAction="urn:c2fConvertion" style="document"/>
$B!](B
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
$B!](B
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
$B!](B
<wsdl:binding name="TemperatureConverterHttpBinding"
type="axis2:TemperatureConverterPortType">
<http:binding verb="POST"/>
$B!](B
<wsdl:operation name="f2cConvertion">
<http:operation location="f2cConvertion"/>
$B!](B
<wsdl:input>
<mime:content type="text/xml"/>
</wsdl:input>
$B!](B
<wsdl:output>
<mime:content type="text/xml"/>
</wsdl:output>
</wsdl:operation>
$B!](B
<wsdl:operation name="c2fConvertion">
<http:operation location="c2fConvertion"/>
$B!](B
<wsdl:input>
<mime:content type="text/xml"/>
</wsdl:input>
$B!](B
<wsdl:output>
<mime:content type="text/xml"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
$B!](B
<wsdl:service name="TemperatureConverter">
$B!](B
<wsdl:port name="TemperatureConverterSOAP11port_http"
binding="axis2:TemperatureConverterSOAP11Binding">
<soap:address location="
http://10.132.32.112:8080/axis2/services/TemperatureConverter"/>
</wsdl:port>
$B!](B
<wsdl:port name="TemperatureConverterSOAP12port_http"
binding="axis2:TemperatureConverterSOAP12Binding">
<soap12:address location="
http://10.132.32.112:8080/axis2/services/TemperatureConverter"/>
</wsdl:port>
$B!](B
<wsdl:port name="TemperatureConverterHttpport"
binding="axis2:TemperatureConverterHttpBinding">
<http:address location="
http://10.132.32.112:8080/axis2/services/TemperatureConverter"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Hoping for any advise. :)
Thanks in advance.
Chino
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]