--- Graham Cossey [EMAIL PROTECTED] wrote:
Is this something like what you are after:
?php
$sql = SELECT col1, col2, col3, col4 as colx, col5
FROM my_table
WHERE col2 LIKE '%$search%'
ORDER BY col3
LIMIT $from, $max_results;
$result =
--- Sebastian Mendel [EMAIL PROTECTED] wrote:
$where = array();
if ( isset($_POST['Ind']) ) {
$where[] = 'vendorjobs.Industry = ' . (int)
$_POST['Ind'];
}
if ( isset($_POST['Days']) ) {
$where[] = 'Date_Sub(Curdate(), interval ' .
(int) $_POST['Days'] .
' day) =
--- Graham Cossey [EMAIL PROTECTED] wrote:
This should result in:
WHERE vendorjobs.Industry IN (2,3,5)
OR
WHERE vendorjobs.Industry = 2
HTH
Graham
Not sure what you mean by the above ?
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Ok, hopefully I can explain this clearly, even though
I think I might be an idiot since Ive been going on
about this for a few days.
I have a table that holds values and labels
i.e. 1 = New York
2 = Boston
3 = Kansas City
4 = Amsterdam
I want to put this table into a multiple
--- M. Sokolewicz [EMAIL PROTECTED] wrote:
I would suggest writing it like this:
[snip]
I'm getting the page now with the box but no values
inside. Database conn is fine and all. I can print
out the value , just can't get them to show up inside
form element (Multiple select)
--- Jason Wong [EMAIL PROTECTED] wrote:
$row is what contains the data you're grabbing from
the DB and you're not
using it
Jason Wong - Gremlins Associates -
Thank you Jason, its working now !
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
I think I'm almost there :)
Only right now I'm getting an error message:
Query failed: 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 '' at line 3
?php
$where = array();
$Ind = ;
$Ind = $_POST['Ind'];
if
Sorry, I fixed Ind , since the element is named Ind[].
Now I get a different error:
Query failed: 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
'','','Array)' at line 3
?php
$where = array();
$Ind[] = ;
--- Jason Wong [EMAIL PROTECTED] wrote:
Uhmm, you could try some debugging of your own
instead of relying on the list.
Liberally douse your code with print_r() and
var_dump() of all your important
variables. Do they contain what you expected? If not
try and figure out why
not.
--
--- Jason Wong [EMAIL PROTECTED] wrote:
Yes, that was apparent from your previous post. So
did you print out your
query and examine it for any obvious mistakes? And
if you couldn't spot any
obvious mistakes then the least you could have done
was to copy and paste the
full query in your
--- Jason Wong [EMAIL PROTECTED] wrote:
See the Array (also missing a single-quote),
that's element [30] mentioned
above.
Summary: the missing single-quotes are the
show-stopper.
I see that , but I'm not sure how that is happening.
Here is the sql:
$sql = 'SELECT PostStart,
--- James Kaufman [EMAIL PROTECTED]
wrote:
Right here, print the contents of $sql. That is the
most important thing to
know right now.
SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobs WHERE VendorJobs.Industry
I've changed my logic around but still running into a
sql query error.
I've tried a number of things with no success. Here
is the error that returns on POST:
SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobs WHERE (VendorJobs.Industry =
''1','2','3''Query failed: You
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
Okay, so what did I learn.
1) That a comma delimited list (from the array) to be
used correctly in the sql statement had to use the IN
word.
$sql .= WHERE VendorJobs.Industry IN ($s_Ind);
2) I need a space between the first quotation
--- Graham Cossey [EMAIL PROTECTED] wrote:
Hi Stuart
Not sure what's happening with the $Ind variable,
maybe check the $_POST
array as you enter the script to ensure that the
form is passing the data
correctly. It is almost as if you are appending it
to itself at some point.
You don't
After googling for quite some time I'm back asking
here. I want to be able to seperate by search and
results into two pages.
My form is set up on Search.php
I have set actionsearchresults.php
Couple of questions:
I have my array of user selected options from my form
element - Ind[]
I gather
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- Jason Wong [EMAIL PROTECTED] wrote:
Sadly, you're really not learning much from this
list ...
I partially disagree. I think it might be better for
me to take a more elementary approach to the language
before getting moving on to specific project issues.
... print_r()/var_dump()
--- Jason Wong [EMAIL PROTECTED] wrote:
you need to build a string which looks like:
Stat[1]=value1State[2]=value2...Stat[n]=valuen
which you append to your URL like so:
searchresults.php?Stat[1]=value1Stat[2]=value2...Stat[n]=valuen
This can be done using a foreach() on
For those who recognize this topic from me and perhaps
are sick of it , my apologies :)
This is actually a different question more about logic
then syntax or functionality.
One of the uses of my search form is that users may
save their search parameters. Typical benefits, they
don't have to
Please see inline:
--- Graham Cossey [EMAIL PROTECTED] wrote:
A couple of possibilities are:
Store search criteria (form entries) in MySQL
Store query string in MySQL
So with my current form, the where statement is built
from conditions that are set (or not set) in the form.
Perhaps I grab
See inline:
--- Chris W. Parker [EMAIL PROTECTED] wrote:
Stuart Felenstein mailto:[EMAIL PROTECTED]
on Monday, November 15, 2004 1:10 AM said:
The way I was approaching this was to grab the
url,
the part after the ? , so not the referer.
This sounds like you're not familiar
See inline please:
--- David Bevan [EMAIL PROTECTED] wrote:
Did you take the time to think about what you were
going to do before starting
your application?
Honestly , no I did not. What I did start out with is
a belief that there wouldn't be a need to know php. I
was using a RAD, that
--- Gryffyn, Trevor [EMAIL PROTECTED]
wrote:
This is a PHP General mailing list, it should be for
general, newbie,
etc sort of questions. But the expectation is that
the questions being
asked were researched some ahead of time as well.
Although that's not
always an option and that
I hope this is a reasonable question:
This is the query string my search page is kicking out
to the results page. It works fine but curious about
these codes or characters. And I know this maybe
unrelated to PHP, so I'll apologize in advance:
Why is each value preceeded by the %5B%5D ? I think
--- Richard Davey [EMAIL PROTECTED] wrote:
Use urldecode() to get them back to normal again.
Changed the form action line to this:
action=searchresults.php?Ind=?php echo
urldecode(((isset($_POST[Ind[]]))?$_POST[Ind[]]:))
Still getting this:
?Ind%5B%5D=1Ind%5B%5D=2Ind%5B%5D=3
I'm under
--- Ford, Mike [EMAIL PROTECTED] wrote:
The main problem with the above snippet that I can
see is that there's very
unlikely to be such a thing as $_POST[Ind[]] --
form fields with
name=Ind[] will turn up as an array in
$_POST[Ind] ($_POST[Ind][0],
$_POST[Ind][1], etc.). But the whole
--- Jason Wong [EMAIL PROTECTED] wrote:
When you're building a query string then (in
general) there is no need for
urldecode(). On the contrary you want to use
urlencode(), this is done on the
*value* of the individual parameters.
And about this: $_POST[Ind[]], it's obvious you
--- Chris W. Parker [EMAIL PROTECTED] wrote:
Did you purposefully ignore my previous email???
Someone else I think
mentioned this in another email in this thread also.
Why are you
assigning anything to $HTTP_GET_VARS at all? It's
meant to retrieve
data.
// (again) this is how you use
--- Ford, Mike [EMAIL PROTECTED] wrote:
//Textfields / Dropdown
$HTTP_GET_VARS['JTitle'];
$HTTP_GET_VARS['City'];
$HTTP_GET_VARS['Days'];
And thrice ditto.
They looked good, gone now :)
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
I have set up a record grid, where the user may see a
list of their records. Repeat region, etc.
There is a button next to each record the user may
click to allow them to update the particular record.
This all worked fine with $_GET where I did a link on
the button to send the PrimaryID over.
--- Jason Wong [EMAIL PROTECTED] wrote:
Since the grid only is echos of the recordset
fields,
how does it know the correct PrimaryID to send
when I
hit the submit button. I'm thinking this is
perhaps my
problem.
Hidden fields, or give the submit button a name
that's based on the
--- Jay Blanchard
[EMAIL PROTECTED] wrote:
Without a lick of code or a pointer to the grid on
the web we would be
hard pressed to offer solutions or advice. Arrays
maybe? Hidden form
fields?
Jay, fine - I thought I could spare you the code but
address what the problem might be.
In the
--- Daniel Schierbeck [EMAIL PROTECTED] wrote:
I'd go with a POST form and a JavaScript
form name=grid method=post
input type=hidden name=primary_id /
input type=button
onclick=document.grid['hidden'].value='123'
value=foobar /
/form
Yes , that is exactly what I'm doing
--- David Bevan [EMAIL PROTECTED] wrote:
Would it be possible to see the code that generates
the grid?
Both the php and HTML.
--
I'm preferring not to post the code solely becasue I
don't want to expose all my database fields here. Of
course this may cost me the help I need.
I'm doing
--- Graham Cossey [EMAIL PROTECTED] wrote:
Hi Stuart
Have you looked at the HTML generated by your PHP
code?
Using view source you'll see what values each of
your 3 forms contains and
therefore what will be submitted in the POST. My
guess from one of your
previous posts is that all 3
I'm getting a:
Parse error: parse error, unexpected '%' in
/home/mysite/public_html/userpage.php on line 120
th scope=row?php echo
$rsVJ-Fields('DATE_FORMAT(LstUpdate,'%m/%d/%Y')');
?/th
th scope=row?php echo
$rsVJ-Fields('DATE_FORMAT(InitOn,'%m/%d/%Y')');
?/th
th
I thought this one was under my control. Apparently
not.
I'm getting a Warning: Invalid argument supplied for
foreach() in /home/mysite/public_html/mypage.php on
line 143
First, I have 3 form elements
school[]
school[]
school[]
Here is how I initialize the session variable (after
user it's
--- Marek Kilimajer [EMAIL PROTECTED] wrote:
print_r($_SESSION['schools']); here
Then finally on the transaction page, some pages
down
the road:
and also print_r($_SESSION['schools']); here
foreach($_SESSION['schools'] as $school)
{
What have you find out?
They
--- Graham Cossey [EMAIL PROTECTED] wrote:
You have got session_start(); at the top of each
script haven't you?
Absolutely, And the other variables are all working.
Is the SID being passed down the chain of scripts?
Is this done by cookie or url?
cookie -or session.
Stuart
--
PHP
--- Graham Cossey [EMAIL PROTECTED] wrote:
How embarassing. I had a typo
elements were School
variables were school
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I'm building a search form where users can search for
people by zip code. Trying to get an opinion here.
Well maybe more then just one.
Should I have seperate textfields, say (arbitrary) 3 ,
where they can put in 1 zip code per field. Or do I
do it with one text field , using delimited
I have arrays set up in a user form. One type is from
a multi-select list. (I'm passing these through a
multi page form as session variables)
The multi select list array code is like this:
To $_POST (going on to next page)I have this:
$_SESSION['industry'] = $_POST['L_Industry'];
Then in the
--- Mike Smith [EMAIL PROTECTED] wrote:
How about:
if ( is_array($_SESSION['schools'] ) ) {
foreach($_SESSION['schools'] as $h) {
If($h!=){ //First added line
$query = INSERT INTO Prof_Schools (ProfID, School)
VALUES ('$LID', '$h');
$res6 = run_query($query);
echo $query;
} //End
I haven't try this yet but wondering if it's possible.
Can I do something like this:
select fieldone from table ;
$myvar = $fieldone ?
And more so could I do it with a where clause ?
i.e. select fieldone from table where fieldone = 3
$myvar = $fieldone ?
This is probably a stupid question.
In my search page, the url returned comes back with
the ..err I forget what it's called, but query string
looks like this: %5B%5D=3. I think the %5B and 5D
should be [].
What I think is needed is rawurldecode. I've looked
through my code and think it belongs somewhere in this
block:
--- Ford, Mike [EMAIL PROTECTED] wrote:
Are you seeing the URL-encoded version *only* in
your browser's
Address/Location bar? If so, that's perfectly
normal and nothing to worry
about -- it should be automatically decoded by the
Web server before being
passed to PHP.
If you're seeing
--- Ford, Mike [EMAIL PROTECTED] wrote:
Lastly, I wasn't concerned about the hex code, but
I just made some reconnections of scripts. Users
can save their search parameters. I am saving the
query string. Now I had this set up before and the
way it was working , is when the user wanted
--- Jason Wong [EMAIL PROTECTED] wrote:
Basically I'm throwing this out though since I'm
wondering if there is something that should be in
the
search script , that when I apply a query string
to it
would fill in the field (like magic hands)
Yeah I wish I had some magic hands that
--- Richard Lynch [EMAIL PROTECTED] wrote:
Then your new script is broken, as clearly the GET
paramters *ARE* there.
Sorry, I'm not following you. Where are my GET
parameters ? The way I've built my present script is
the reults page is grabbing the parameters. Do I need
to set up GET
--- Richard Lynch [EMAIL PROTECTED] wrote:
Then your new script is broken, as clearly the GET
paramters *ARE* there.
Sorry, I'm not following you. Where are my GET
parameters ? The way I've built my present script
is
the reults page is grabbing the parameters. Do I
need
to set
--- Ford, Mike [EMAIL PROTECTED] wrote:
Please, stop giving us vague, generalized
descriptions of your application,
and how it is or isn't working right, and vague,
generalized descriptions
of the data it's supposed to be working with.
I don't believe that the description of my issue was
--- Ford, Mike [EMAIL PROTECTED] wrote:
echo nl2br(htmlspecialchars($text)) is my usual
mantra for this.
nl2br will give you back the correct formatting, but
will leave br/'s in the output.
I just went through this issue the other day, what I
found worked for me was:
--- Jason Wong [EMAIL PROTECTED] wrote:
Now in an earlier response I asked you to track your
variables and see at
which point they cease to contain what you expect
them to contain. Did you do
that? If you're not doing *your* part to help solve
*your* problem then what
are you expecting
--- Ford, Mike [EMAIL PROTECTED] wrote:
AARRGGHHH! Vague, generalized, woolly!!
SHOW US the relevant bits of code. SHOW US what you
get printed out,
especially anything that isn't what you expect, and
tell us exactly what you
did expect.
SPECIFICS, man, SPECIFICS!!
SHOW US the
--- Jason Wong [EMAIL PROTECTED] wrote:
Nothing is printing out on $_POST['var'] or $var
s makes sense.
Now why are you looking in $_POST for your form
values? They're in $_GET. You
said earlier that you understood POST and GET?
I made the correction , using $_GET now. Values are
--- Richard Lynch [EMAIL PROTECTED] wrote:
I made the correction , using $_GET now. Values
are
printing out, aside from the select lists (arrays)
which print out as array.
Yes.
An array will print as Array
You'll need to dig into the Array for what you need,
or implode it, or
I'm hoping that this question will be more succinct.
I am trying to repopulate a search form with a user's
chosen paramters. I am running into a problem with
multiple select lists
First , this is the element when the form is first
presented to the user:
select name=Ind[] size=8
--- [EMAIL PROTECTED] wrote:
you (just) need to mark the previously chosen items
as selected in
the repopulated list. the highlighting part is a
basic html/form
issue. i.e., if you have questions on this you
should look at how, on
a simple (html-only) form, an item on a list is
marked
--- Jason Wong [EMAIL PROTECTED] wrote:
Close but no cigar. Since $Ind is already
imploded my
thinking is it need not be incremented in the echo
statement ?
You tell me, print_r() and var_dump() it before you
use it and decide whether
it is correct.
One final thing: '$Ind' is
--- Jason Wong [EMAIL PROTECTED] wrote:
I'm pretty sure I need to loop through the $_Get
of
the array. Not sure , and haven't found anything
that shows this.
Yes, you need to reference $_GET to see whether an
option was selected and
change the echo above accordingly.
Still
--- Jason Wong [EMAIL PROTECTED] wrote:
On Sunday 12 December 2004 18:15, Stuart Felenstein
wrote:
Still stuck on this one. I know I'm doing
something
wrong and wouldn't mind some correction:
Did you mockup some test HTML in a wysisyg editor as
suggested?
Yep like this :
select
--- Jason Wong [EMAIL PROTECTED] wrote:
I think will call it a day for this thread.
As I suspected a loop was needed to make this work.
In the event that there are other idiots, such as
myself, that don't immediately figure out the exact
logic I'll post the code:
//The sql is Adodb syntax:
--- Ford, Mike [EMAIL PROTECTED] wrote:
If in doubt, print it out (TM)
echo '$Indbr', $Indbr, $Ind;
$Ind
'1','2','3','4'
'1','2','3','4'
Funny, they are both the same.
Both? There are three things printed out there,
so both cannot be
right. 2 of the 3 can be the
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
I am ending this thread.
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- Jason Wong [EMAIL PROTECTED] wrote:
If in doubt, print it out (TM)
echo '$Indbr', $Indbr, $Ind;
$Ind
'1','2','3','4'
'1','2','3','4'
Funny, they are both the same.
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- David Robley [EMAIL PROTECTED] wrote:
On Mon, 13 Dec 2004 00:56, Stuart Felenstein wrote:
--- Jason Wong [EMAIL PROTECTED] wrote:
If in doubt, print it out (TM)
echo '$Indbr', $Indbr, $Ind;
$Ind
'1','2','3','4'
'1','2','3','4'
Funny, they are both
--- Jason Wong [EMAIL PROTECTED] wrote:
Here is just another variation of my multiple
select
list.
option value=?php echo
$rsinds-Fields('CareerIDs')??php if
($rsinds-Fields('CareerIDs')== 5) {echo
SELECTED;}
??php echo
$rsinds-Fields('CareerCategories')?/option
Here I was
Generally, when I set up a form where, for example,
I'll be taking multiple selections from a list I would
set the variable / element name as myvar[]. So I
have the brackets [] after the variable name to make
it an array.
What I want to know is there a way to get around the
use of this syntax
When using $_POST vars is it required that a form is
used ?
In other words I can create an href link and echo
variable and pick them up using $_GET in the following
page.
No so with $_POST ?
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
--- Ford, Mike [EMAIL PROTECTED] wrote:
To view the terms under which this email is
distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
-Original Message-
From: Stuart Felenstein
Sent: 14/01/05 13:48
When using $_POST vars is it required that a form
what I can't find out after digging through books
and googling, is how / where to actually declare the
variable.
Seems most of the examples use a variable that is set
already by the programmer, not by the user.
Stuart
--- Stuart Felenstein [EMAIL PROTECTED] wrote:
I cant figure out if I'm doing
101 - 172 of 172 matches
Mail list logo