Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Can I Pass Multiple Values In A Query String


I need to pass  a couple of values in a query string. Is this possible. I have the following code but get a parse error. Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Query String With Multiple Values In One Table
I'm having trouble with the syntax on a query string, and haven't been able to find any posts or tutorials that seem to address this specific type of query. I have a table named "items" with a field for "name"

In the "name" field, I have several different entries (actual data), including John, Mark, Sue, Brian, Lucy, etc. In the specific page I'm building, I want to query the database and return the data for more than one person, but not everyone. It seems the query string should be:

$query="SELECT * FROM items WHERE name='Brian' AND name='Sue' ORDER BY name ASC";
However I get errors. If I remove the "AND name='Sue'" it returns data for Brian just fine, and if I remove "name='Brian' AND" it returns data for Sue, but I can't get it to return the data for both of them.

Getting Query Values Into Text Box, Then Pass Them To Another Page
how do i get the values from a query from a db into text box's, in a form, so i can hit submit and it goes to an "update" page? Code:

PREG Search For Multiple Values In One Pass?
I am trying to do a search through some data, more specifically HTML,
to extract data from it. So for example I may have:

<b>Title:</b<em>This is a title</em>
<b>Name:</b<em>Fred</em>

I wish to grab the data "This is a title" and "Fred" against their
corresponding headings in an array (e.g. $array[title] = "This is a
title") .... but the key doesn't matter, that need not come from the
regexp but I can do manually.

The question is - how do I do this in one pass? Do I just use use
nested OR's in my regexp? The problem with this though, is once a match
is made, how does PHP then tell me what it corresponds to if it's an
OR? (it just returns the match surely?)

Actually i'm not even too sure how to go about doing this... do I need
backreferencing etc...? I've read the php.net pages but couldn't
entirely make sense of the various preg functions.

Multiple Checkbox Query Using Text As Values Not Numbers
I've been looking to create a query based on multiple checkbox results (select results from multiple cities) and the only examples I've found so far use numbers as the values like the one below; Code:

Manipulate Array Keys And Values For Query String
i'm creating a function where I can update my records ... but it doesnt work...I echoed my SQL query and it turned fine..but it didnt update my record! PHP Code:

Reloading The Page With Updated Query String Values
I'm trying to build a small portfolio and instead of using several HTML pages I wanted to just use PHP. What I have is an array of each image's path (for the "src" attribute). I was thinking when I click "Next" (a text link) it increments the array and once it has reloaded itself it would simply look at the query string then display the new image. I have some questions though:

1. What line do I use which will reload the page with the new incremented variables?

2. When the page reloads itself, will it automatically get the new image to load? I already placed $thisimage = $_GET['imagenumber'] at the very top so it updates the "src" attribute for the image.

Trying To Pass 2 Values
I am trying to pass 2 values in the URL, but for some reason they keep combinine to each other... I wanted to send over the groupid and the zipid, but it keeps sticking them together. Code:

Pass Php Values To Frames
i want to pass a value after a sucessfull loggin to an other frame which opens after retrieving the value some mo functions. but i ain't get it to work.

Pass Values Of Arrays To A New Page
How do i pass all the values onto another page that I have gathered. If I have a form and place info into the array, how do I pass the value in that array over to a new page.

How To Pass Hidden Values By HTTP Headers?
I have a script passing value to a next php page, but the value
appears in the headder, making it visible. How do I hide the value?

header("Location:http://$HTTP_HOST/$DOCROOT/registration_success.php?userid=$userid");

[php] Using Session To Pass Values From A Popup Window...
i got a problem here. its like this... i have a popup php page... in it details of what is stored in my database is retrieve and displayed out.... but i want to pass the values that is displayed out in the popup window to the main window by using session .....
how can i do that?

Hide GET Variables --> Pass Values Using Session
I have a php file which lists some records. On this list, the records
can be sorted on different columns. currently the sort column and the
direction of sorting is passed using GET values, this means the user
clicks the column name (which is a link) so the new sort column and
direction is passed to the script

<a href="main.php?page=news&sortfield=title&sortorder=asc">

now my question is, if it's possible to hide those values, so they
don't appear on the url, but sorting should work anyway. This means
that

1. when user clicks on column, the new sort order has to be set
2. page has to be reloaded, so new sort order gets displayed.

I'd like to do this using sessions, but I don't know how to update a
session value, when clicking on a link wihtout using GET values...

Selecting Multiple Values From Multiple Tables Using Checkboxes
I've been struggling with this for a bit but cannot seem to find a simpler, cleaner way of doing this.

a. I have a Table A - Customers , Table B - Contacts .
b. I have a form where a user types the first few alphabets of a customer name and then gets a list of contacts, cities.
c. The user is supposed to select multiple options from this list and then send that data to another form for processing.

I'm able to only pass data from Table A, not from B . Could someone please have a look at the 2 snippets of code and advise? And is there a way both these php scripts could be combined in a single one ? Code:

Pass Query On Each Cell?
I sent query to database and take some datas. and I have table. So, how can I pass query result on each cell, that respond that cell. if anyone give me sample coding, would be very pleased.

Pass Array Into Select Query ?
I was wondering if it is possible to pass a php array into a mysql query rather than looping through each one eg:

//the array
$namesArray = array("Joe", "Jane", "Bob", "Mary", "Paul", "Eddie", "John");
//the sql
SELECT id FROM users WHERE name='$namesArray'

How To Pass An Xml String As A Get Parameter
I want to send an xml string as a get parameter,
where the xml is created from a runtime
database query. I try to avoid dynamic framesets,
but sometimes they're needed:

$xml = mysql_stuff($x,$y,$z);
echo "<frameset...>";
echo "<frame src=".$PHP_SELF."?xml=".$xml.">";
snip....

That didn't work, so I tried urlencoding various pieces:
$xmlstr = urlencode($xml);
echo "<frameset .....>";
echo "<frame src=".$PHP_SELF."%3Fxml=".$xmlstr.">"

.....then, at the other end of the recursive pipe:
$encodedXML = $_GET['xml'];
$xml = urldecode($encodedXML);

But that causes trouble too.
I suppose I could serialize the xml and save it
as a session variable. There must be a way to pass
XML as a parameter, from one php process to another.

Pass Multiple Parameters On Seperate Lines?
I need to pass several parameters using an include statement. Pressing enter at the end of each to pu it on a seperate line does not work as the parameters do not get passed. Is there a way to pass several parameters using several lines, to avoid horizontal scrolling?

Pass A String Variable Available To Other Pages ?
how do i keep a string variable available, one that is taken from index.php?ref=232

and pass it to page2.php and page3.php

so that when they reach page3.php, i can call out this value ? i dont want to use cookies for this as cookies may be disabled /turned off from the browsers. anyone can show me how to do this ?

Pass An Array To A Quyery String
Assuming i had an array ($myarray) which holds maybe (1,2,3) how do i pass it in the query string so i get select hd from mytable where hd in (1,2,3).

Get Multiple Values
I have an e-cart application and need to email a reciept of purchases. My email will only send/display the last set of purchases. ie if two items are purchased only the detail of item 2 is sent in the email.

The code use a function to retrieve the product info and then I use extract to create variables to be referenced in the email. Code:

Getting Values From A Textarea To Use In A Sql Query
im trying to retrieve the text entered within a text area, split it into indiviual lines and use each line within a sql statement I can retrieve the values but only the 1st value is inserted within the sql statement Code:

Multiple Values In One Cookie
Is there a convenient way to set more than 1 value into a single cookie? I don't want to sent many cookies when one would do. I suppose I could comma-seperate values, and do an explode() to get each value, but it seems like there would be a better way .

Multiple Values In And Out Of Cookie...
I'm creating a shopping cart system, plain old nothing mega fancy. When the user browses the catalogue, finds something s/he wants, s/he clicks add to cart, and the ItemID gets passed to the cookie, continues to browse, more ItemID's get appened. so essentially im left with a string of "9 7 3 1" (4 items)

From there I'm stuck. What I want to be able to do is to bring up a php page that will read each of them off in turn, query the database, and pull up description, price. A proper cart, but I have no clue how to go about it.

I'll shove the code pertaining to the cookies below, maybe it will prove useful, but I have the feeling I will need to approach it from a slightly different angle. PHP Code:

Splitting Multiple Values
Situation: One Item can have multiple sizes & prices. Currently, In mySQL, I've place one TextBox for multiple sizes & prices. i.e.

ContainerSize_Price
--------------------------
#15 45.00
#25 75.00
#45 175.00

Now in PHP, I'm splitting data on "#" but I failed to produce effective result. How could I show data in HTML in following order using PHP?

Container Size Price
------------------ --------
#15 45.00
#25 75.00
#45 175.00

Removing Multiple Values
I'm still pretty new at PHP so I'm sorry if this is a simple question. On the homepage of my site I am trying to display the titles of my most recent wordpress blogs. However, I don't want it to show more than one result with the same value. I just want it to show the first result with that value. Code:

Query From Db, Add Values In Dropdown Menu
i wanted to query my db, and then add values to drop down menu, where when they select what they want in the dropdown, it will bring them to another page accounts.php where they will have more options.

Multiple Values Return From One Fuction
Let say i calculated var1,var2 in a function and i wan to return both of these?

Multiple Values In A Form - Array
So the problem is:

I have a form wich passes some values to a new page, the problem is the filed name is ever the same but the values changes. But the value passed is always the last one. PHP Code:

Creating CSR With Multiple Values For Attributes
I'm trying to get PHP to generate a CSR in which I need the
organizationalUnitName attribute/field to have multiple values.

In the openssl.cnf file when generating the CSR with the "openssl req"
command line, all I need is to include stanza such as:
0.organizationalUnitName = Level 0 OU
1.organizationalUnitName = Level 1 OU
....
n.organizationalUnitName = Level N OU

I hoped that for PHP, I just needed to build an array looking like
dn_array = array(
"0.organizationalUnitName" ="Level 0 OU"
"1.organizationalUnitName" ="Level 1 OU"
....
);

But what I get in the PHP errorlog at the openssl_csr_new($dn_array,
....) call is a:
"dn: 0.organizationalUnitName is not a recognized name" message and so
on for every multi-valued attribute...

Any one ever succedeed in getting openssl_csr_new to do that stuff ?

Retrieving The Multiple Values Set By A Form
I am passing a form to a php script for further processing.

I am able to retrieve the last value set for that given form variable
using
$variable=$_REQUEST['form_variable'];

My question is, what is the Php way of retrieving all the values passed
for the same form variable?

For example, if the php script is called with a syntax like

http://xxxx/get_variables.php?form_...riable=variable

, how do I iterate through all the values that form_variable has been
set to?

Passing Multiple Table Values
I have a products table that I have created from a query, but I need to update the information based on quatity. What I am confused about is how to pass the multiple values to another page when they have the same variable names. Code:

Defining Multiple Values In An IF Statement.
I am writing a file upload script, but only want the file types to be jpg, gif or png. I want the script to basically say "If this file type is not a jpg, gif or png, then echo a rejection" Code:

Validation Using Multiple Values In Value Form Tag
I'm creating a form that will create fixtures for a school games system with php and mysql. I have 3 drop down menus on a form Pupil1, Pupil2 and Game. The form displays data from the mysql database such as Name, House and class in a drop down menu which links to a process form.

This is a extract from the drop down menu, (row0 is the students id number, row2 is the students house)

echo"<option style='background: yellow' value='$row[0] $row[4]'>Name: $row[1] $row[2] | Class: $row[3] | House: $row[4]</option>";

On the process form I would like to validate that people from the green house can only play people from the yellow house which is the $row[4] in the value section but I don't know how to separate the id which is row0 and the house (row4) in the value tag. I can't find any contains tag such as if 'select1' contatains 'yellow'{do this},

Adding Values In One Column From Query Results
I have this query:

SELECT *,
sum(field_value) as totalValue
FROM table_name
WHERE field_id = $id
GROUP BY field_group

the data type of field value is a decimal value, with values such as 125.00 and 150.50 stored in each record. My goal is to have totalValue be the total value of those numbers. So if I have two records that equal 125.00 and 150.50 totalValue would = 175.50.

the above query does not do this. What do I need to change here? Should I try to do this from the PHP side?

Updating Multiple Form Values To MySQL
i am building a content management system for my employer's Web site, which is a daily newspaper. haven't had too much trouble learning PHP up to this point, but I have a problem now that I am finding difficult to figure out. any help would be much appreciated.

I have two MySQL tables for a Poll on our site, one named PollQuestions and one named PollAnswers. I am trying to build an administration form that will allow the user to pull up both the question and answers for any given poll and edit them if they need to. I haven't had a problem with the Poll Question, but with the Poll Answers, I am unsure how I can pull each Poll Answer into a text field and update all of them in one query based on an ID field for the answers.

In other words, I have each answer pulling into the form from the database and for each answer, i have a hidden field that stores that particular answer's ID number.

So how do I update all of the answers in one query based on that particular answer's ID number? I have written the following code, but it does not work. Any help would be much appreciated.

For the form itself, here is the code for the Answer text fields:

How PHP $_POST Gets The Multiple Values From A HTML Form?
I am try test a simple HTML form with PHP

<form method=POST action="testing.php">
Cat <input type="checkbox" name="pet" value="cat">
Dog <input type="checkbox" name="pet" value="dog">
Pig <input type="checkbox" name="pet" value="pig">
<br>
<select name="dates" multiple>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
<option value="Sunday">Sunday</option>
</select><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>

When I checked cat, pig and selected Tuesday and Saturday from the form
and click submitt

My testing.php is

<?php
$pet = $_POST['pet'];
$dates = $_POST['dates'];
print_r($pet);
var_dump($dates);
?>

The $_POST['pet'] and $_POST['dates']
are NOT return as array nor multiple
strings seperated with a comma.
It only return the LAST string I have
checked and/or selected.

How do I get the multiple values from the
checkbox and the multiple select from a
HTML form in PHP?

Posting Form List Multiple Values ?
how to get the values using post from a multiple list form when more than one value is selected ?.. is it possible ?

Checking A String For All Values Of An Array
If I have an array named $KeywordsArray, and I need to see if all of the values in the array are in a string named $TheString, what is the most efficient way to do this?

Inserting Then Extracting Multiple Values In Single Db Field.
I need to submit multiple values into a single table field that have been retrieved from a form eg: limit1 ... limit10. At the moment they are seperated by commas in the field (limit1,limit2 etc) thinking I extract these with explode() then assign them as individual variables ($limit1 etc.) so they can be edited by the same form.

Making Array Values INT Vs. String. Using JpGraph.
I have been having some fun with JpGraph, but am having difficulty keeping the data I work with an INT, which is something JpGraph requires. So many functions to manipulate array data convert to string that I am finding it difficult to import the data correctly.
Code:

Multiple Tables Query
I have a roster script that handles multiple tables ($orderof) and within those tables multiple divisions ($sword). The only problem is that, nothing is getting displayed -- though there are no errors (systematic [to my knowledge] or parse). PHP Code:

Query With Multiple OR Statements
trying to match the HTTP VARS application_id to the table products.products_application1
The code below works, but I need it to also check products_application2, products_application3, products_application4, products_application5, products_application6 for the same HTTP VARS value. PHP Code:

Can I Get PHP To Query From Multiple Tables?
I will have several tables in my database, several of which will contain similar products. Is there a way to set up my pages where PHP will get the items I request from EACH table?

Multiple Statements In Query
Is it possible to query multiple statements at once?
Like:
$query = "set @p := 1; select @p + 1";
$results = mysql_query($query);

I'm thinking of PHP4. There is in mysqli the prepare statement,
but I can't use that.

Multiple Sql Query Results
I'm trying to do a query from 2 databases. Basically i have
catagories within 2 databases. If both catagories return 0 rows then it
does nothing but if one or both have rows returned then i need it to
echo a result. I guess where i'm wondering if there's an OR statement i
can use or something to that effect...

something like

if($numrows == 0 OR $numrows2 == 0) {
echo ('');
}else{
echo ('$result');



Get Value Of Query String
I am trying to get the value of a query string. The query string variable name is stored in a array value(because I need to read one particular query string) PHP Code:

String Query
I'm trying to get this query in PHP: select answer,correct from quiz_answer WHERE (qsid=28 OR qsid=29 OR qsid=30) and correct='yes'

But the thing is that when I select a wrong answer then it displays qsid=66 OR, so this depends on how many questions wrong..PHP code:

Query String ?
i have a form that accepts user info. i have to add that info to my database and redirect the user to another site and fill the form on that site with the info the user just entered in my form. i am using the query string. the other website that i am transferring to is using jsp. Code:

Query String
How do you put the value of a form field into the query string. I have a
select field named title on a submission form. I'd like the selected value
to be put on the Form line

echo "<form name='form1' method='post'
action='admin/edit.php?selectfield=what goes here? '>";

function load()
{
require_once("../login.php");
login();

mysql_select_db("db");
$options = "select id from table order by id";
$optres = mysql_query($options);

$opt_results = mysql_num_rows($optres);
echo "<select name=title>";

for ($i=0; $i <$opt_results; $i++)
{
$optrow = mysql_fetch_array($optres);
$optionval = stripslashes($optrow["song"]);
echo "<option>$optionval</option>";
echo "<br>";
}
echo "</select>";
echo "</p>";

echo "<form name='form1' method='post'
action='admin/edit_tab.php?tab='>";

echo "<input type="submit" name="edittab" value="edit tab">";
echo "</form>";


Copyright © 2005-08 www.BigResource.com, All rights reserved