php-general Digest 23 Aug 2003 06:02:48 -0000 Issue 2253
Topics (messages 160425 through 160482):
Re: Question for you guys and gals
160425 by: CPT John W. Holmes
isset bug?
160426 by: Christian Calloway
160430 by: Curt Zirzow
160435 by: Christian Calloway
160450 by: Robert Cummings
I wish I knew more about multi-dimensional arrays
160427 by: Verdon vaillancourt
160429 by: Ray Hunter
Re: File upload + permissions + .htaccess in php
160428 by: Ryan A
Re: timestamp
160431 by: John Taylor-Johnston
160433 by: Gabriel Guzman
160437 by: John Taylor-Johnston
160438 by: Gabriel Guzman
160444 by: CPT John W. Holmes
160445 by: John Taylor-Johnston
CMS question.
160432 by: Edmond Baroud
Re: rich text editing
160434 by: Andy Crain
File upload & restrictive permissions
160436 by: Doug Parker
'&' Sign in _GET Parameter
160439 by: Pushpinder Singh Garcha
160442 by: Gabriel Guzman
160443 by: CPT John W. Holmes
160448 by: Pushpinder Singh Garcha
anyone have any idea as to how to display a message after a page has started loading??
160440 by: Jeffrey D. Means
160441 by: Matt Babineau
160446 by: Dan Joseph
160453 by: Robert Cummings
Re: Getting browser resolution??
160447 by: erythros
Clean Up the sand box time
160449 by: John Taylor-Johnston
160452 by: Robert Cummings
160482 by: John Taylor-Johnston
PHP and directory permissions
160451 by: Lowell Allen
Trading senerio
160454 by: Joaco
Re: google style paginating
160455 by: Rob Yelvington
160475 by: Robert Cummings
float precision format not being kept
160456 by: Rob Yelvington
160469 by: CPT John W. Holmes
Re: WYSIWYG editor for PHP
160457 by: Rob Yelvington
need help figuring out how to delete rows?
160458 by: Deadsam
PHPOPENCHAT: he script tried to execute a method or access a property of an incomplete
object.
160459 by: Robert Mena
Server variables on IIS
160460 by: Sid
160467 by: CPT John W. Holmes
eval function
160461 by: Matthias Wulkow
160481 by: Tom Rogers
Deleting same values from an array
160462 by: Stephen Craton
160466 by: CPT John W. Holmes
160470 by: Stephen Craton
STRING_FORMAT
160463 by: Dale Hersh
160464 by: Curt Zirzow
Shortcuts/aliases/sym-links?
160465 by: Dan Phiffer
linking via SSH to another server.
160468 by: Vail, Warren
Access denied problem, please help
160471 by: Ryan A
160473 by: Jim Lucas
Making a cookie never expire
160472 by: Stevie D Peele
160477 by: CPT John W. Holmes
safe_mode_include_dir
160474 by: Mark Clarkstone
What's user_dir?
160476 by: DvDmanDT
auto_prepend_file
160478 by: Dennis Gearon
Using PHP to get size of mySQL data?
160479 by: Jeff Lewis
160480 by: Robert Cummings
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
From: "Curt Zirzow" <[EMAIL PROTECTED]>
> > Or cheat and use output buffering.
>
> IMO, thats an even more lazy way of doing it.
I agree entirely. I hate even giving that option, but it is there. That's
why I said he could "cheat" :)
---John Holmes...
--- End Message ---
--- Begin Message ---
Ok, here's the deal. I like to use $_GET and $_POST variables without values
to notify my scripts that some action must be taken. For example, given the
following URL:
http://blahdomain/blah.php?productid=1&edit
or given the following form element:
<input type=hidden name="edit">
My blah.php script will check if edit set using the following line:
if (isset($_REQUEST["edit"]))
{
..
}
and then it will take the appropriate actions (lets just say its updating a
record in the database). Locally I am running PHPv4.3.2, and everything
works fine. I have been working on a large web-based application for the
last month, and yesterday I put it up live. Our host unfortunately runs
PHPv4.2.1 and I have no access to the conf files (those bastards) and
globals are set to on. Low and behold, the isset function returns false when
a $_POST or $_GET variable is passed but contains no value, which would be
exactly the same thing as checking the variable itself:
if ($_REQUEST["edit"]) { }
What I want and needed to do was check for the existance of the variable,
not whether it has a value. So is this a bug, a feature or just some random
happening? Thank guys
PHP ROCKS
--- End Message ---
--- Begin Message ---
* Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> Ok, here's the deal. I like to use $_GET and $_POST variables without values
> to notify my scripts that some action must be taken. For example, given the
> following URL:
>
> http://blahdomain/blah.php?productid=1&edit
>
> or given the following form element:
>
> <input type=hidden name="edit">
simply add a value="1" and it will fix your problem.
>
> My blah.php script will check if edit set using the following line:
>
> if (isset($_REQUEST["edit"]))
> {
> ..
> }
>
> and then it will take the appropriate actions (lets just say its updating a
> record in the database). Locally I am running PHPv4.3.2, and everything
> works fine. I have been working on a large web-based application for the
> last month, and yesterday I put it up live. Our host unfortunately runs
> PHPv4.2.1 and I have no access to the conf files (those bastards) and
> globals are set to on. Low and behold, the isset function returns false when
> a $_POST or $_GET variable is passed but contains no value, which would be
> exactly the same thing as checking the variable itself:
>
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
What I was trying to avoid is exactly that. It would require changing links
and hidden fields throughout the entire application, which would take hours
to track down. I am looking for a nice lazy and easy fix.
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > Ok, here's the deal. I like to use $_GET and $_POST variables without
values
> > to notify my scripts that some action must be taken. For example, given
the
> > following URL:
> >
> > http://blahdomain/blah.php?productid=1&edit
> >
> > or given the following form element:
> >
> > <input type=hidden name="edit">
>
> simply add a value="1" and it will fix your problem.
>
> >
> > My blah.php script will check if edit set using the following line:
> >
> > if (isset($_REQUEST["edit"]))
> > {
> > ..
> > }
> >
> > and then it will take the appropriate actions (lets just say its
updating a
> > record in the database). Locally I am running PHPv4.3.2, and everything
> > works fine. I have been working on a large web-based application for the
> > last month, and yesterday I put it up live. Our host unfortunately runs
> > PHPv4.2.1 and I have no access to the conf files (those bastards) and
> > globals are set to on. Low and behold, the isset function returns false
when
> > a $_POST or $_GET variable is passed but contains no value, which would
be
> > exactly the same thing as checking the variable itself:
> >
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
This should help:
http://www.php.net/manual/en/function.array-key-exists.php
Cheers,
Rob.
On Fri, 2003-08-22 at 13:26, Curt Zirzow wrote:
> * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > Ok, here's the deal. I like to use $_GET and $_POST variables without values
> > to notify my scripts that some action must be taken. For example, given the
> > following URL:
> >
> > http://blahdomain/blah.php?productid=1&edit
> >
> > or given the following form element:
> >
> > <input type=hidden name="edit">
>
> simply add a value="1" and it will fix your problem.
>
> >
> > My blah.php script will check if edit set using the following line:
> >
> > if (isset($_REQUEST["edit"]))
> > {
> > ..
> > }
> >
> > and then it will take the appropriate actions (lets just say its updating a
> > record in the database). Locally I am running PHPv4.3.2, and everything
> > works fine. I have been working on a large web-based application for the
> > last month, and yesterday I put it up live. Our host unfortunately runs
> > PHPv4.2.1 and I have no access to the conf files (those bastards) and
> > globals are set to on. Low and behold, the isset function returns false when
> > a $_POST or $_GET variable is passed but contains no value, which would be
> > exactly the same thing as checking the variable itself:
> >
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--- End Message ---
--- Begin Message ---
Hi, please don't chuckle (too loudly) at my attempts to learn ;)
I'm trying to create what I think would be a multi-dimensional array from a
mysql result set, to use in some example code I got off this list last week.
The example renedring code I want to work with is...
<?php
$data = array('A', 'B', 'C', 'D', 'E', 'F', 'G');
$rowlength = 3;
echo ("<table>");
for ($i = 0; $i < sizeof ($data); $i += $rowlength)
{
echo ("<tr>");
for ($j = 0; $j < $rowlength; $j++)
{
if (isset ($data[$i+$j]))
{
echo ("<td>{$data[$i+$j]}</td>");
} else {
echo ("<td> </td>");
}
}
echo ("</tr>");
}
echo ("</table>");
?>
I trying to create the $data array from my query results like this...
$sql = "select * from table limit 0,5";
$result = mysql_query ($sql);
$number = mysql_numrows ($result);
for ($x = 0; $x < sizeof (mysql_fetch_array($result)); $x ++) {
$data = implode (',',$result[$x]);
}
I had hoped this would get me the six arrays on the page (where I could then
extract the values). I've also tried a number of similar approaches but am
consistently getting six error messages on the page along the lines of
Warning : implode() [ function.implode ]: Bad arguments. in
I know I'm missing something basic and would appreciate any pointers.
Thanks,
Verdon
--- End Message ---
--- Begin Message ---
mysql result as a multi-dimensional array:
while( $row = mysql_fetch_array($result) ) {
$rows[] = $row;
}
now you have a multi-dimensional array that contains each row in rows...
examples:
row 1 col 1 - $rows[0][0]
row 3 col 2 - $rows[3][2]
hth
--
bigdog
On Fri, 2003-08-22 at 10:37, Verdon vaillancourt wrote:
> Hi, please don't chuckle (too loudly) at my attempts to learn ;)
>
> I'm trying to create what I think would be a multi-dimensional array from a
> mysql result set, to use in some example code I got off this list last week.
>
> The example renedring code I want to work with is...
>
> <?php
>
> $data = array('A', 'B', 'C', 'D', 'E', 'F', 'G');
> $rowlength = 3;
>
> echo ("<table>");
> for ($i = 0; $i < sizeof ($data); $i += $rowlength)
> {
> echo ("<tr>");
> for ($j = 0; $j < $rowlength; $j++)
> {
> if (isset ($data[$i+$j]))
> {
> echo ("<td>{$data[$i+$j]}</td>");
> } else {
> echo ("<td> </td>");
> }
> }
> echo ("</tr>");
> }
> echo ("</table>");
>
>
>
> ?>
>
> I trying to create the $data array from my query results like this...
>
> $sql = "select * from table limit 0,5";
> $result = mysql_query ($sql);
> $number = mysql_numrows ($result);
>
> for ($x = 0; $x < sizeof (mysql_fetch_array($result)); $x ++) {
> $data = implode (',',$result[$x]);
> }
>
> I had hoped this would get me the six arrays on the page (where I could then
> extract the values). I've also tried a number of similar approaches but am
> consistently getting six error messages on the page along the lines of
>
> Warning : implode() [ function.implode ]: Bad arguments. in
>
> I know I'm missing something basic and would appreciate any pointers.
>
> Thanks,
> Verdon
>
--- End Message ---
--- Begin Message ---
Hey,
Thanks for replying.
the paths i am using are as follows:
$UserUploadDir="/usr163/home/r/y/ryanknig/public_html/BWH-Ads-Images";
$UserUploadURL = "http://jumac.com/BWH-Ads-Images";
But they still dont work....any ideas?
Thanks,
-Ryan
> I've had this problem twice recently.
>
> Once it was because I'd foolishly moved a script that used relative
pathnames.
> The result was that I was trying to access a file outside the DocumentRoot
> and it didn't matter what the permissions on the file were, it wasn't
trying
> to open that one at all!
>
> The other time is more confusing. I'd gone through all directory and file
> ownerships and they were okay. In the end, in desperation, I chgrp'd the
file
> to be mine (leaving ownership alone) and it worked. This is on my list of
> things to come back to!
>
> HTH
>
> Nick
>
> On Thursday 21 Aug 2003 10:30 am, Ryan A wrote:
> > Hi,
> > I am trying to upload something into a directory on my server but always
i
> > am getting a permission denied ONLY from this server...i have tried it
on 2
> > other servers and they seem to be working fine but i have to get it
working
> > on this server as this server is the fastest and our production server.
> >
> > I have looked at the folder permissions and CHMODED/changed them from
644
> > to 766 and finally 777 but am getting the same error, i then had a look
at
> > the php info file (http://jumac.com/phpinfo.php) and i see
file_uploading
> > is set to 1 and 1, safe mode is off, i am not too familier with file
> > uploading so is this right? if not, how can i change it? hopefully via a
> > .htaccess as I dont have access to the php.ini file directly.
> >
> > Let me again point out that this problem only seems to be on this
server,
> > the scripts including the upload is working perfectly on the other test
> > servers/sites.
> >
> > Kindly reply,
> > -Ryan A.
> >
> >
> > We will slaughter you all! - The Iraqi (Dis)information ministers site
> > http://MrSahaf.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Anyone? Please :)
John Taylor-Johnston wrote:
> This is what I'm using so far. But I need to put in a time stamp to calculate if the
> visitor is new. I want to use the IP so if the ip saved in MySQL is older than 60
> minutes, it will write a new record, if not, don't:
>
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
>
> $getaddr = $_SERVER['REMOTE_ADDR'];
> $gethost = gethostbyaddr($_SERVER['REMOTE_ADDR']);
> $EntryDate = date("Y-m-d");
>
> $sql = "INSERT INTO $table (IPAddress,RemoteHost,EntryDate)
> values('$getaddr','$gethost','$EntryDate')";
> mysql_query($sql);
>
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
> $result = mysql_query("SELECT * FROM $table", $myconnection);
> $num_rows = mysql_num_rows($result);
>
> echo "document.write(\"$num_rows visitors. \");";
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
http://compcanlit.ca/
819-569-2064
--- End Message ---
--- Begin Message ---
On Thu, 2003-08-21 at 22:23, John Taylor-Johnston wrote:
> Not teasing, I know I could do this with some ready made script, but I want to make
> my own.
>
> I'm making a counter.
>
> CREATE TABLE `counter` (
> `IPAddress` VARCHAR NOT NULL ,
> `RemoteHost` VARCHAR NOT NULL ,
> `TimeStamp` TIMESTAMP NOT NULL,
try not naming your timestamp column a reserved word... just a guess
> `Date` VARCHAR NOT NULL
> )
>
>
> Question 1, how do I create a timestamp, (My SQL above does not work.), if this is
> indeed what I want to do.
see above
> Question 2, how can I read TimeStamp and if the elapsed time between visits is more
> than 60 minutes, I insert a new record?
umm... look at:
http://us4.php.net/time
and
http://www.mysql.com/doc/en/DATETIME.html
one thing to look out for is php and mysql deal with time in different
ways, so you may have to do some conversion... but this should get you
started.
> Where do I start?
the above 2 links.
--- End Message ---
--- Begin Message ---
I'm creating a counter.
I want a timestamp where I can calculate if a time stamp is older than one hour, if so
do X, if not do Y.
>Gabriel Guzman wrote:
>http://us4.php.net/time
>and
>http://www.mysql.com/doc/en/DATETIME.html
I have looked at both, especially http://www.mysql.com/doc/en/DATETIME.html
I got my fields to work. Did something stupid.
I'm using timestamp(14) which makes YYYYMMDDHHMMSS
therefore: 20030822033746 becomes:
2003-08-22-03:37:46 (I don't get a lot of sleep I guess :) )
But this is a little difficult to extract a calculation.
In Javascript, however, it seems easier.
<script>
var expdate = new Date();
//################# Cookie Stuff
#####################################
// COOKIE EXPIRATION VARIABLES
// Set cookie to expire in 12 hours
// 1000 milliseconds (milliseconds per second)
// * 60 milliseconds (seconds per minute)
// * 60 milliseconds (minutes per hour)
// * 12 milliseconds (hours per day)
// * 1 milliseconds (days)
// -----------------
// = 12 hours
expdate.setTime (expdate.getTime() + (1000*60*60*12*1));
</script>
Is this the way to go in PHP? And how do I do it? Or is there a better way to have a
timestamp?
John
-------snip this is the code I have so far -----
CREATE TABLE `counter` (
`id` int(10) NOT NULL auto_increment,
`IPAddress` varchar(100) NOT NULL default '',
`RemoteHost` varchar(100) NOT NULL default '',
`EntryDate` date NOT NULL default '0000-00-00',
`MyTimeStamp` timestamp(14) NOT NULL,
`MyTime` time NOT NULL default '00:00:00',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$getaddr = $_SERVER['REMOTE_ADDR'];
$gethost = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$EntryDate = date("Y-m-d");
$sql = "INSERT INTO $table (IPAddress,RemoteHost,EntryDate)
values('$getaddr','$gethost','$EntryDate')";
mysql_query($sql);
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$result = mysql_query("SELECT * FROM $table", $myconnection);
$num_rows = mysql_num_rows($result);
echo "document.write(\"$num_rows visitors. \");";
--- End Message ---
--- Begin Message ---
On Fri, 2003-08-22 at 11:50, John Taylor-Johnston wrote:
> I'm creating a counter.
>
> I want a timestamp where I can calculate if a time stamp is older than one hour, if
> so do X, if not do Y.
so, you have the timestamp already correct? in your mysql db. all you
should need to do is get the unix timestamp from that field:
SELECT UNIX_TIMESTAMP(whateveryourtimestampfieldiscalled) from mytable
where foo;
and compare it to the current time from php:
$timeStampTime = value you got from DB;
$currentTime = time();
these are just integers, so you can easily look to see if the timestamp
is over an hour old. A unix timestamp is simply the number of seconds
that have elapsed since the beginning of the unix epoch, so if you know
how many seconds there are in an hour, you can determine if the
$timeStampTime is over an hour old.
something like:
if $timeStampTime + 3600 < $currentTime {
echo "I'm over an hour old";
} else {
echo "I'm not an hour old";
}
should work.
hth,
gabe.
--- End Message ---
--- Begin Message ---
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
> I'm creating a counter.
>
> I want a timestamp where I can calculate if a time stamp is older than one
hour, if so do X, if not do Y.
SELECT * FROM Table WHERE timestamp_column < NOW() - INTERVAL 60 MINUTE
will give you all rows that have a timestamp column that's over 60 minutes
old. Adapt to your needs.
---John Holmes..
--- End Message ---
--- Begin Message ---
Indeed easier than I thought?! :)
timestamp(14) is ok :)
Thanks John!
John
--
http://compcanlit.ca/
Quoting "CPT John W. Holmes" <[EMAIL PROTECTED]>:
> SELECT * FROM Table WHERE timestamp_column < NOW() - INTERVAL 60 MINUTE
> will give you all rows that have a timestamp column that's over 60 minutes
> old. Adapt to your needs.
> ---John Holmes..
--- End Message ---
--- Begin Message ---
Hi all,
I have a friend who have paid a developper to build him a CMS. This honest
programmer did that (supposedly developped it on his own), encoded the CMS
with Ioncube and did some other unethical activities as well. To make a long
story short, I have read some articles about decoding and cracking the source
/ reverse engineering, and it looks like it is time consuming and also
illegal.
I have taken snapshots of the CMS and put them available to whoever is
interested in giving me a hand to see if this CMS is an open source one?
note the php files: categories_list.php, content_list.php and
content_edit.php.
the CM is also capable to upload in batch... ?
It might be a mix of CMS and an Image Gallery script pakcage.. I also see that
Smarty (template engine) is installed in the same root directory of the CMS,
I am not familiar with Smarty, and since the code is encoded I have no way to
tell wether it's being used with it or not..
Any hints would be appreciated!
snapshots available here:
http://www.onlinecardonation.com/img1.jpg
http://www.onlinecardonation.com/img2.jpg
http://www.onlinecardonation.com/img3.jpg
PS: the CMS is not used for the website above where I put the images :)
Thanks!
Ed.
--
Edmond Baroud
Senior UNIX sysadmin mailto:[EMAIL PROTECTED]
Fingerprint 140F 5FD5 3FDD 45D9 226D 9602 8C3D EAFB 4E19 BEF9
"UNIX is very user friendly, it's just picky about who its friends are."
--- End Message ---
--- Begin Message ---
The only problem in doing so, for me at least, is in editing text
created by htmlarea. Nonsupported users who get a normal textarea
pre-loaded with html generated by htmlarea could break tags, etc., on
updates. I wrote a class I use to work around this by: determining which
type of textarea they'll get (wysiwyg htmlarea or plain textarea), and
if they're using a plain textarea and editing html, all html except for
bold, italics and underline tags are replaced with markers. The plain
textarea user then can add standard bb style tags, [b], [i], etc., then
on submit the bb tags will be converted to html, and the original html
will be added back in, properly nested, etc. If you'd like to use it,
I'd be happy to email it. I'm sure it could use a few extra sets of
eyes.
Andy
> -----Original Message-----
> From: Nelson Rodríguez-Peña Alarcón [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 21, 2003 6:46 PM
> To: Redmond Militante
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Re: rich text editing
>
> Hi,
>
> Redmond Militante wrote:
> >
> > (...) what do people generally do when using an activex rich text
> > editor and the user is using a non supported browser?
>
> You can display a textarea. It'd allow users to edit/add content in a
> simpler, less powered way.
>
> --
> regards,
>
> ------------------------------------------------------------
> Nelson Rodríguez-Peña A.
> Diseño y Desarrollo Web y Multimedia
> ------------------------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Recently I had a problem with file uploading on a server I use, and the
problem was that the tmp/ directory was not set. Now that it has been set,
the images do upload, but the file permissions end up being very
restrictive - something like (-rw-------) - so the images obviously do not
show up on the web. I know I could login and chmod tihs, but since we have
clients upload their own images, it goes without saying that this would be a
major inconvenience. Our sysadmin, who is relatively clueless, suggested
that I add a php chmod function to my scripts. I suppose this would work,
but I don't understand why my scripts once worked without this function -
the files uploaded and were web-viewable. I checked both the target
directory and tmp/ directory, and both are fit for web viewing.
Any ideas as to how I could fix this?
Thanks...
------------------------------------------------------------
http://www.phreshdesign.com
--- End Message ---
--- Begin Message ---
Hello All,
I am using an application where I retrieve user profile from a MySQL
DB using the Company Name . I pass the name of the company to the PHP
script as a '$_GET' parameter. e.g. when the name of the company is
'IBM'. , the URL with the query string would look like :
http://masterstream.com/CRM/full_profile_1.php?name=IBM
Now one of the records had a name : PSG & Inc. , in this case the URL
with the query string would look like
http://masterstream.com/CRM/full_profile_1.php?name=PSG%20&%20Inc.
However in the case of the latter I am not able to pull out any records
from the MySQL database. It says that "no records with the name were
found". I went ahead and tweaked the name of the company, to remove
the "&" sign in 'PSG & Inc.' Now the query works fine. Can some one
throw some light here. I am sure something minor is to be done when
passing the name of the company in the parent script.
Thanks in advance
--Pushpinder
--- End Message ---
--- Begin Message ---
On Fri, 2003-08-22 at 12:05, Pushpinder Singh Garcha wrote:
> Hello All,
>
> I am using an application where I retrieve user profile from a MySQL
> DB using the Company Name . I pass the name of the company to the PHP
> script as a '$_GET' parameter. e.g. when the name of the company is
> 'IBM'. , the URL with the query string would look like :
> http://masterstream.com/CRM/full_profile_1.php?name=IBM
>
> Now one of the records had a name : PSG & Inc. , in this case the URL
> with the query string would look like
> http://masterstream.com/CRM/full_profile_1.php?name=PSG%20&%20Inc
no, this is not how it should look... the '&' in the above query string
is saying the variable 'name' ends and a new variable follows. If you
are submitting this in a form using method=get... it should look
something like:
?name=PSG+%26+Inc
if you are really passing this in a form using method=get, then this
should be handled automatically.
how are you accessing the passed variable?
$_GET['name'] ??
--- End Message ---
--- Begin Message ---
From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]>
> I am using an application where I retrieve user profile from a MySQL
> DB using the Company Name . I pass the name of the company to the PHP
> script as a '$_GET' parameter. e.g. when the name of the company is
> 'IBM'. , the URL with the query string would look like :
> http://masterstream.com/CRM/full_profile_1.php?name=IBM
>
> Now one of the records had a name : PSG & Inc. , in this case the URL
> with the query string would look like
> http://masterstream.com/CRM/full_profile_1.php?name=PSG%20&%20Inc.
>
> However in the case of the latter I am not able to pull out any records
> from the MySQL database. It says that "no records with the name were
> found". I went ahead and tweaked the name of the company, to remove
> the "&" sign in 'PSG & Inc.' Now the query works fine. Can some one
> throw some light here. I am sure something minor is to be done when
> passing the name of the company in the parent script.
The & character separates variables in the query string, so it must be
encoded if it appears in the data. Take a look at
http://us2.php.net/urlencode
---John Holmes...
--- End Message ---
--- Begin Message ---
Thanks for the link,
$link = $row['company'];
<a href=\"full_profile_1.php?name=', urlencode($link),' \"