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




Cannot Pass @ For A SELECT... WHERE


From a cycling database, to put to screen the Clubs whose Secretary has email, this works just fine in phpMyAdmin -

select email from clubs where email like "%@%" order by club

I want to do it in php but from the manual and these DevShed files, it seems the @ character stops all further progress along the line it's on????

I've tried all kinds'v variations of the following, brackets on and off, double and single quotes, till I'm blue in the face.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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'

Select Col Value Used As Link,pass Value To New Form
I am displaying a list of values from a mysql backend, making one of the returned columns a link. I want the user to click the link(returned value) and then I want php to use this value illustrated by the link to return another resultset from mysql. Code opens the new page fine, but is not capturing or passing the value to the new page. I have been googling, reading and trying new bits of code for days, but still nothing works. Any help would be much appreciated!

Here is code: ....

Using MD5($pass) With PHP And MD5 Tables Or Password('$pass') In SQL
My intranet log in page (which starts the session)
has a password field, and later once the form is submitted
(after all the checking) the $pass var goes through this:

$pass = MD5($pass);

And my password column has MD5 encrypted passwords.

I could just use password('$pass') in my SQL query and remove the MD5() from my PHP if I convert my column to "Password" instead of "MD5".

So which one is safer? I think MD5 is safer and is sort of a standard so my database has a little more portability if ever needed.

I have another question. My Form once submitted obviously has the non encrypted password until the variable is processed. The only way to protect this is to put the intranet on a SSL connection right?

Which Is Better, Pass, Or Not Pass By Reference?
I've asked this before but never got any response but its important and I
thought I'd pitch it again (hopefully a bit clearer)...

One can pass data from one function to another either by passing a copy, or
passing by reference.

My understanding of passing by reference (putting the & before a variable
during the function declaration) means that the original data is used.

My understanding of *not* passing by reference, (thus passing a copy)
literally means creating a copy of the data contained in my variables - thus doubling the memory usage for this data... even if its just a temporary while the function is being executed.

I *believed* (past tense) that one should only pass by reference if they
wanted the child function to change the data and pass the newer values back
to the parent function.

I'm now thinking that this is just a feature and not the only usage. I am
begining to think I should use "pass by reference" nearly all the time in
order to conserve memory (since I won't be creating copies of my variable
data in memory).

Would this be good practice? Am I right that passing by reference means that
my variable data is not duplicated thus using less memory than if I had
passed my variable data as a copy?

Multiple Select From Listbox And Execute A Sql Query Select Statement
Supposing i have a html form with 2 listbox and i name it status and resolution.

So it goes <select name='status[]'>... <select name='resolution[]'>

Then i have a another php page.
$status = $_POST['status'];
$resolution = $_POST['resolution'];

Now my question is, how do i do the sql query statement?

mysql_query("SELECT * from bugs where status=$status and resolution=$resolution");

The problem is, i select 3 options form the status listbox eg. new, closed, duplicate. And from the resolution, i chose fixed, invalid.

SELECT Error: No Database Selectedin Query: SELECT * FROM Schedule
I got the above error message after reading FAQ #10 which applied to my first error. The thing is, I thought I had selected a database. This script is copied from a tutorial, and I'm just too new at this to spot my error. PHP Code:

Select Statement - Select Random ID #
I have made up a page that pull info on 13 branches of stores onto one main page. It's basically there to display all the branches on one page... then you click on the one you're interested in and then you go to a more detailed page.

Back to the main page. On the top, there's kind of a featured branch that has a bigger picture and bigger title but it's still getting pul pulled from the same table etc etc etc.

In order for me to avoid favortism to one branch (and for other branches to start complaining) I want to ramdomized the order every time someone came to page but I have no idea how.

right now I have a super simple select statement.

Why Pass The SID?
Although I understand that you can only pass your session ID from page to page using (1) cookies, or (2) sessions - im at a loss why you'd need to do this.

Why isn't it enough to just use 'session_start()' at the top of all your pages? On all the tests I've done, I can register variables and recall them on different pages by only calling session_start - but I saw in a recent post which said you should always pass the session ID too.

I realise there is a tutorial on this, and several (hundred) posts - most of which I've read, but can someone please explain this as basic as possible!

Pass A Value Or Something Like It
I want to know how to pass a certain value or anything like it when you try to click a "picture of a book" or its "name" to be pass on another web page that will show the "book picture", the "price of the book" and the "description" of it?

How To Pass And Use The & In A URL?
I want to pass a phrase in the URL that uses an ampersand:

"Black & White"

And I want to be able to 1) print it as is, and 2) insert it into a link. I think the problem lies in the spaces around the ampersand. I've tried various methods of replacing it with &amp; and &038; and replacing the spaces with %20 or + but it still causes trouble. Code:

User/Pass In URL
Hello all,

I am trying get one server to authenticate to another server possibly with a
browser window in the middle.

My browser throws a syntax error at this url
http://username:password@domain.com:2082 but will allow the same with ftp -
ftp://username:password@domain.com

I want to have a page that has login buttons for remote sites (hosting
client sites and the like).

I understand that with "AuthType Basic" the server sends a request for login
information (403 or something like that). The browser subsequently sends the
user/pass on every other request for a page/resource on that site.

Is there a way to do this in advance?

ie can I do something like this in html ? ..
<form action="http://theirdomain.com:2082" method="post">
<input type="hidden" name="user" value="username">
<input type="hidden" name="pass" value="password">
<input type="submit" value="Your cPanel">

If not then can I proxy it on the server? ie can I place the username and
password into the headers to the remote site and pass a cookie back to the
browser so they can continue the session with the remote site?

How To Pass SID From A Form?
Just trying to figure out how to pass SID once a form is submitted. I am assuming that I could append it to the action (<form method=get action=nextpage.php?<?=SID?>>), but all I get is a nextpage.php? without the SID attached. I have my global variables turned on.

How To Pass A Value In Javascript To A Value In Php
I have not learned Javascript,just copy & paste & revise

<script language="JavaScript">
function confirmDelete{
re = confirm("Delete or not?(yes,cancel)");
if (re == "0"){<?php $re1 = 0;?>}else{ <?php $re1 = 1;?>}
<!--the upper line will cause the confirm windows disappearing--!>
return 0;
}
document.writeln(confirmDelete());
</script>
<?php
echo "$re1 = $re1";
?>

1. How to pass the value "re" in Javascript to $re1 in php
2. How to revise to make the confirm window appear and pass the value
correctly.

How Do I Pass The Session ID Through URL?
I have a series of forms I have been working with using session ID's and
session variables.

I need to convert this to a series of forms where cookies might be turned
off so the URL needs to carry the session ID.

Question :
If I add the session ID to the URL that is passed, can I still use session
variables or do I need to change the way I code the variables altogether?

Pass By Ref Error
I'm getting this error on my PHP CLI script. If this feature is being
depreciated, then how are we to pass vars by reference???

Function parse_for_wind($php_line, &$php_total_wind_matches,
&$php_highest_wind)

[Wed Aug 24 16:22:08 2005] [error] PHP Warning: Call-time
pass-by-reference has been deprecated - argument passed by value; If
you would like to pass it by reference, modify the declaration of
parse_ceil_pattern().

Pass Through Variable
I'm trying to create an image gallery, with (of course) for every
picture
the same javascript-pop-up. Because i use the same javascript, i only
want
to tell it the number of the image... Below is what i have, and it
works:

<?php $pic="01";list($width, $height, $type, $attr) =
getimagesize("./pix/$pic.jpg");
echo "<a href="javascript:MM_openBrWindow('foto.php?naam=$pic&pic=./pix/$pic.jpg','dames3','width=$width,height=$height') "><img
src="./tmb/$pic.gif" height="90" width="90" alt="$pic"
/></a>";
?>

But when i copy it, and change $pic="01" to $pic="02", i get an error.
(Which
makes sense) But how can i tell the same script to take another
number..

The best would be something like <?php $pic="01"; print $script;
$pic="02"; print $script;
etc...
?>
$script would be everything of the earlier mentioned coding except for
'$pic = "..."' So you'd have to include it, but i can't even get that
to
work.. (I can't find a way to include php-script by calling it: echo
$script)

How To Pass A Variable ?
I use PHP with WML. After a simple form (login & password) I check if they are correct (with MySQL) and if yes:

echo ("<card ontimer="lesson.wml">n");
echo ("<timer value="30"/>n");
echo ("<p> Password ".$pass." accepted for login ".$find." </p>n");

what I want is to the next page lesson.wml the variable $find to exist with the value it had here. Meaning I want to keep the login name to the next page. How can I do that??

Pass Value To Header?
When processing a form I am reading in a value to a mysql database. I then
redirect the user to a "thank you" page with Header. What I would like is to
remind the user the value he/she keyed in. Can I pass the variable in the
Header command?

What I want to do in the following is echo the value of $inx01 in
thankyou.php?

<?php
mysql_connect(" Codes Removed ") or die(mysql_error());
mysql_select_db(" Database Name removed ") or die(mysql_error());

$inx01=$_POST['fardvagonf'];

mysql_query("INSERT INTO table1 VALUES ('$inx01')");
echo mysql_error();

mysql_close();

Header("Location: http://www.mydomain.com/thankyou.php");
exit;

?>

Pass A Variable?
I have two php scripts. I need to communicate with each other. I am an Action Script developer so i AM php RETARDED. This is my first one that takes my flash variables creates the right directory then write a text doc to it. Next the user is uploading a file. I want that image file to save to the same directory as the text doc wrote too. The only copmplicted part of this is that the user names the directory Code:

Pass An Id To Another File
On my news page I have a link to the full story and then the short story below.

The link to the full story is news/viewfull.php?id=something

Now what I need to do is make it so if the id=5 in the url it will query the database and get the fullstory that has an id of 5.

Does that make sense? Code:

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 By Reference In PHP?
I have a question regarding functions returning value to other functions in php. Up until now I just make everything happen in one function, but I am finding more and more that I will need to do the same thing 5 times and rather than having the same code five times in my function i figured i would just write a function for that process and pass the value back to the original location. So here is my question, how in the world do you do that in php.

In C++ to pass by reference you have something like:

int main() {
   passReference(int & value1, int & value2);
   return 0;
}
void passReference(int & value1, int & value2) {
    .....processes here
}
Is this done the same way in php? what would the basic outline of a reference function look like. Use my example above and I should be able to figure it out from there.

Pass Data From Url To Url
I want to pass the varying value of "subid" in this url:

http://abcwebsite.php?subid=xxxxxx

into "source" in this url:

http://xyzwebsite.htm?source=xxxxxx

The latter page opens using:

<?php
header ("location:http://xyzwebsite.htm?login=apin&source=xxxxxx");
?>

Howwever, the value of xxxxxx changes unpredictably (not generated by me) so I need to specify it in general terms. Any suggestions as to where to look or what function to use?

Good Way To Pass Login
Hi groupmates,

There are two main methods to identify a user login. One is using Cookie to store the user name after login, Another is to use Session to store the user name. Anything else?

I think both are facing a risk that some people can fake those cookie or sessionid to access our restriced area. What do you think about providing a better Login System?

Methods To Pass Variables
I am trying to pass 8 variables from a search form to different pages and I am confuse whether to use:
1) session
2) cookie
3) passing variable through URL
4) Using hidden form field

My page#1 is a search form and with 8 Select fields. After press Submit Button, page#2 shows all the search results. Some search would show up 100+ rows so I am using a script to break the result pages. Each display page would limit 20 records with links <<Previous 1 2 3.... Next>> at bottom.

However only the first search result page would show up properly but rest of search result won't showup.

I read a few threads on this forums and I wonder what is the best method to use in my case??? It seem passing variable through URL is inefficient in my case since there are 8 variables. With session or cookie, what happen if the user decide to do another search (page#1 search form) without closing browser will the session id renew itself. With hidden form field, since my Page#2 (result display page) is not using form, will it work.

Pass Get Variables Using PHP Header()
I got a form page with 'update' & 'cancel' buttons. When 'cancel' clicked, I want to be redirected to the index page on the right page number.

URL of my edit page is like this:
http://localhost/form.php?op=edit&id=1&cursor=2

In the form.php I got few lines of code to get that 'cursor' before doing redirection:

$iCursor = $_GET["cursor"];
$url = 'index.php?cursor='.(int) $iCursor;

if ($_POST["cancel"]) {
header("Location: $url");
}

The new URL is supposed to be:
http://localhost/index.php?cursor=2

but it showed up like this:
http://localhost/index.php?cursor=0

I've tried using sessions variables as well, but the value of the cursor's still 0.

Do you guys know what happened?

Need To Pass Variable To Another Window
I have a dropdown on my intranet that list all of our referral partners so when I enter a client I can select who referred them to us. Well, things have been going well and this dropdown now has 200 entries to select from. It is getting tedious to go through all of these, so I was thinking of a way to search them by poping up another window for the search and when the partner is selected it will go in a text field or something similar. However, I have no idea how to pass the variable in the popup window to the regular browser window. Anyone have any ideas on how to do this?

Pass By Reference Question
I am creating a program to create sudoku games. I have an object that
is 1 row of a sudoku game. I store the initial state of the row before
I start figuring out the values to place in each cell, in case the
program runs into a problem and has to revert the row back to its
original state.

So first I store the initial State of the row, then I start to modify
the row. My problem is that once I start to change the original row,
it also changes the initial state that I saved. The only thing I can
think that is doing this is that instead of creating a copy of the
object's data in my initial state variable, it is just changing its
pointer to the original rows location.

I wrote a smaller test case to show what I am talking about. At the
end of the program, each cell in the initial state should be full of
numbers 1 to 9. Instead, it is a copy of the current state of the row.<?php

class Cell {
public $c = array(1,2,3,4,5,6,7,8,9);

public function getCandidates() {
return $this->c;
}

public function pickRandomCandidate() {
return $this->c[rand() % count($this->c)];
}

public function setCandidate($a) {
$this->c = array($a);
}

public function removeCandidateFromCell($v) {
$this->c = array_values(array_diff($this->c,array($v)));
}
}

class Row {
public $cells = array();
public $initialState = array();

public function __construct() {
for ($i=0;$i<9;$i++)
$this->cells[$i] = new Cell();
}

public function getInitialState() {
return $this->initialState;
}

public function getCurrentState() {
return $this->cells;
}

public function setInitialState() {
$this->initialState = $this->getCurrentState();
}

public function printRow() {
echo "<strong>Printing Row State</strong>";
echo "<table border=1 cellpadding=4>";
echo "<tr>";
foreach($this->cells as $cell) {
echo "<td align='center'>";
for($i=1; $i <= 9; $i++) {
echo (in_array($i, $cell->c)) ? $i : "<span style='color:
#ddd'>$i</span>";
echo $i==3 || $i==6 ? "<br />" : "";
}
echo "</td>";
}
echo "</tr>";

echo"</table>";
}

public function printInitialState($rowNum = "") {
echo "<strong>Initial State of $rowNum</strong>";
echo "<table border=1 cellpadding=4>";
echo "<tr>";
foreach($this->initialState as $cell) {
echo "<td align='center'>";
for($i=1; $i <= 9; $i++) {
echo (in_array($i, $cell->c)) ? $i : "<span style='color:
#ddd'>$i</span>";
echo $i==3 || $i==6 ? "<br />" : "";
}
echo "</td>";
}
echo "</tr>";
echo"</table>";
}

public function resetRow($rowNum = "") {
echo "resetting row $rowNum <br />";
$this->cells = $this->getInitialState();
#$this->cells = $this->initialState;
}

public function removeCandidateFromRow($v) {
foreach($this->cells as $c =$val) {
$val->removeCandidateFromCell($v);
}
}
}

$myrow = new Row();

$myrow->setInitialState();

$candidate = $myrow->cells[0]->pickRandomCandidate();

$myrow ->removeCandidateFromRow($candidate);
$myrow->cells[0]->setCandidate($candidate);

$myrow->printRow();
$myrow->printInitialState();
?>

Pass A File To A Variable
if i have template.html, how do i get it so that $whatever = "template.html"; i tried $whatever = file("template.html", "r"); then when i say print ($whatever); it just sez Array.

How To Pass A Variable From One Script To Other
Into script1.php I have a variable ($myvariable); I need to pass this variable to script2.php.

Pass Array To Pop-up Window
How would I pass an array to a window I'm popping open? I read a little bit about session variables(I'll have to do some research) I'm thinking maybe that's somewhere to start.

How Do I Pass A Variable Outside A Function?
I'm building a form with php validation, and I'm quite pleased with what I have thus far, but I have a problem - I can't get it to stop! When there are errors in the form it works beautifully, highlighting the missed fields while retaining the info in the filled-in fields. But if there aren't any errors, I can't get it to take the next step and insert the values into MySQL database. PHP Code:

Need To Pass A Cookie In The Header
I have a script runs in the browser & references the users cookie in the process. I want to run this script server-side but need to pass the cookie to make it work properly. I found this script in this forum;

fputs($fp,"GET $page?$params HTTP/1.0n");
fputs($fp,"Authorization: Basic $codenn");

and it does http authentication. I'm hoping that a similar method can be used to pass the cookie.

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.

How To Pass A Var To Another Php Page W/o Using A Form
I want to construct a URL as follows:

<A href="/somewhere.php?epoch=38129301">Link</A>

Is this possible w/o using forms? I am unable to use $epoch in
somewhere.php

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.

How To Pass An Array From On Php Page To Another
i want to send an array from one age to another... i am not using a form....so cant use php-trace-vars.. i have variables...in an array and i want these array elements to be visible on next page too...without posting them..how is this possible.

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.

How To Pass Variables To PHP Binary (CGI)?
My system use to run PHP as an Apache module. And I pass in variables like this:
http://www.somesite.com/somefile.php?IDvar=1

Now my system runs PHP as a CGI. So I am running the same script like this:
/usr/local/bin/php /somepath/somefile.php

How do I pass in the variable IDvar and value 1?

How Can I Pass Variable To Next Page?
I have a search page to search the database, the input from user are include 4 items:

keywords
country
catalog
date

the results are divided into pages by date desc, so there are PREV10 1 2 3 ... NEXT10 to indicate the page number. Then, How can I pass the 4 items and the page number to next page? I don't wont to use urlencode() and urldecode() because there will be long url in IE's address. I try to set the $HTTP_POST_VARS as cookie, so my code:

How To Pass Session Id To Another Page?
I have a script for loggin to a site. My problem is that I want to pass the session Id to another page but I dont know how to do this. what is the correct way to pass another page the session id for security issues?

my another page is: pagina_entrada.htm in this page I have the script for checking if it is the real session id if not it is refused the page This is the script in each page belong to site. All pages has this script first. Is tthis correct? Code:

How To Securely Pass Parameters
Im developing an e-commerce app. This application (e-app) wants to submit some data to the money-processing application ($-app) so that it gets the transaction fullfilled.

The question is, how can the $-app check that its really the e-app submitting the data, and not a hand-crafted form anywhere else?

At first sight, these come to my mind:

1) Check the source's IP adress (Spoofable?)
2) Check out a hash print (Sort of a signature)
3) Maybe some sort of certificate-public-key (ssl?) signing

I would thank some experiences about this matter. (Maybe you would like to check out) Validating input's source.

Fopen(), Pass User Ip
I have to following situation: On the server X, there is a script called search.php. It's a search engine which takes the keywords as input (using GET method) and ouputs the results in xml format. The script can only be ran from certain IP addresses. Requests from other (invalid) adresses will be blocked.

I'm developing a interface script on server Y, which is supposed to run a search query to server X, get the xml data, parse it and then output it in a more user friendly format.
The script on server Y is quite simple: PHP Code:

Pass Variable To Another Page
i know i can pass a variable with POST or GET. but i want to do the following:

a user enters wrong login credentials, so i redirect the user to error.php.
but i also want to pass the message "login credentials not found!".
I could do this with: header("location:index?php?page=error&err=wrong login credentials");

but i don't want the error string to be visible. can i do this another way?
POST doesn't seem an option to me as there isn't a form involved.

Pass Varible From Php To Javascript
I am trying to pass a varible from php to javascript, but it does not work. i could print out the value of Could you help me, please.

i could print out the value of $test from the following:

How Do I Pass An Object To Another Page?
I have 1 page with products on it which users add to a shopping cart using a shopping cart class. The class stores the users products into sessions which works great but I need to be able to display the cart contents on my checkout page using my display cart function. Do I need to pass the shopping cart object and if so how do I do it? PHP Code:

Using Headers To Pass Through Authentication
I must make a post to a site that is protected with basic authentication. I have tryed many different variations on the (PHP) header command to try and supply the login with my details automatically and pass straight through, the most recent being:

header('Location: XXXXXX);
$userpass = base64_encode("USER:PASS");
header('Authorization: Basic $userpass')

where I'm going wrong because that login form just keeps popping up!

Can't Pass Variables By URL On Localhost
I'm developping on localhost (127.0.0.1). When I try to pass parameters from one page to another using the standart way (URL), I just can't retrieve the values. In fact, the isset($varname) returns false. Code:

How To Pass A Php Variable To Exec()
I am trying to do the following :

exec ("echo $mail_body | /usr/sbin/sendmail - v achandak@cse.buffalo.edu");

where $mail_body is my php variable...But this only sends out a blank message. The contents of $mail_body are not appended to the message.If i am not wrong, i think we can pass a php variable to exec(). But maybe i am not doing it in the correct manner?


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