php-general Digest 28 Jul 2002 14:15:01 -0000 Issue 1491

Topics (messages 110019 through 110051):

PHP/MySQL Search Engine Query Question
        110019 by: Paul Maine
        110026 by: Naintara Jain

How do I show the sourse code?
        110020 by: Øystein Håland
        110022 by: Bob Lockie
        110027 by: Michael Sims
        110045 by: JJ Harrison

Re: php 'mail()' security
        110021 by: Bob Lockie
        110025 by: Dennis Gearon
        110036 by: Justin French

Re: Extra spacing with <br> in HTML
        110023 by: Jason Stechschulte
        110034 by: Justin French
        110035 by: Justin French
        110050 by: Kevin Breit
        110051 by: Justin French

setcookie question
        110024 by: Gaylen Fraley
        110029 by: JJ Harrison

running php with .html files?
        110028 by: Henry
        110049 by: Michael Sims

Site Search
        110030 by: Michael Hall

Re: High Resolution Images
        110031 by: Justin French

Re: failure notice
        110032 by: Justin French

Speed issues.
        110033 by: Yves Vrancken
        110037 by: Justin French
        110038 by: Yves Vrancken
        110041 by: Bas Jobsen

need help reg. User Accounts
        110039 by: umesh

file_name
        110040 by: Saci

cant send data from a website to another
        110042 by: kju
        110044 by: Justin French

Self Answer for file upload
        110043 by: Saci

Checking Insert to Postgre, whats wrong?
        110046 by: Bård Magnus Fauske
        110047 by: Yasuo Ohgaki

Help reg. create user and allocate space
        110048 by: umesh

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 ---
I am currently working on a website that is implemented using PHP and MySQL.

The site currently has a simple search engine that allows a shopper to type
in a search string that is stored in $search. For example, if a shopper
types in 1972 Ford Mustang
$string ="1972 Ford Mustang"

Using the following SQL statement:
SELECT * FROM whatevertable WHERE whatevercolumn LIKE '%$search%

Records are returned that have this exact string and in this exact order
(I'm aware a wild card character is included on the front and back of the
string).

My desire is to be able to logically AND each token of the search together
independent or the order of the tokens.
I want to return all records that have Mustang AND 1972 AND Ford.

Since a shopper inputs the search string in advance I don't know how many
tokens will be used.

I would appreciate any suggestions.

Regards,
Paul

--- End Message ---
--- Begin Message ---
You can use explode/split functions on the search parameters - that will
give u an array with each search token indexed individually. Suppose the
search input was 'abc xyz'

$strsearch = "abc xyz";

$search=explode(" ",$strsearch);

your array "search" will contain

$search[0]=abc
$search[1]=xyz

Now, you can iterate through the array members and create a SQL string out
of it, join the elements with "LIKE" and "AND".

so that you have something like

SELECT * FROM whatevertable WHERE whatevercolumn LIKE '%$search[0]% AND
whatevercolumn LIKE '%$search[1]%

Since you won't know how many search input 'tokens' will be searched on: Use
a loop to create the SQL statement. You can also use the implode() function
to create the SQL.

Textual searches can be optimised somewhat by creating the appropriate
indexes (refer to the MySQL manual).

-Naintara

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
t]On Behalf Of Paul Maine
Sent: Sunday, July 28, 2002 8:02 AM
To: PHP PHP
Subject: [PHP] PHP/MySQL Search Engine Query Question


I am currently working on a website that is implemented using PHP and MySQL.

The site currently has a simple search engine that allows a shopper to type
in a search string that is stored in $search. For example, if a shopper
types in 1972 Ford Mustang
$string ="1972 Ford Mustang"

Using the following SQL statement:
SELECT * FROM whatevertable WHERE whatevercolumn LIKE '%$search%

Records are returned that have this exact string and in this exact order
(I'm aware a wild card character is included on the front and back of the
string).

My desire is to be able to logically AND each token of the search together
independent or the order of the tokens.
I want to return all records that have Mustang AND 1972 AND Ford.

Since a shopper inputs the search string in advance I don't know how many
tokens will be used.

I would appreciate any suggestions.

Regards,
Paul


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
I have seen on some of the script-sites around some nice ways of presenting
the source code. Often in nice colors. So, the natural question is: how is
that done (cause I don't think anyone has the patience to put &lt; and &gt;
around all the <>)


--- End Message ---
--- Begin Message ---
>I have seen on some of the script-sites around some nice ways of presenting
>the source code. Often in nice colors. So, the natural question is: how is
>that done (cause I don't think anyone has the patience to put &lt; and &gt;
>around all the <>)

Probably some PHP wrapper that highlights the right portions of the code
and sends it back.
I don't know where you can grab one from but it shouldn't be too difficult to make 
your own.



--- End Message ---
--- Begin Message ---
On Sun, 28 Jul 2002 03:41:19 +0200, you wrote:

>I have seen on some of the script-sites around some nice ways of presenting
>the source code. Often in nice colors. So, the natural question is: how is
>that done (cause I don't think anyone has the patience to put &lt; and &gt;
>around all the <>)

http://www.php.net/manual/en/function.highlight-file.php
--- End Message ---
--- Begin Message ---
research the php function htmlspecialchars().

I replaces < with &lt;  and > with &gt; etc.


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

I often get confused with &lt; and &gt; so they may be in the wrong order
but I am sure you get the idea.

"ØYstein HåLand" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I have seen on some of the script-sites around some nice ways of
presenting
> the source code. Often in nice colors. So, the natural question is: how is
> that done (cause I don't think anyone has the patience to put &lt; and
&gt;
> around all the <>)
>
>


--- End Message ---
--- Begin Message ---
On Sat, 27 Jul 2002 17:31:16 -0700, Dennis Gearon wrote:

>How can I make my form which entered by a user, then sent to a company
>employee, secure, not vulnerable attack?
>-- 
>-----------------------------------------------------------------
>Joy is just a thing (to be).. raised on,
>Love is just the way to Live and Die,
>                       John Denver.
>-----------------------------------------------------------------
>He lost a friend, but kept his Memory (also John Denver),
>                       Thank you...John Corones...my friend always.
>-----------------------------------------------------------------
>Look lovingly upon the present,
>for it holds the only things that are forever true.
>-----------------------------------------------------------------
>                               Sincerely, Dennis Gearon (Kegley)

Setup SSL on your web server.



--- End Message ---
--- Begin Message ---
What I meant was, how to sanitize the input on the forms so that
malicious stuff cannot be put as commands, etc. in the email address, or
body, or 'extra' field of the 'mail()' function in PHP.
-- 
-----------------------------------------------------------------
Joy is just a thing (to be).. raised on,
Love is just the way to Live and Die,
                        John Denver.
-----------------------------------------------------------------
He lost a friend, but kept his Memory (also John Denver),
                        Thank you...John Corones...my friend always.
-----------------------------------------------------------------
Look lovingly upon the present,
for it holds the only things that are forever true.
-----------------------------------------------------------------
                                Sincerely, Dennis Gearon (Kegley)
--- End Message ---
--- Begin Message ---
- strip_tags() will remove HTML and PHP code from a string

- there is a great function set which validates email address' to ensure the
email address is in the correct format available from killersoft:
http://killersoft.com/modules.php?op=modload&name=News&file=article&sid=2

- ensuring there are no newlines (\n) in the email address, subject, etc etc
will ensure that they aren't sneaking another email header into an existing
header.


Justin French



on 28/07/02 1:54 PM, Dennis Gearon ([EMAIL PROTECTED]) wrote:

> What I meant was, how to sanitize the input on the forms so that
> malicious stuff cannot be put as commands, etc. in the email address, or
> body, or 'extra' field of the 'mail()' function in PHP.

--- End Message ---
--- Begin Message ---
On Sat, Jul 27, 2002 at 08:08:34PM -0400, Kevin Breit wrote:
> Lets say I have
> 
> <ul>
>   <li>Blar</li>
> </ul>
> 
> ln2br() will crunch that and put out:
> <ul><br />
>   <li>Blar</li><br />
> </ul><br />
> 
> That creates a lot of white space when that HTML is rendered.  How do I
> tell PHP not to put line breaks in a situation like that?

There might be an easier way, but you might just have to write your own
code for this.  Something along the lines of: (completely untested)

<?php
$line = ereg_replace("(^li|^ul|^ol)>\n", "<br />\n", $line);
?>

-- 
Jason Stechschulte
[EMAIL PROTECTED]
http://www.ypisco.com
--
The brain is a wonderful organ; it starts working the moment you get up
in the morning, and does not stop until you get to school.
--- End Message ---
--- Begin Message ---
I *think* you've got a typo -- you've said ln2br instead of nl2br i think.

Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
something to the resulting code, like replacing "</li><br />" with "</li>":

<?
$original = "<ul><li>Blar</li></ul>";
$new = nl2br($original);
$new = str_replace('</li><br />', '</li>', $new);
?>

Either that, or write your own version of nl2br which ignores </li> (*no
way* I'd both doing this!!!!)


Justin French

--- End Message ---
--- Begin Message ---
on 28/07/02 12:53 PM, Jason Stechschulte ([EMAIL PROTECTED]) wrote:

> There might be an easier way, but you might just have to write your own
> code for this.  Something along the lines of: (completely untested)
> 
> <?php
> $line = ereg_replace("(^li|^ul|^ol)>\n", "<br />\n", $line);
> ?>

Definately an easier way (IMHO) -- just let nl2br() do what it does, then
replace the problematic </li><br /> with just a <br />:

<?
$original = "<ul><li>Blar</li></ul>";
$new = nl2br($original);
$new = str_replace('</li><br />', '</li>', $new);
?>


Justin

--- End Message ---
--- Begin Message ---
On Sun, 2002-07-28 at 04:04, Justin French wrote:
> I *think* you've got a typo -- you've said ln2br instead of nl2br i think.

Doh!  You got that right.

> Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
> something to the resulting code, like replacing "</li><br />" with "</li>":
> 
> <?
> $original = "<ul><li>Blar</li></ul>";
> $new = nl2br($original);
> $new = str_replace('</li><br />', '</li>', $new);
> ?>

Hmmm..you've got it backwards, but I see what you mean.  I'll tool
around with it tonight.

Thanks for the suggestion.

Kevin
-- 
Kevin Breit <[EMAIL PROTECTED]>

--- End Message ---
--- Begin Message ---
on 29/07/02 12:02 AM, Kevin Breit ([EMAIL PROTECTED]) wrote:

>> Aaaannny way, you can't modify WHAT php does in nl2br, but you can do
>> something to the resulting code, like replacing "</li><br />" with "</li>":
>> 
>> <?
>> $original = "<ul><li>Blar</li></ul>";
>> $new = nl2br($original);
>> $new = str_replace('</li><br />', '</li>', $new);
>> ?>
> 
> Hmmm..you've got it backwards, but I see what you mean.  I'll tool
> around with it tonight.

I don't think I did....

Manual Quote:

Description
mixed str_replace ( mixed search, mixed replace, mixed subject)

So, we search for </li><br /> (the problem being the unnecessary <br />, and
replace it with </li>.

Unless I'm misunderstanding the question/problem.


Justin

--- End Message ---
--- Begin Message ---
I need to create a cookie that is accessible from more than 1 application,
but on the same server.  What would be the proper syntax?  What I tried was
setcookie ("myCookie","$cookie_value",$timeToExpire,'/');  Right or wrong or
impossible?  Should I not have used the "/"?  Thanks.

--
Gaylen
PHP KISGB v4.0.5 Guest Book http://www.gaylenandmargie.com/phpwebsite/
PHP KISSQ v1.0 Stock Quote http://www.gaylenandmargie.com/phpwebsite



--- End Message ---
--- Begin Message ---
If the different applications are on the same domain/ip you should use this:
("myCookie","$cookie_value",$timeToExpire);

note the missing parameter at the end


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com

"Gaylen Fraley" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I need to create a cookie that is accessible from more than 1 application,
> but on the same server.  What would be the proper syntax?  What I tried
was
> setcookie ("myCookie","$cookie_value",$timeToExpire,'/');  Right or wrong
or
> impossible?  Should I not have used the "/"?  Thanks.
>
> --
> Gaylen
> PHP KISGB v4.0.5 Guest Book http://www.gaylenandmargie.com/phpwebsite/
> PHP KISSQ v1.0 Stock Quote http://www.gaylenandmargie.com/phpwebsite
>
>
>


--- End Message ---
--- Begin Message ---
Hi All,

I'm sure I saw a posting on this subject a month ago so please excuse me for
not paying attention the first time ;-|

I have a php script that I wish to execute but I want to put it in
index.html (not index.php)

I know there is a solution involving configuration files in either the
directory wher the file is held or specifically for the server.
(Unfortunately I don't have access to the conf files for the server because
I'm currently using a shared serever from an ISP).

Any help is greatly appreciated. Even pointers in the right direction would
be useful.

TIA

Henry





--- End Message ---
--- Begin Message ---
On Sun, 28 Jul 2002 08:18:40 +0100, you wrote:

>Hi All,
[...]
>I have a php script that I wish to execute but I want to put it in
>index.html (not index.php)
>
>I know there is a solution involving configuration files in either the
>directory wher the file is held or specifically for the server.
>(Unfortunately I don't have access to the conf files for the server because
>I'm currently using a shared serever from an ISP).
[...]

You didn't say what web server you are using, so I will assume it's
Apache.  If your server is configured to allow .htaccess files to
override global settings, you should be able to create one in your
directory and add:

AddType application/x-httpd-php .html
--- End Message ---
--- Begin Message ---

I'm wondering what is a good general approach to enabling site-wide
searches on any topic on a 100% PHP-powered portal-type site for a
tertiary institution (yet to be built). Most if not all content will be
contained in a database, spread across potentially many different
tables. 

How can all this stuff be searched efficiently and effectively to
hopefully find the punter what they're looking for? Searching the
sometimes lengthy "main content" fields (eg. an academic paper) in every
table of the entire database for every search doesn't seem like the way to
go. But apart from attempting to add some kind of subjective "search
term" fields to the data, I can't see how else it can be done.

TIA

----------------------------------------------------
MICHAEL HALL                 Web Development Officer
Batchelor Institute of Indigenous Tertiary Education
Work: [EMAIL PROTECTED]             (08) 8951 8314
Home: [EMAIL PROTECTED]                 (08) 8953 1442
----------------------------------------------------

--- End Message ---
--- Begin Message ---
on 28/07/02 1:48 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

> Justin,
> 
> I did what you said, just uploaded the file and downloaded it again, and
> the weirdest thing is happening. When I Form-Upload/FTP-Download it, I can
> see it on my local computer, it opens everywhere. Now, when I try to see it
> from the web site it is uploaded (http://wwwwebsite/file.jpg), it does not
> display. mmm Any suggestions?

Is the JPEG in CMYK or RGB format as you upload? Pretty sure only RGB images
work on browsers, whereas JPEGs work as CMYK as well...

If you can FTP download it AND open it in Photoshop et al, then the issue is
the file compatibility with the browser, probably due to CMYK, resolution,
or something else.


Justin French

--- End Message ---
--- Begin Message ---
on 28/07/02 5:24 AM, Miguel Cruz ([EMAIL PROTECTED]) wrote:

> Is this for real? Rackspace hosts an awful lot of good-hearted people
> (including myself). Is there a specific reason why the entire ISP's
> customer base has been blocked from posting to php-general? I guess I have
> to give up participating on the PHP list...
> 
> miguel

Will be sorry to see you go if that is the case Miguel.

Justin French

--- End Message ---
--- Begin Message ---
Greetings,

I am new to PHP and trying to implement some PHP and MySQL on my website. My
website has a lot of tables and inside some of those tables, I want to
display information that is drawn out of the MySQL database using PHP. I was
wondering what goes faster:

(A). Building the whole page normally up in HTML, doing the usual <table>
<td> and so forth, and then inside the <td> calling up the PHP in order to
display the information. For example: <td> <?php ...... ?> </td>

(B). Doing everything in the PHP document, also the 'building' of the
tables, and then including the PHP script in the main page. For example
using printf("<tr><td>  and so forth.

Thanks,

Yves Vrancken


--- End Message ---
--- Begin Message ---
I haven't noticed ANY performance hit by skipping in and out of PHP and HTML
when it suits me.

I imagine there *might* be a slight performance hit if you were building a
LOT of table information with print or echo or printf, but the general
answer to your question is usually "whatever suits you better".

You could run some comparison tests with a microtimer to see what happens...

I doubt on a 50-100K HTML page that you could notice the difference, unless
the site or server got S**TLOADS of hits.


Justin French



on 28/07/02 5:56 PM, Yves Vrancken ([EMAIL PROTECTED]) wrote:

> Greetings,
> 
> I am new to PHP and trying to implement some PHP and MySQL on my website. My
> website has a lot of tables and inside some of those tables, I want to
> display information that is drawn out of the MySQL database using PHP. I was
> wondering what goes faster:
> 
> (A). Building the whole page normally up in HTML, doing the usual <table>
> <td> and so forth, and then inside the <td> calling up the PHP in order to
> display the information. For example: <td> <?php ...... ?> </td>
> 
> (B). Doing everything in the PHP document, also the 'building' of the
> tables, and then including the PHP script in the main page. For example
> using printf("<tr><td>  and so forth.
> 
> Thanks,
> 
> Yves Vrancken
> 
> 

--- End Message ---
--- Begin Message ---
I didn't expect it to make too much of a difference. Thank you for your
answer.

Yves Vrancken


"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I haven't noticed ANY performance hit by skipping in and out of PHP and
HTML
> when it suits me.
>
> I imagine there *might* be a slight performance hit if you were building a
> LOT of table information with print or echo or printf, but the general
> answer to your question is usually "whatever suits you better".
>
> You could run some comparison tests with a microtimer to see what
happens...
>
> I doubt on a 50-100K HTML page that you could notice the difference,
unless
> the site or server got S**TLOADS of hits.
>
>
> Justin French
>
>
>
> on 28/07/02 5:56 PM, Yves Vrancken ([EMAIL PROTECTED]) wrote:
>
> > Greetings,
> >
> > I am new to PHP and trying to implement some PHP and MySQL on my
website. My
> > website has a lot of tables and inside some of those tables, I want to
> > display information that is drawn out of the MySQL database using PHP. I
was
> > wondering what goes faster:
> >
> > (A). Building the whole page normally up in HTML, doing the usual
<table>
> > <td> and so forth, and then inside the <td> calling up the PHP in order
to
> > display the information. For example: <td> <?php ...... ?> </td>
> >
> > (B). Doing everything in the PHP document, also the 'building' of the
> > tables, and then including the PHP script in the main page. For example
> > using printf("<tr><td>  and so forth.
> >
> > Thanks,
> >
> > Yves Vrancken
> >
> >
>


--- End Message ---
--- Begin Message ---
Hello,

You can also find something about your questions on:
http://www.php9.com/index.php/section/articles/name/PHP%20Guidelines

I had tested out by printing (repeated times):
1) echo '<br>'.$k.': hallo '.$string.', dit is het<br>'."\n";
2) echo "<br>$k: hallo $string, dit is het<br>"."\n";
3) ?><br><?=$k?>: hallo <?=$string?>, dit is het<br><?="\n"?><?
$k=1;
$string='test';

I found: The fastest way to print was 3)
Second came 1) (no much difference) and
the slowest way 2) (about 2 times slower).

I haven't tested printf("<tr><td> 

Best regards,

Bas Jobsen


Op zondag 28 juli 2002 09:56, schreef Yves Vrancken:
> Greetings,
>
> I am new to PHP and trying to implement some PHP and MySQL on my website.
> My website has a lot of tables and inside some of those tables, I want to
> display information that is drawn out of the MySQL database using PHP. I
> was wondering what goes faster:
>
> (A). Building the whole page normally up in HTML, doing the usual <table>
> <td> and so forth, and then inside the <td> calling up the PHP in order to
> display the information. For example: <td> <?php ...... ?> </td>
>
> (B). Doing everything in the PHP document, also the 'building' of the
> tables, and then including the PHP script in the main page. For example
> using printf("<tr><td>  and so forth.
>
> Thanks,
>
> Yves Vrancken
--- End Message ---
--- Begin Message ---
Hi Gurus,

I am using PHP-4.1.1 on Linux,
I wanted to know the difference between "nobody" user and normal user of
operating system.

This question just came to mind when, neither nobody's directory nor any
entry was not found in /home or elsewhere.

Thanking you all in anticipation.

Regards

Umesh.
*****************************
Umesh A. Deshmukh.
Manas Solutions Pvt. Ltd.
[EMAIL PROTECTED]
http://www.manas-solutions.com
Ph. : 91+020+4006358,4223991/92
*****************************
--- End Message ---
--- Begin Message ---
I'm using php 4.21 on WIN xp.

I 'm trying to work with file upload, I already  read several sites who
refer that php will set the variable file_name automaticly,.

I made 2 tries one on line 6 and other on line 7  of the atached code, but
both does not work.

Why I receive the folowing errors, and how can I correct

Notice: Undefined index: file_name in
d:\inetpub\wwwroot\impac\php\upfile.php on line 6

Successfully uploaded
Notice: Undefined variable: file_name in
d:\inetpub\wwwroot\impac\php\upfile.php on line 7



<HTML>
<BODY>
<?php
if (isset($_POST['file'])){
echo "Successfully uploaded ",$_POST['file'], "<BR>\n";
echo "Successfully uploaded ",$_POST['file_name'], "<BR>\n";
echo "Successfully uploaded ",$file_name, "<BR>\n";
}
else
echo "unccessfully uploaded ", "<BR>\n";
phpinfo();
?>
<FORM METHOD=POST ACTION=upfile.php enctype='multipart/form-data'>
<input type=hidden name='MAX_FILE_SIZE' value=200000>
<INPUT TYPE=FILE NAME=file><BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>


--- End Message ---
--- Begin Message ---

Hi newsgroup friends,
my name is mike and im qite new to php.
i have one problem: i cant send date via a <form action="example.php"
method="post">.
so in the the php file called example, i write echo $nameofthefield, but the
data isnt send, so nothing is written in the browser!
what can i do?





--- End Message ---
--- Begin Message ---
Try

echo $_POST['nameofthefield'];

If this works, it's to do with register_globals directive in your php.ini
file.

You can set it to on, which will solve your problem, or you can choose to be
more secure, and write better scripts, by choosing to keep it off, as with
the above line of code.

Search the archives of this list for "regisiter globals" and "new global
variables", because this has been discussed over and over and over and over.


Justin





on 28/07/02 8:04 PM, kju ([EMAIL PROTECTED]) wrote:

> 
> Hi newsgroup friends,
> my name is mike and im qite new to php.
> i have one problem: i cant send date via a <form action="example.php"
> method="post">.
> so in the the php file called example, i write echo $nameofthefield, but the
> data isnt send, so nothing is written in the browser!
> what can i do?
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
The help other's with the same problem I made that self answer.

The tip here is to use $_FILES instead of $_POST

<HTML>
<BODY>
<?php
if (isset($_FILES['file'])){
echo "Successfully uploaded ", "<BR>\n";
echo "File Name ",$_FILES['file']['name'], "<BR>\n";
echo "File Type ",$_FILES['file']['type'], "<BR>\n";
echo "File tmp ",$_FILES['file']['tmp_name'], "<BR>\n";
echo "File errors ",$_FILES['file']['error'], "<BR>\n";
echo "File size ",$_FILES['file']['size'], "<BR>\n";
}
else
echo "unccessfully uploaded ", "<BR>\n";
?>
<FORM METHOD=POST ACTION=upfile.php enctype='multipart/form-data'>
<input type=hidden name='MAX_FILE_SIZE' value=200000>
<INPUT TYPE=FILE NAME=file><BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>


--- End Message ---
--- Begin Message ---
Hello.

I use this code-snip similar to this to check if the inserted tuppel in my 
database was successfull:
--- snip ---
$OID = pg_last_oid($resultat);
        if($OID<0) {
        echo $errormessage;
        exit;
        }
$query = "SELECT * FROM medlemmer WHERE oid = '$OID';";
$resultat = pg_query($dbconnection, $query);

if (!$resultat) {
        echo $errormessage;
        exit;
} else {
        $i = 0;
        $medlem_id[$i] = pg_fetch_result($resultat, $i, "medlem_id");
        $fornavn[$i] = pg_fetch_result($resultat, $i, "fornavn");
}
pg_free_result($resultat);
if (!$medlem_id[$i]) {
        echo $errormessage;
        exit;
} else {
        $i = 0;
        echo $medlem_id[$i].$fornavn[$i];
}
--- snip ---

But when I print the result from pg_fetch_result() to the browser (last 
lines above), I only get the first letter in the string $fornavn[$i] and 
similar strings not listed above, not the whole string. What is the reason 
for this? Has it something to do with the pg_last_oid()? I can't see how 
since this only identify the inserted row (or am I wrong?) which I select 
afterwards.

Thanks for answer.

Bård Magnus

--- End Message ---
--- Begin Message ---
Bård Magnus Fauske wrote:
> But when I print the result from pg_fetch_result() to the browser (last 
> lines above), I only get the first letter in the string $fornavn[$i] and 
> similar strings not listed above, not the whole string. What is the 
> reason for this? Has it something to do with the pg_last_oid()? I can't 
> see how since this only identify the inserted row (or am I wrong?) which 
> I select afterwards.
> 
> Thanks for answer.
>

This is not a direct answer.

Since you are using 4.2.0 or later, you are better to use
pg_status() or pg_result_status() to check these things.

i.e. You don't have to select row just to make sure
row is inserted or not. It wastes lots of resource.

--
Yasuo Ohgaki

--- End Message ---
--- Begin Message ---
Hi Gurus,

I am using PHP-4.1.1, postgresql on Linux.

I want the following functionality, I dont know how to implement it.

Each time a new user registeres, I want to create mail account by the name
he specifies and allocate him some space of the server, say 2mb.

How this is incorporated ?

Please help.

Thanking you all in anticipation.


Regards

Umesh.
*****************************
Umesh A. Deshmukh.
Manas Solutions Pvt. Ltd.
[EMAIL PROTECTED]
http://www.manas-solutions.com
Ph. : 91+020+4006358,4223991/92
*****************************
--- End Message ---

Reply via email to