php-general Digest 5 Jul 2003 19:21:43 -0000 Issue 2158

Topics (messages 154036 through 154072):

Re: how to :: multi select
        154036 by: Thomas Hochstetter

Problem about insert some chinese into MySQL db
        154037 by: Erick
        154040 by: Jason Wong
        154041 by: Erick

Re: Builing PHP with Courier-IMAP
        154038 by: Jason Wong

Re: mail()
        154039 by: Jason Wong
        154042 by: Dan Anderson
        154059 by: Phil Dowson

Re: Probs with a form
        154043 by: Lars Torben Wilson

Timing out fopen using https stream wrapper?
        154044 by: Giz
        154045 by: Dan Anderson

Authorization script
        154046 by: Kyle Babich
        154047 by: Dan Anderson
        154048 by: Chris Knipe

Re: A php-mysql checkbox question
        154049 by: Lowell Allen

Limit output of query field
        154050 by: fkeessen.planet.nl
        154051 by: Dan Anderson
        154052 by: Audun Larsen
        154053 by: Marek Kilimajer
        154054 by: Dan Anderson

Permission Problem
        154055 by: Mr|P
        154058 by: Marek Kilimajer

simple query help
        154056 by: Paul Ferrie
        154057 by: Marek Kilimajer

Help a newbie.
        154060 by: Michael Whiting
        154063 by: Dan Anderson

Help a newbie 2.
        154061 by: Michael Whiting
        154065 by: Reuben D. Budiardja

ip's behind proxy-server
        154062 by: Paul van der Linden
        154064 by: Jason Sheets

sqlite_seek() problem
        154066 by: Alan D'Angelo

Delimiter must not be alphanumeric or backslash
        154067 by: Gentian Hila
        154068 by: Alan D'Angelo

Failed to Receive in E:\...\mailscript.php on line 25
        154069 by: Håkon Strandenes
        154070 by: Thomas Seifert

Re: Red Hat 9, Apache 2, and PHP
        154071 by: o_j_p_p.icnet.com.ve

Q on echo phpinfo() ;
        154072 by: jsWalter

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 ---
Thanks guys.
I will have a look at the array[] convention. Meanwhile I did my own
thing by naming them all different and parsing the $QUERY_STRING for
them. It is a mess!
So thanks again!

Cheers
Thomas


--- End Message ---
--- Begin Message ---
There will have some error of words

I tried addslashes(stripslashes($String))

But also can't work



--- End Message ---
--- Begin Message ---
On Saturday 05 July 2003 16:10, Erick wrote:
> There will have some error of words

What errors?

> I tried addslashes(stripslashes($String))
> But also can't work

Try using mysql_escape_string() or mysql_real_escape_string().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
After the last of 16 mounting screws has been removed from an access
cover, it will be discovered that the wrong access cover has been removed.
*/


--- End Message ---
--- Begin Message ---
> What errors?

Can't display those words.

-- 

"Jason Wong" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D
:[EMAIL PROTECTED]
> On Saturday 05 July 2003 16:10, Erick wrote:
> > There will have some error of words
>
> What errors?
>
> > I tried addslashes(stripslashes($String))
> > But also can't work
>
> Try using mysql_escape_string() or mysql_real_escape_string().
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> After the last of 16 mounting screws has been removed from an access
> cover, it will be discovered that the wrong access cover has been removed.
> */
>



--- End Message ---
--- Begin Message ---
On Saturday 05 July 2003 06:05, Fisayo Adeleke wrote:
> I run courier-imap, but I have problems when trying to build php with
> imap support. It gives the error message
>
> configure: error: Cannot find imap library (libc-client.a). Please check
> your IMAP installation.

If you're using Redhat then you need to install imap-devel. If you're using 
some other distro then install whatever package supplies that file 
(libc-client.a). Or download from ftp://ftp.cac.washington.edu/imap/ and 
build it yourself.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"Now here's something you're really going to like!"
-- Rocket J. Squirrel
*/


--- End Message ---
--- Begin Message ---
On Saturday 05 July 2003 02:57, Phil Dowson wrote:

> Could someone let me know if it is possible to pass a resultset of a query
> to a single variable so it can be included as the message part of the mail
> function?

Short answer: yes
Long answer: what exactly are you trying to do and what exactly do you need 
help on?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
I was born in a Hostess Cupcake factory before the sexual revolution!
*/


--- End Message ---
--- Begin Message ---
> > Could someone let me know if it is possible to pass a resultset of a query
> > to a single variable so it can be included as the message part of the mail
> > function?

if I were you I would try something like...

<?php

$result = mysql_query($query);
$email = NULL; // it's bad form to dot without clearing the variable
while ($line = mysql_fetch_array($result,MYSQL_ASSOC))
{
  $email = $email . "Value 1: {$line['value_1']}\n";
  $email = $email . "Value 2: {$line['value_2']}\n";
  $email = $email . "Value 3: {$line['value_3']}\n";
  // ... 
}
mail('[EMAIL PROTECTED]','subject',$email);
?>


--- End Message ---
--- Begin Message ---
Perfect solution. Thanks!!!


----- Original Message ----- 
From: "Dan Anderson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 05, 2003 4:30 am
Subject: Re: [PHP] mail()


> > > Could someone let me know if it is possible to pass a resultset of a
query
> > > to a single variable so it can be included as the message part of the
mail
> > > function?
>
> if I were you I would try something like...
>
> <?php
>
> $result = mysql_query($query);
> $email = NULL; // it's bad form to dot without clearing the variable
> while ($line = mysql_fetch_array($result,MYSQL_ASSOC))
> {
>   $email = $email . "Value 1: {$line['value_1']}\n";
>   $email = $email . "Value 2: {$line['value_2']}\n";
>   $email = $email . "Value 3: {$line['value_3']}\n";
>   // ...
> }
> mail('[EMAIL PROTECTED]','subject',$email);
> ?>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--- End Message ---
--- Begin Message ---
On Fri, 2003-07-04 at 15:02, LPA wrote:
> Hey,
> 
> I must send datas threw a form, but I dont want to have a submit button.. Is
> there a way to 'simulate' the click of a submit button?
> 
> Thnx for your help
> 
> Laurent

Hi there,

This is really an HTML question, and not a PHP question, but use an 
<input type="image" . . .> instead and it should work for you. The link
below will take you to everything you need to know.

  http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4

If you want examples etc, google for something like 'image submit html'
and you'll get tons of info.


Hope this helps,

Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




--- End Message ---
--- Begin Message ---
I have a class that uses fopen to read some xml data from a site with
ongoing stability issues.  Fopen is using the stream wrapper for http.  

Something I've struggled with is finding a way to set a timeout value when
fopen is attempting to get a page from a site that is inaccessible for some
reason.

On my test server, the behavior is that fopen seems to hang up, and the
script never returns.

It seems I have been over the documentation repeatedly, but there simply
isn't any documented way of setting a timeout duration.  Any ideas? 







--- End Message ---
--- Begin Message ---
> It seems I have been over the documentation repeatedly, but there simply
> isn't any documented way of setting a timeout duration.  Any ideas? 

If you want to set a time out on execution of the /script/, check out:

http://us3.php.net/manual/en/function.set-time-limit.php

-Dan


--- End Message ---
--- Begin Message ---
I am making an authorizatoin script for the control panel of a loggin
system I have been writing.  Here is what I have right now:

<?php
require_once('config.inc.php');

$authorized = 0;
$getUser = $_SERVER['PHP_AUTH_USER'];
$getPass = $_SERVER['PHP_AUTH_PW'];

if (($getUser == $user) && ($getPass == $pass)) {
    $authorized = 1;
}

if (!$authorized) {
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Cache-Control: post-check=0; pre-check=0', false);
    header('Pragma: no-cache');
    header('WWW-Authenticate: Basic realm="phpLogK"');
    exit;
} ?>

The problem is that if a user clicks cancel the control panel loads
instead of the program dying.  Why and how do I stop it?

Thank you,
--
Kyle

--- End Message ---
--- Begin Message ---
> The problem is that if a user clicks cancel the control panel loads
> instead of the program dying.  Why and how do I stop it?

Please provide more info -- like what do you mean by "if the user clicks
cancel".

-Dan


--- End Message ---
--- Begin Message ---
> I am making an authorizatoin script for the control panel of a loggin
> system I have been writing.  Here is what I have right now:

Well, if you copied and paste'd this, then I'm surprised that you don't get
a syntax error....

> if (!$authorized) {
>     header('Cache-Control: no-store, no-cache, must-revalidate');
>     header('Cache-Control: post-check=0; pre-check=0', false);
>     header('Pragma: no-cache');
>     header('WWW-Authenticate: Basic realm="phpLogK"');
>     exit;
^^^^^^^^^^^ exit();

You also need some more headers...

    header('HTTP/1.0 401 Unauthorized');
    header('status: 401 Unauthorized');

-=-
me




--- End Message ---
--- Begin Message ---
> From: "John T. Beresford" <[EMAIL PROTECTED]>
> 
> I have a problem trying to show a checkbox list and have some of the
> boxes checked and not others. Here are the details:
> 
> table: features
> rec_id  |  fName
> -----------------
> 1       |  Window
> -----------------
> 2       |  pool
> -----------------
> 3       | fence
> -----------------
> 4       | Drive
> 
> 
> table: com_features
> 
> rec_id  |  com_features_id  |  feature_id
> ------------------------------------------
> 1       |  2                |  1
> ------------------------------------------
> 2       |  1                |  4
> ------------------------------------------
> 3       |  1                |  3
> ------------------------------------------
> 4       |  2                |  3
> ------------------------------------------
> 5       |  4                |  4
> ------------------------------------------
> 6       |  7                |  4
> ------------------------------------------
> 7       |  8                |  4
> ------------------------------------------
> 8       |  2                |  4
> 
> 
> 
> what I want is to display a checkbox list that would show all the
> values from 'features' and have the appropriate boxes checked when
> 'com_features.com_features.id = 2'
> 
> ie
> 
> X  Window
> pool
> X  fence
> X  drive
> 
> The query I am using now is:
> 
> $sql ="SELECT
> features.rec_id AS rec_id,
> features.fName AS fName,
> com_features.feature_id AS feature_id,
> com_features.com_rec_id AS com_rec_id
> FROM features, com_features
> WHERE com_features.com_rec_id = \"2\" AND features.TheTest=\"1\"";
> 
> What I get in the return is:
> 
> X  Window
> pool
> fence
> drive
> 
> Window
> pool
> X  fence
> drive
> 
> Window
> pool
> fence
> X  drive

I'm not sure how you're formatting (HTML?), what "TheTest" is, or what this
has to do with PHP, but how about this select statement:

$sql = "SELECT features.fName, features.rec_id
FROM features, com_features
WHERE features.rec_id = com_features.feature_id
AND com_features.com_features_id = '2'";

HTH

--
Lowell Allen



--- End Message ---
--- Begin Message ---
Hi there,

Hope you can help me with the following:

I have a query and i'm showing the output:

echo $row->text;

That goes o.k. but the text is 400 characters long and I only one to show the first 50 
characters and at the end showing ... dot's..

Help!

Thank you very much!

Frank

--- End Message ---
--- Begin Message ---
Look up the function substr.  It will allow you to create a string of
the first 50 chars from your 400 char string.

-Dan

On Sat, 2003-07-05 at 09:58, [EMAIL PROTECTED] wrote:
> Hi there,
> 
> Hope you can help me with the following:
> 
> I have a query and i'm showing the output:
> 
> echo $row->text;
> 
> That goes o.k. but the text is 400 characters long and I only one to show the first 
> 50 characters and at the end showing ... dot's..
> 
> Help!
> 
> Thank you very much!
> 
> Frank
> 
> 
> ______________________________________________________________________
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Try this: 

if(strlen($row->text)>50) {
    echo substr($row->text,0,47) . "...";
} else {
    echo $row->text;
}

- Audun

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Saturday, July 05, 2003 3:59 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Limit output of query field


Hi there,

Hope you can help me with the following:

I have a query and i'm showing the output:

echo $row->text;

That goes o.k. but the text is 400 characters long and I only one to
show the first 50 characters and at the end showing ... dot's..

Help!

Thank you very much!

Frank



--- End Message ---
--- Begin Message --- Make it with your sql query, it will be faster:
SELECT ..., IF(LENGTH(text)>50, CONCAT(SUBSTRING(text,0,50),'...'), text) as text


[EMAIL PROTECTED] wrote:
Hi there,

Hope you can help me with the following:

I have a query and i'm showing the output:

echo $row->text;

That goes o.k. but the text is 400 characters long and I only one to show the first 50 characters and at the end showing ... dot's..

Help!

Thank you very much!

Frank




--- End Message ---
--- Begin Message ---
> Make it with your sql query, it will be faster:
> SELECT ..., IF(LENGTH(text)>50, CONCAT(SUBSTRING(text,0,50),'...'), 
> text) as text

I won't outright disagree, but warn fkessen to be careful.  There are
some scenarios in which that would not be faster.

-Dan


--- End Message ---
--- Begin Message ---
I moved from myphpnuke to phpnuke.

When trying to register a new user account on the website it get the error:
You are trying to access a restricted area.
We are Sorry, but this section of our site is for Registered Users Only.

Thanks for your help.



--- End Message ---
--- Begin Message --- Go to admin -> Modules, and set Your_Account to be visible to all visitors.

Mr|P wrote:

I moved from myphpnuke to phpnuke.

When trying to register a new user account on the website it get the error:
You are trying to access a restricted area.
We are Sorry, but this section of our site is for Registered Users Only.

Thanks for your help.





--- End Message ---
--- Begin Message ---
Hi guys,
I am working on a flash forum for my site.  Came with the FOED book,

anyways i am tyring to delete the threadCount by -1 from the db.
could below does dlete the count but in multipules of 2.

Anyone

cheers

$query = "UPDATE forumForums SET threadCount = threadCount -1 WHERE forumID
= $forumID";
if(!mysql_query($query)) {
    fail("Error deleting thread Count");
}
$result = @mysql_query($query);




--- End Message ---
--- Begin Message --- because you execute the query twice. Remove the last line, it is not needed as UPDATE does not return any result.

Paul Ferrie wrote:

Hi guys,
I am working on a flash forum for my site.  Came with the FOED book,

anyways i am tyring to delete the threadCount by -1 from the db.
could below does dlete the count but in multipules of 2.

Anyone

cheers

$query = "UPDATE forumForums SET threadCount = threadCount -1 WHERE forumID
= $forumID";
if(!mysql_query($query)) {
    fail("Error deleting thread Count");
}
$result = @mysql_query($query);






--- End Message ---
--- Begin Message ---
 Hey everyone.

I was hoping you could help with something.  I am trying to create a
thumbnail image gallery using PHP and cookies.  The idea is that different
series of images
can be viewed by clicking on + and - links that will then show or hide the
thumbnails. Ie show/hide different rows of a table.  Here is what I've
managed so far but I think it's probably a long way off from achieving what
I hope.

Thanks for any help in advance!

--- End Message ---
--- Begin Message ---
If I were you I would create a mySQL (or Postgresql) database containing
all of the thumbnails.  Use the row id of the mySQL (Postgresql) table
to decide which row to display.  

You probably will want to look up the documentation and/or google.

-Dan

On Sat, 2003-07-05 at 11:44, Michael Whiting wrote:
>  Hey everyone.
> 
> I was hoping you could help with something.  I am trying to create a
> thumbnail image gallery using PHP and cookies.  The idea is that different
> series of images
> can be viewed by clicking on + and - links that will then show or hide the
> thumbnails. Ie show/hide different rows of a table.  Here is what I've
> managed so far but I think it's probably a long way off from achieving what
> I hope.
> 
> Thanks for any help in advance!
> 
> 
> ______________________________________________________________________
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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

Sorry - here's the HTML source.  Don't laugh :)


<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>

<style type="text/css">
<!--
body   {margin:50;}
-->
</style>
<title>ai-em.net | image gallery</title>
<link rel="stylesheet" href="style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#ffffff" text="#000000" link="#666666" vlink="#666666"
alink="#000000">
<p>
<table width="100%" border="0" cellspacing="0" cellpadding="6">
  <tr bgcolor="#000000">
    <td> <font color="#FFFFFF" size="+2">Image Gallery</font> </td>
  </tr>
  <tr bgcolor="#fafafa">
    <td><font size="-1"><b>Series 1</b> - blah and blah and blah
</font><font size="-1"><a href="ig.php?view1=true">View
      Thumbnails</a>  ---  <a href="ig.php?view1=false">Close
      Thumbnails</a></font> </td>
  </tr>

<?php

if (isset($view1)):


if ($view1 = true):
print("<tr bgcolor=\"#ffffff\">\n<td>Hello World! (thumbnails go
here)</td></tr>");
setcookie ("view1", "true");
endif;


if ($view1 = false):
setcookie ("view1", "false");
endif;
endif;
?>

  <tr bgcolor="#FFFFFF">
    <td><font size="-1"><b>Series 2</b> - blah blah again</font></td>
  </tr>
  <tr bgcolor="fafafa">
    <td><font size="-1"><b>Series 3 </b> - blah blah again
(again)</font></td>
  </tr>
</table>
</body>
</html>



--- End Message ---
--- Begin Message ---
On Saturday 05 July 2003 11:47 am, Michael Whiting wrote:
> Sorry - here's the HTML source.  Don't laugh :)
>
>
<snip>

> if ($view1 = true):

That statement will always evaluate to true. You may need 

if($view1 == true)

notice the double equal sign

> if ($view1 = false):
Same here ^^^^
RDB

--- End Message ---
--- Begin Message ---
I've a problem:
I need to block accounts with the same ip, but if it's a proxy-server you
get only the proxy-server ip's. I downloaded somewhere this script:

<?php
$proxy="";
$IP = "";
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy  = $_SERVER["REMOTE_ADDR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$IP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$IP = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$IP = getenv( 'HTTP_X_FORWARDED_FOR' );
$proxy = getenv( 'REMOTE_ADDR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$IP = getenv( 'HTTP_CLIENT_IP' );
} else {
$IP = getenv( 'REMOTE_ADDR' );
}
}
if (strstr($IP, ',')) {
$ips = explode(',', $IP);
$IP = $ips[0];
}
$RemoteInfo[0]=$IP;
$RemoteInfo[1]=$proxy;
print "Client-ip: " . $RemoteInfo[0] . "<BR>Proxy-ip: " . $RemoteInfo[1];
?>

But that doesn't seems to work, it will only give your proxy-server ip's,
and doesn't give the real client-ip. Does someone know how to recieve the
real client-ip, and not the proxy-server ip.

Thanx
Paul



--- End Message ---
--- Begin Message --- By design many proxies are designed to allow the client to be anonymous as well as proxy the connection, so they will not ever reveal the clients IP address.

Not only that but on some ISPS (AOL) the users proxy may change with each request, making tracking the user by the IP not practical or advisiable. Just to let you know you also can't track the user by the MAC, the mac is designed for local area network identification and not on the Internet and it is easily changable.

If you are wanting to uniquely identify a user what I have done in the past is add a column to the users table in the database, when they login I generate a random identifier and store it on the client and in the DB, then each time the page is loaded I verify the two match, if they don't match I log the user out automatically. This allows you to force the user to be logged in only once but it allows them to login at one pc, then login from another pc and be able to use their account from wherever they logged in last from.

If you are just trying to prevent people from voting twice, etc, or signing up for multiple accounts another technique is to force them to give you valid email and then verify the email is valid by sending them an email and having a link they must click to verify their account.

Remember dialup user's ips change every time they connect anyway so blocking by IP is not that effective unless you block an entire IP range.

Jason

Paul van der Linden wrote:

I've a problem:
I need to block accounts with the same ip, but if it's a proxy-server you
get only the proxy-server ip's. I downloaded somewhere this script:

<?php
$proxy="";
$IP = "";
if (isSet($_SERVER)) {
if (isSet($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy  = $_SERVER["REMOTE_ADDR"];
} elseif (isSet($_SERVER["HTTP_CLIENT_IP"])) {
$IP = $_SERVER["HTTP_CLIENT_IP"];
} else {
$IP = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$IP = getenv( 'HTTP_X_FORWARDED_FOR' );
$proxy = getenv( 'REMOTE_ADDR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$IP = getenv( 'HTTP_CLIENT_IP' );
} else {
$IP = getenv( 'REMOTE_ADDR' );
}
}
if (strstr($IP, ',')) {
$ips = explode(',', $IP);
$IP = $ips[0];
}
$RemoteInfo[0]=$IP;
$RemoteInfo[1]=$proxy;
print "Client-ip: " . $RemoteInfo[0] . "<BR>Proxy-ip: " . $RemoteInfo[1];
?>

But that doesn't seems to work, it will only give your proxy-server ip's,
and doesn't give the real client-ip. Does someone know how to recieve the
real client-ip, and not the proxy-server ip.

Thanx
Paul







--- End Message ---
--- Begin Message ---
Hello,
I would want to make a question over the function sqlite_seek(), why it is
giving to me of the problems.

When I make a query with sqlite_query() and use sqlite_fetch_array() all
works well:

Example:

$result = sqlite_query('SELECT * FROM test', $conn);
while($row = sqlite_fetch_array($resulr, SQLITE_NUM, true)){
    $rows[] = $row;
}

$rows is:
Array
(
    [0] => Array
        (
            [0] => 1
            [1] => toro
            [2] => 10
            [3] => 500.00
        )

    [1] => Array
        (
            [0] => 2
            [1] => gallo
            [2] => 5
            [3] => 200.00
        )

    [2] => Array
        (
            [0] => 3
            [1] => rana
            [2] => 20
            [3] => 100.00
        )

    [3] => Array
        (
            [0] => 4
            [1] => cane
            [2] => 3
            [3] => 500.00
        )

)
if I use sqlite_seek() and sqlite_current:if(sqlite_seek($this->result,
1)){    $row = sqlite_current($this->result, $this->type, true);}$row is:
Array
        (
            [0] => 2
            [1] => gallo
            [2] => 5
            [3] => 200.00
        )in place of the first record return the second (The row number is
one-based (1 is the first row) in sqlite_seek()).using sqlite_rewrite() and
sqlite_current() I obtain the first record, but it is not possible to
obtainthe first record of a rowset with sqlite_seek() and sqlite_current()?I
am writing a pretty class for SQLite, this is the last problem that I have
before the release :)but I do not find other documentation for sqlite and
PHP.ThankAlan D'Angelo



--- End Message ---
--- Begin Message ---
hello there,

I am just learning PHP now, so i am very new to it.

I was trying the following code which i received from a PHP book. I am using Version 
4.3.1 installed in windows 

<?
$text = "pot post pat patent";
if(preg_match( "\bp\w+t\b", $text, $array ) )
print $array[0];
?> 

I was expecting everuthing to go normally , but i get the following error:

Warning: Delimiter must not be alphanumeric or backslash in 
f:\apache\apache\htdocs\index.php on line 3

Does anybody have an idea what might be wrong ?

Gentian Hila

--- End Message ---
--- Begin Message ---
Try this:

<?php
$text = "pot post pat patent";
if(preg_match("/\bp\w+t\b/", $text, $array)){
    print $array[0];
}
?>

the pattern in preg_match() does not have correct limit :)


----- Original Message ----- 
From: "Gentian Hila" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 05, 2003 7:57 PM
Subject: [PHP] Delimiter must not be alphanumeric or backslash


hello there,

I am just learning PHP now, so i am very new to it.

I was trying the following code which i received from a PHP book. I am using
Version 4.3.1 installed in windows

<?
$text = "pot post pat patent";
if(preg_match( "\bp\w+t\b", $text, $array ) )
print $array[0];
?>

I was expecting everuthing to go normally , but i get the following error:

Warning: Delimiter must not be alphanumeric or backslash in
f:\apache\apache\htdocs\index.php on line 3

Does anybody have an idea what might be wrong ?

Gentian Hila


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

I am making a small PHP script for managing a simple mailing list. The
PHP script is added in the bottom of this message.

This PHP script works great on IIS 5.1 with PHP 4.3.0, witch I have
installed locally on my system to test my scripts. But when I transfer
the script over to my host server (With IIS and PHP 4.2.1), I get an
error message when I'm trying to use it. The error message is like this:

Warning: Failed to Receive in
E:\inetpub\wwwroot\grimstad.seilforening\Mailinglister\mailscript.php on
line 25 Kommandoen er nå sendt. Merk at det kan ta opp til 5 minutter
før den trer i kraft.PHP Warning: Failed to Receive in
E:\inetpub\wwwroot\grimstad.seilforening\Mailinglister\mailscript.php on
line 25

Is there any compatibility problems between 4.2.1 and 4.3.0 for the
codes I have used in my script?

Regards,
Håkon Strandenes


Here is the script (It get its inputs from this form:
http://grimstad.seilforening.no/Mailinglister/Styreskjema.html):

<?php

@extract($_POST);

$Liste = stripslashes($Liste);
$Navn = stripslashes($Navn);
$Email = stripslashes($Email);
$Kommando = stripslashes($Kommando);

if (!$Email)
{
echo ("Du må fylle inn din e-mail adresse.");
}
else
{
if (!$Navn)
{
echo ("Du må fylle inn navnet ditt.");
}
else
{

$Message = "Automatisk generert styringsmail";
$Headers = "From: $Navn <$Email>";
mail( $Liste, $Kommando, $Message, $Headers );

echo ("Kommandoen er nå sendt. Merk at det kan ta opp til 5 minutter før
den trer i kraft.");

}
}
?>



--- End Message ---
--- Begin Message ---
are you sure that the smtp-settings in php.ini are correct on your host's server?


Thomas

On Sat, 5 Jul 2003 20:15:14 +0200 [EMAIL PROTECTED] (Håkon strandenes) wrote:

> Hi,
> 
> I am making a small PHP script for managing a simple mailing list. The
> PHP script is added in the bottom of this message.
> 
> This PHP script works great on IIS 5.1 with PHP 4.3.0, witch I have
> installed locally on my system to test my scripts. But when I transfer
> the script over to my host server (With IIS and PHP 4.2.1), I get an
> error message when I'm trying to use it. The error message is like this:
> 
> Warning: Failed to Receive in
> E:\inetpub\wwwroot\grimstad.seilforening\Mailinglister\mailscript.php on
> line 25 Kommandoen er nå sendt. Merk at det kan ta opp til 5 minutter
> før den trer i kraft.PHP Warning: Failed to Receive in
> E:\inetpub\wwwroot\grimstad.seilforening\Mailinglister\mailscript.php on
> line 25
> 
> Is there any compatibility problems between 4.2.1 and 4.3.0 for the
> codes I have used in my script?
> 
> Regards,
> Håkon Strandenes
> 
> 
> Here is the script (It get its inputs from this form:
> http://grimstad.seilforening.no/Mailinglister/Styreskjema.html):
> 
> <?php
> 
> @extract($_POST);
> 
> $Liste = stripslashes($Liste);
> $Navn = stripslashes($Navn);
> $Email = stripslashes($Email);
> $Kommando = stripslashes($Kommando);
> 
> if (!$Email)
> {
> echo ("Du må fylle inn din e-mail adresse.");
> }
> else
> {
> if (!$Navn)
> {
> echo ("Du må fylle inn navnet ditt.");
> }
> else
> {
> 
> $Message = "Automatisk generert styringsmail";
> $Headers = "From: $Navn <$Email>";
> mail( $Liste, $Kommando, $Message, $Headers );
> 
> echo ("Kommandoen er nå sendt. Merk at det kan ta opp til 5 minutter før
> den trer i kraft.");
> 
> }
> }
> ?>
> 
> 



--- End Message ---
--- Begin Message ---
Hello Jeff Schwartz, I heard that Apache 2 is not a stable web server using
PHP parser, for this reasoun I think that in the php.net web site have said
that.

bye.



--- End Message ---
--- Begin Message ---
I ran this as a script from my Apache and it gave me a beautiful web page
just full of wonderful information!

But I have a question on just 1 item...

Configuration File (piping) Path C:\WINNIT

How does this value get set?

My PHP is installed at 'G:\etc\php'

My php.ini is there as well.

The paths are set (in that ini file) as...

include_path = ".;G:\etc\php\extensions;G:\etc\php\pear"

extension_dir = "G:\etc\php\extensions"

Even My Apache is told to look there as well...

# Windows Win32 version

LoadFile "/etc/php/gnu_gettext.dll"

LoadModule php4_module "/etc/php/sapi/php4apache2.dll"

Action application/x-httpd-php "/etc/php/php.exe"

ScriptAlias /php/ "/etc/php/"

(pls don't comment about there being volume letters missing to this block,

I want to focus on the issue of a path being defined from out of the blue)

Is this being hard coded somewhere?

If so, then why does my PHP work at all?

I have nothing that belongs to PHP in the system directory.

Well, not completely true.

PEAR installed a pear.ini in the system directory itself (I wish it didn't,

but my PEAR not working properly is a different issue.)

Nothing I've read from the web or the documentation has given me any
understand on how this is set and why PHP file are needed in the location
that the says to place them.

I guess, this is a question for the folks who wrote the executables for
Windows.

Thanks for any help and enlightenment.

Walter






--- End Message ---

Reply via email to