php-general Digest 11 Sep 2004 10:11:10 -0000 Issue 2989
Topics (messages 196367 through 196391):
Can I name a session variable using another variable?
196367 by: John Gostick
196370 by: Greg Beaver
Totaling sales by month
196368 by: Brian Dunning
196373 by: Brian Dunning
196377 by: Andrew Kreps
196379 by: Brian Dunning
196387 by: John Holmes
PHP5 OOP
196369 by: Ed Lazor
196375 by: Greg Donald
196380 by: Greg Beaver
196381 by: John Holmes
196384 by: Ed Lazor
creating multiple sessions
196371 by: John Gostick
Re: Parsing HTML files
196372 by: Peter Brodersen
Perplexing problem, suggestions or answer needed
196374 by: Mag
196388 by: John Holmes
196391 by: Mag
Re: problems setting up php5 on apache2 (WinXP Pro)
196376 by: Richard Harb
GD Library list
196378 by: bskolb
[Newbie Guide] For the benefit of new members
196382 by: Ma SivaKumar
Re: how to load extensions outside the extension_dir
196383 by: Aidan Lister
create and read array
196385 by: John Taylor-Johnston
196386 by: John Holmes
Help With PEAR::DB Connection
196389 by: php-list.xenonsolutions.com
cURL Help - Posting a Form
196390 by: Nick Wilson
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 ---
Hi,
I've encountered a problem I can't seem to find much reference to on the web, so I
was wondering if anyone here could help me...
Fisrt a brief background:
I am building a fairly simple PHP/MySQL chat system with multiple rooms. Each room is
loaded from the main chat page by clicking on a link that uses JavaScript to open and
size a new window, and also passes the roomname as a variable to the new chat window.
Messages sent from a room are tagged with the roomname, and the window refreshes
periodically to look for new messages(rows) in the database that have that rooms name.
In this way a room only recieves messages meant for it. So far so good. However, to
determine what messages are new, a SESSION variable $prevtime is set each time the
script checks for new messages, so that next time it checks, it will only download
messages posted SINCE the time given in $prevtime. This was not a problem with a
single room, but when multiple rooms are open they are sharing the same session
variable $prevtime because they are all using the same session as they were all opened
from the same window. This leads to 'skipping' of messages and not all messages being
picked up by each room.
I've stratched my head over this, and decided to try and generate a unique SESSION
variable for each room, named using the string 'prevtime' prefixed with the value of
the variable $roomname (the name of the current room). However I can't seem to get
this to work.
To summarise my problem: Can I name/create a session variable like this?:
$roomname="sampleroom";
$_SESSION["$roomname" . "prevtime"]=time();
With the aim of making a session variable named 'sampleroomprevtime'. It is possible
to use a variable in naming a session this way? I would really appreciate any help
anyone could give me in making this work, or any suggestions of a better way from
people with a much better knowledge of sessions than myself!
Thanks in advance,
John
--- End Message ---
--- Begin Message ---
Hi John,
I would recommend making $_SESSION['prevtime'] an array
$roomname = 'sampleroom';
if (!isset($_SESSION['prevtime'])) {
$_SESSION['prevtime'] = array();
}
$_SESSION['prevtime'][$roomname] = time();
Then, you can
if (isset($_SESSION['prevtime'][$roomname])) {
// update the session subvariable, or use it
} else {
// create the session subvariable
}
Regards,
Greg
John Gostick wrote:
Hi,
I've encountered a problem I can't seem to find much reference to on the web, so I
was wondering if anyone here could help me...
Fisrt a brief background:
I am building a fairly simple PHP/MySQL chat system with multiple rooms. Each room is loaded from the main chat page by clicking on a link that uses JavaScript to open and size a new window, and also passes the roomname as a variable to the new chat window. Messages sent from a room are tagged with the roomname, and the window refreshes periodically to look for new messages(rows) in the database that have that rooms name. In this way a room only recieves messages meant for it. So far so good. However, to determine what messages are new, a SESSION variable $prevtime is set each time the script checks for new messages, so that next time it checks, it will only download messages posted SINCE the time given in $prevtime. This was not a problem with a single room, but when multiple rooms are open they are sharing the same session variable $prevtime because they are all using the same session as they were all opened from the same window. This leads to 'skipping' of messages and
not all messages being picked up by each room.
I've stratched my head over this, and decided to try and generate a unique SESSION
variable for each room, named using the string 'prevtime' prefixed with the value of
the variable $roomname (the name of the current room). However I can't seem to get
this to work.
To summarise my problem: Can I name/create a session variable like this?:
$roomname="sampleroom";
$_SESSION["$roomname" . "prevtime"]=time();
With the aim of making a session variable named 'sampleroomprevtime'. It is possible
to use a variable in naming a session this way? I would really appreciate any help
anyone could give me in making this work, or any suggestions of a better way from
people with a much better knowledge of sessions than myself!
Thanks in advance,
John
--- End Message ---
--- Begin Message ---
I have a MySQL db with a datetime field containing the date and time of
the sale. I want to query for a simple report that shows total sales by
month.
I thought this would be quick & easy but it's NOT! I can't figure out
how to query for it.
If this question would be better posed to a SQL list, I'd appreciate a
recommendation to a good one. I couldn't find one via STFW that had any
kind of volume.
- Brian
--- End Message ---
--- Begin Message ---
Thanks Pablo - but it's more complicated than that. I'm trying to
return totals for all calendar months, not all records within the past
month. I'll word my question better and post it to one of your
suggested lists. :)
On Sep 10, 2004, at 4:27 PM, Pablo Gosse wrote:
Brian Dunning wrote:
I have a MySQL db with a datetime field containing the date and time
of the sale. I want to query for a simple report that shows total
sales by month.
I thought this would be quick & easy but it's NOT! I can't figure out
how to query for it.
If this question would be better posed to a SQL list, I'd appreciate a
recommendation to a good one. I couldn't find one via STFW that had
any kind of volume.
- Brian
Haven't used MySQL in about four or five years (use PostgreSQL instead)
but it will be something like this:
select * from tablename where datetime_field <= (now() - interval('1
month'));
The difference for you would be in the now() function (whatever mysql
function returns the current system time is what you need) and the
interval function. This just takes the present time and applys the
specified interval.
Check out http://forums.devshed.com and http://www.tek-tips.com.
They have a lot of forums that are pretty heavily visited.
HTH.
Pablo
- Brian
--- End Message ---
--- Begin Message ---
This one worked for me, on MySQL 3.23.xx. I hope it's closer to what you need.
select sum(ordersubtotal), date_format(orderdate, '%Y-%m') as odate
from orders group by odate
On Fri, 10 Sep 2004 15:01:34 -0700, Brian Dunning
<[EMAIL PROTECTED]> wrote:
> I have a MySQL db with a datetime field containing the date and time of
> the sale. I want to query for a simple report that shows total sales by
> month.
>
> I thought this would be quick & easy but it's NOT! I can't figure out
> how to query for it.
>
> If this question would be better posed to a SQL list, I'd appreciate a
> recommendation to a good one. I couldn't find one via STFW that had any
> kind of volume.
>
> - Brian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Amazing - that did it, first try! THANKS. I knew it had to be simple.
SQL rocks.
- Brian
--- End Message ---
--- Begin Message ---
Andrew Kreps wrote:
>> I have a MySQL db with a datetime field containing the
>> date and time of the sale. I want to query for a simple
>> report that shows total sales by month.
>
This one worked for me, on MySQL 3.23.xx. I hope it's closer to what you need.
select sum(ordersubtotal), date_format(orderdate, '%Y-%m') as odate
from orders group by odate
Also,
SELECT SUM(ordersubtotal), YEAR(orderdate), MONTH(orderdate) FROM orders
GROUP BY YEAR(orderdate), MONTH(orderdate)
If you wanted the date parts in separate columns or wanted to limit to
specific months. If you ever want to group by week, YEARWEEK() will come
in handy, btw.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Any recommendations on the best PHP5 OOP book to get? I have Advanced PHP
Programming by George Schlossnagle. It's turning out to be a great book,
but I'd like to read more on PHP5 OOP. The first chapter recommends two
books, but both deal with OOP from the perspective of C++, C#, and Perl.
Thanks,
Ed
--- End Message ---
--- Begin Message ---
On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> Any recommendations on the best PHP5 OOP book to get? I have Advanced PHP
> Programming by George Schlossnagle. It's turning out to be a great book,
> but I'd like to read more on PHP5 OOP. The first chapter recommends two
> books, but both deal with OOP from the perspective of C++, C#, and Perl.
Do not bother to get "PHP5 and MySQL Bible" unless you're a complete
PHP beginner. The one OO chapter is not much more than is in the PHP
manual. I got it and wish I hadn't. Overall it's long-winded and the
humor is dry. Tons of useless chatter in between the information you
really want.
--
Greg Donald
http://destiney.com/
--- End Message ---
--- Begin Message ---
Greg Donald wrote:
On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
Any recommendations on the best PHP5 OOP book to get? I have Advanced PHP
Programming by George Schlossnagle. It's turning out to be a great book,
but I'd like to read more on PHP5 OOP. The first chapter recommends two
books, but both deal with OOP from the perspective of C++, C#, and Perl.
Do not bother to get "PHP5 and MySQL Bible" unless you're a complete
PHP beginner. The one OO chapter is not much more than is in the PHP
manual. I got it and wish I hadn't. Overall it's long-winded and the
humor is dry. Tons of useless chatter in between the information you
really want.
Honestly, if you want to learn OOP in php5, the best way to do it is to
get an IDE that contains a PHP 5 step-through debugger such as Zend IDE
and try out the stuff you see in the link from the php.net home page
regarding Zend Engine 2. It is very similar to java/c# and perl in
terms of the similarity to those features (exceptions, try/catch, PPP
are all from those languages). The big changes are the new xml
extensions and their derivatives like simplexml, dom, soap. Learning
the DOM extension and simplexml is very difficult to do without some
kind of prior knowledge of DOM, but you'll learn more from sites like
w3cschools.com than you will from a book. In addition, ReflectionClass
is your friend, as in:
<?php
$a = new ReflectionClass('DOMDOcument');
var_dump($a->getMethods());
// or even
$a = new ReflectionClass('ReflectionClass');
var_dump($a->getMethods());
?>
I would recommend starting with the big red "Beginning PHP4" and then
simply using trial and error to learn the differences with PHP5, it's
not all that different from php4 in the basics, it is a question of how
you use it.
Greg
--- End Message ---
--- Begin Message ---
On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
Any recommendations on the best PHP5 OOP book to get? I have Advanced PHP
Programming by George Schlossnagle. It's turning out to be a great book,
but I'd like to read more on PHP5 OOP. The first chapter recommends two
books, but both deal with OOP from the perspective of C++, C#, and Perl.
The language doesn't matter. If you're learning OOP, you need to learn
the concepts first, which can then be applied to any language.
I have the following book which I'd highly recommend:
http://www.amazon.com/exec/obidos/tg/detail/-/0672318539/103-7282797-1853467?v=glance
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Thanks everyone for the recommendations =)
> -----Original Message-----
> On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> >Any recommendations on the best PHP5 OOP book to get? I have Advanced
> PHP
> >Programming by George Schlossnagle. It's turning out to be a great book,
> >but I'd like to read more on PHP5 OOP. The first chapter recommends two
> >books, but both deal with OOP from the perspective of C++, C#, and Perl.
>
> The language doesn't matter. If you're learning OOP, you need to learn
> the concepts first, which can then be applied to any language.
>
> I have the following book which I'd highly recommend:
> http://www.amazon.com/exec/obidos/tg/detail/-/0672318539/103-7282797-
> 1853467?v=glance
--- End Message ---
--- Begin Message ---
Hi,
I've encountered a situation where I need to have two or more SEPARATE sessions
running in separate windows. The reasons are complicated, so I'll keep things simple
by just explaining the problem!
Unfortunately my understanding of sessions is a little sketchy at best so please stick
with me...
As I understand it, you can start a new session by manually opening another separate
Internet Explorer window, but I wish the new session to start in a window I've opened
automatically from a previous page. Unfortunately this appears to carry on the session
from the source window, which I don't want - I want a new, separate session.
I've considered calling session_start(); in the new window, then destroying the
session and calling session_start(); to start a new, separate session, but surely
this will destroy the session in the original window, which I want to keep intact!
So put simply, is there anyway to 'force' a new session?
Thanks,
John
--- End Message ---
--- Begin Message ---
On Fri, 10 Sep 2004 11:58:58 +0100, in php.general
[EMAIL PROTECTED] (Abdul-Wahid Paterson) wrote:
>> I was wondering if any classes/functions could help me with this little
>> challenge, (im hopeless at regex ;-)
>>
>> <input type="hidden" name="id" value="593" />
>
>No easy way of doing it, regex somthing like:
>
>$id = preg_replace("/.*<input.*name=\"id\" value=\"[0-9]+\" \/>/", $1, $string);
How about just using an xml-based function? Much cleaner, doesn't
require name-attribute to be present before value-attribute.
<?php
$string = '<input type="hidden" name="id" value="593" />';
$x = xml_parser_create();
xml_parse_into_struct($x,$string,$array);
print $array[0]['attributes']['VALUE'];
// or, out of curiousity:
var_dump($array);
?>
(and why preg_replace? $1 wouldn't even be set since no capturing
parenthesises are used)
--
- Peter Brodersen
--- End Message ---
--- Begin Message ---
Hi,
I will be getting input from a textarea and then I am
using "explode" to break the text into an array when
it encounters a space.
eg:
one two three four ninty
would be broken into 5 parts of an array.
** The array would then be put into a session **
now I need to display the last part (which would be
"ninty" using the above example) then take out the
last part from the array then echo the next last part
(which would be "four") then take out the last part
(using unset? ) etc etc so I have something like:
Displaying Array :
ninty
(deleteing ninty)
four
(deleteing four)
three
(deleteing three)
etc
I have been reading the manual and have come this far,
then I think I have to use the array splice function..
Am totally confused, any help, links, tutorials,
pointers, tips or code would be appreciated.
Thanks,
Mag
=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
_______________________________
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool
--- End Message ---
--- Begin Message ---
Mag wrote:
Hi,
I will be getting input from a textarea and then I am
using "explode" to break the text into an array when
it encounters a space.
eg:
one two three four ninty
would be broken into 5 parts of an array.
** The array would then be put into a session **
now I need to display the last part (which would be
"ninty" using the above example) then take out the
last part from the array then echo the next last part
(which would be "four") then take out the last part
(using unset? ) etc etc so I have something like:
Displaying Array :
ninty
(deleteing ninty)
four
(deleteing four)
three
(deleteing three)
etc
I have been reading the manual and have come this far,
then I think I have to use the array splice function..
Am totally confused, any help, links, tutorials,
pointers, tips or code would be appreciated.
Why not just use array_reverse() and then print them out in order using
foreach?
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
--- John Holmes <[EMAIL PROTECTED]> wrote:
> Mag wrote:
>
> > Hi,
> > I will be getting input from a textarea and then I
> am
> > using "explode" to break the text into an array
> when
> > it encounters a space.
> >
> > eg:
> > one two three four ninty
> > would be broken into 5 parts of an array.
> >
> > ** The array would then be put into a session **
> > now I need to display the last part (which would
> be
> > "ninty" using the above example) then take out the
> > last part from the array then echo the next last
> part
> > (which would be "four") then take out the last
> part
> > (using unset? ) etc etc so I have something like:
> >
> > Displaying Array :
> > ninty
> > (deleteing ninty)
> > four
> > (deleteing four)
> > three
> > (deleteing three)
> > etc
> >
> > I have been reading the manual and have come this
> far,
> > then I think I have to use the array splice
> function..
> > Am totally confused, any help, links, tutorials,
> > pointers, tips or code would be appreciated.
>
> Why not just use array_reverse() and then print them
> out in order using
> foreach?
>
> --
>
> ---John Holmes...
Hello John,
The reason is I am trying to "chain" some programs,
the idea is to take the first part (in the original
example "ninty", then redirect to the second script
passing that value...after the second script finishes
it redirects back to the first script which will pass
the second value (which would be "four") which would
be be passed to the second script etc
I think the main part which is confusing me is how I
can take out just certain "used" parts of the array in
the $_SESSION array...ideas?
Thanx,
Mag
=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
I have no experience with PHP5 so far but this subject was asked
before often enough with PHP4 - so the advice should still be valid...
I generally didn't put any files in the %SYSTEMROOT% folder (which
usually translates to C:\WINDOWS on a default installed WinXP machine)
but instead I put the php.ini and php4ts.dll into the apache
respectively apache2/bin folder and modified the php.ini to point to
the dlls. works like a charm for me.
With all the stuff related to the local webserver put into
'c:\webroot' those entries in php.ini are:
include_path = ".;c:\webroot\php4\dlls\;c:\webroot\php4\pear"
extension_dir = "c:\webroot\php4\extensions"
... you get the idea.
HTH
Richard
On Fri, 10 Sep 2004 09:31:43 -0400, [EMAIL PROTECTED] (Mathieu
Dumoulin) wrote:
>(Don't write to me telling me to use linux, i dont want to, this is my home
>machine not a production server, thank you, now if you really want to help
>keep on reading)
>
>I got a most recent copy of PHP 5.01 extracted into "C:\php" and everything
>seems to be working fine as long as i dont ask to load extensions. Any
>extension that i try to add will fail to load and i'm clueless.
>
>At first in the PHP.ini file this was the original directive:
>
>; Directory in which the loadable extensions (modules) reside.
>extension_dir = "./"
>
>And it would not work so i changed it to a hardcoded path
>
>; Directory in which the loadable extensions (modules) reside.
>extension_dir = "C:\php\ext"
>
>Still no extensions wont load. Whats the weirdest, all the DLLs are at the
>correct location, apache reports: "PHP startup: Unable to load dynamic
>library 'C:\php\ext\php_mysql.dll' - The specified module could not be
>found."
>
>but it IS there, at the exact location, i even looked and compared both
>paths manually letter by letter. Another weird thing to note is that some
>extensions DO load while some don't, here is a list of the extensions that
>i'm loading and which one fails (Note ALL extensions DLL are indeed in the
>folder intended, they just dont load)
>
>extension=php_bz2.dll
>extension=php_gd2.dll
>extension=php_imap.dll
>extension=php_mysql.dll <<< fails but it's vital to me
>
>these extensions are activated, only mysql fails, but there are other i
>wanted earlier lemme see which ones: (These would be nice to have, i'll tell
>you which one fails too)
>
>;extension=php_exif.dll <<< fails
>;extension=php_ldap.dll <<< fails (The file really isnt there so it's not a
>real problem)
>;extension=php_openssl.dll <<< fails
>;extension=php_pdf.dll
>;extension=php_pgsql.dll
>;extension=php_snmp.dll
>;extension=php_sockets.dll
>;extension=php_tidy.dll
>;extension=php_zip.dll
>
>All of these will load... Soooo I'm stuck there, i need help, tell me if you
>need to know anything else. i'll be glad to give you info, i want to set
>this up to further my PHP developement at home. We intensively use PHP4 at
>work but i wanted to start working on PHP5 to see how good it is.
>
>Till then
>See ya'll
>TheInsaneCoder
--- End Message ---
--- Begin Message ---
Does anyone know if there is a mailing list for gdlib? Can't seem to find
in Google.
--- End Message ---
--- Begin Message ---
=======================================
Please feel free to add more points and send
to the list.
=======================================
1. If you have any queries/problems about PHP
try http://www.php.net/manual/en first. You
can download a copy and use it offline also.
Please also try
http://www.php.net/manual/faq.php
for answers to frequently answered questions
about PHP (added by Christophe Chisogne).
2. Try http://www.google.com next. Searching
for "php YOUR QUERY" may fetch you relevant
information within the first 10 results.
3. There is a searchable archive of the
mailing list discussion at
http://phparch.com/mailinglists. Many of the
common topics are discussed repeatedly, and
you may get answer to your query from the
earlier discussions.
For example: One of the repeatedly discussed
question in the list is "Best PHP editor".
Everyone has his/her favourite editor.
You can get all the opinions by going through
the list archives. If you want a chosen list
try this link :
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).
4. Not sure if PHP is working or you want
find out what extensions are available to
you?
Just put the following code into a file with
a .php extension and access it through your
webserver:
<?php
phpinfo();
?>
If PHP is installed you will see a page with
a lot of information on it. If PHP is not
installed (or not working correctly) your
browser will try to download the file.
(contributed by Teren and reworded by Chris W
Parker)
5. If you are stuck with a script and do not
understand what is wrong, instead of posting
the whole script, try doing some research
yourself. One useful trick is to print
the variable/sql query using print or echo
command and check whether you get what you
expected.
After diagnosing the problem, send the
details of your efforts (following steps 1,
2 & 3) and ask for help.
6. PHP is a server side scripting language.
Whatever processing PHP does takes place
BEFORE the output reaches the client.
Therefore, it is not possible to access
users' computer related information (OS,
screen size etc) using PHP. Nor can you
modify any the user side settings. You need
to go for JavaScript and ask the question in
a JavaScript list.
On the other hand, you can access the
information that is SENT by the user's
browser when a client requests a page from
your server. You can find details about
browser, OS etc as reported by
this request. - contributed by Wouter van
Vliet and reworded by Chris W Parker.
7. Provide a clear descriptive subject line.
Avoid general subjects like "Help!!", "A
Question" etc. Especially avoid blank
subjects.
8. When you want to start a new topic, open a
new mail composer and enter the mailing list
address [EMAIL PROTECTED] instead of
replying to an existing thread and replacing
the subject and body with your message.
9. Only quote the relevant parts of
an email when replying. Do not Quote
everything (including huge code snippets)
only to say "I agree", for instance.
[contribued by Paul Waring]
10. It's always a good idea to post back to
the list once you've solved your problem.
People usually add [SOLVED] to the subject
line of their email when posting solutions.
By posting your solution you're helping the
next person with the same question.
[contribued by Chris W Parker]
11. Ask smart questions
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)
12. Do not send your email to the list with
attachments. If you don't have a place to
upload your code, try the many pastebin
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]
Following these guidelines will ensure that
you get effective responses from the list
members. Otherwise, your questions might not
be answered.
Hope you have a good time programming with
PHP.
--
Integrated Management Tools for leather
industry
----------------------------------
http://www.leatherlink.net
Ma SivaKumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106
--- End Message ---
--- Begin Message ---
You can't,
It's a security thing.
"Marten Lehmann" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I need to load extensions with dl() within PHP running as CGI. But as this
> is a shared hosting environment, I don't have access to the extension_dir.
> Anyway, dl() prepends <install-dir>/lib/php/extensions/
> <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO if I'm calling
> dl("myext.so"); even if I'm starting with a slash. How can I disable this?
>
> Regards
> Marten
--- End Message ---
--- Begin Message ---
Can someone help me, show me how to do this please?
1. How do I write $mydata->AUS and $mydata->id into an array?
$authors = array();
while ($mydata = mysql_fetch_object($news))
{
# echo "$mydata->AUS, $mydata->id\n";
??? write to array
}
mysql_close($myconnection);
2. Then I need to create $SQL
foreach ($authors as something)
{
$sql += "INSERT INTO newtable VALUES ($AUS, $id);\r\n";
}
I am reading http://ca3.php.net/manual/en/language.types.array.php but don't really
get it.
Can I do $sql += "blah"; or do I have to write $sql = $sql + "blah";?
--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
Can someone help me, show me how to do this please?
1. How do I write $mydata->AUS and $mydata->id into an array?
$authors = array();
while ($mydata = mysql_fetch_object($news))
{
# echo "$mydata->AUS, $mydata->id\n";
??? write to array
}
mysql_close($myconnection);
What do you mean "write to array"??
$array = array($mydata->AUS,$mydata->id);
That?
2. Then I need to create $SQL
foreach ($authors as something)
{
$sql += "INSERT INTO newtable VALUES ($AUS, $id);\r\n";
}
+= is addition. I doubt that's what you want.
$sql .= "INSERT INTO newtable VALUES ({$mydata->AUS},{$mydata->id});\r\n";
Not sure why you're joining all these queries together, you can only run
one at a time with MySQL...
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hello everyone,
I have a problem connecting to the Database. When I execute the code at the
bottom, it gives me this message: "DB Error: extension not found". It sees
the DB file and the parameters are correct. I checked the include path and
it was correct. Did I do something wrong? Any help would be greatly
appreciated. Thank you.
require_once 'DB.php';
$user = 'foo';
$pass = 'bar';
$host = 'localhost';
$db_name = 'clients_db';
$dsn = "mysql://$user:[EMAIL PROTECTED]/$db_name";
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}
-- Nilaab
--- End Message ---
--- Begin Message ---
hi all,
Im trying to get the following php code to output the
'success'/'failure' page from posting a form to a site. The problem is
that there is no output at all, so i must be doing somthing silly, but
cant work out what! ;-)
## Code
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://example.com/form.html");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_REFERER, "http://nowhere.com");
curl_setopt($ch, CURLOPT_USERAGENT, "CommentMaker 0.8");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"static=$static&entry_id=$entry_id&author=" . urlencode($author) . "&email=" .
urlencode($email) ."&url=$myurl&bakecookie=Forget+Info&text=" . urlencode($text) .
"&post=+Post+");
$result=curl_exec($ch);
curl_close($ch);
print($result);
## End Code
Anyone see the problem/mistake?
Much thx...
--
Nick W
--- End Message ---