php-general Digest 5 Jan 2003 21:27:01 -0000 Issue 1805 Topics (messages 130302 through 130336):
Re: PHP and MySQL bug
130302 by: Nuno Lopes
array help please
130303 by: John Fishworld
130304 by: David T-G
undefining an array element
130305 by: David T-G
130308 by: Tom Rogers
130309 by: David T-G
'php_network_getaddresses'
130306 by: zzori
undocumented OOP feature/bug?
130307 by: Sean Malloy
130313 by: Jurre Thiel
php_admin values in httpd.conf
130310 by: Jochen Kaechelin
130311 by: Jurre Thiel
130327 by: Jason Wong
Re: security in guest book and user forums
130312 by: Jurre Thiel
Re: Perl > PHP
130314 by: Jurre Thiel
130318 by: Marek Kilimajer
130321 by: Jurre Thiel
130323 by: Mark Charette
Re: counter problem
130315 by: Anthony Ritter
Re: File Modification Date/Time
130316 by: Marek Kilimajer
Re: please help me, y have a error
130317 by: Marek Kilimajer
JPgraph Font Problems
130319 by: Alexandre Soares
[announce] AtomicBoard v0.6.1
130320 by: Vincent Vollers
web reload
130322 by: TACKEL
130325 by: Marek Kilimajer
130326 by: Jason Sheets
130329 by: Marek Kilimajer
Mysql update problems
130324 by: Jesse Lawrence
130328 by: Rick Emery
130330 by: Jason Wong
130331 by: Jesse Lawrence
130332 by: Rick Emery
.doc parsing class or function?
130333 by: James Brennan
130335 by: Sean Burlington
system()
130334 by: Richard Baskett
Re: php4.3.0 & GD library
130336 by: Philip Olson
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 ---
Here is the source code:
<?
@MYSQL_CONNECT("localhost", "nlopes", "testing") or die("Erro 1");
@mysql_select_db("be");
$r=MYSQL_QUERY("SELECT n,u,m,h FROM d WHERE id='$id'");
if (mysql_num_rows($r)=="0") {
die ("Erro");
} else {
$re=mysql_fetch_array($r, MYSQL_NUM);
$nome=$re[0];
$url=$re[1];
$mirrors=$re[2];
$h=$re[3];
$h++;
@MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'"); // this query doesn't
work!!!!
echo "<h2>Seleccione a localiza��o para o download:</h2><p><a
href=\"$url\">Localiza��o Principal</a></p>";
if ($mirrors) {
echo "<p> </p><h2>Mirrors</h2><p>";
$m=explode("�",$mirrors);
foreach ($m as $v) {
$m2=explode("!",$v);
echo "<a href=\"$m2[1]\">$m2[0]</a><br>";
}
echo "</p><p>Nota: Deve escolher o mirror mais pr�ximo da sua localiza��o,
para acelerar o dowload. No caso de um mirror estar indispon�vel, utilize
outro.</p>";
}
}
@MYSQL_CLOSE();
?></body></html>
--- End Message ---
--- Begin Message ---can someone give me a bit of help / walthrough the following for me ! this first bits is okay $mysql query1 result array[cityid][cityname] mysql query2 result array[cityid][cityname] now what i want to do is kick out any doubles in my array and resort them alphebetically by cityname ?! help !--- End Message ---
--- Begin Message ---John, et al -- ...and then John Fishworld said... % % can someone give me a bit of help / walthrough the following for me ! Let's see if I can help. % this first bits is okay % $mysql query1 % result % array[cityid][cityname] % % mysql query2 % result % array[cityid][cityname] Are CityIDs unique, like US-GA-ATL and CN-QC-MON or 214365 and 214387, or is duplication possible? If the IDs are unique then adding duplicates won't cause duplicate entries. % % now what i want to do is kick out any doubles in my array and resort them % alphebetically by cityname ?! Check out array_merge and array_multisort to put the two together and sort on the second key, respectively. % % % help ! HTH & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!--- End Message ---
msg91679/pgp00000.pgp
Description: PGP signature
--- Begin Message ---Hi, all -- If I have an array like $a1 = array ( 'a' => 'aaa' , 'b' => 'bbb' , 'c' => 'ccc' ) ; and I want to completely remove 'b' from it (not just set $a1[b] to ""), how do I undefine that element? TIA & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!--- End Message ---
msg91679/pgp00001.pgp
Description: PGP signature
--- Begin Message ---Hi, Sunday, January 5, 2003, 9:46:05 PM, you wrote: DTG> Hi, all -- DTG> If I have an array like DTG> $a1 = array ( 'a' => 'aaa' , 'b' => 'bbb' , 'c' => 'ccc' ) ; DTG> and I want to completely remove 'b' from it (not just set $a1[b] to ""), DTG> how do I undefine that element? DTG> TIA & HAND DTG> :-D unset($a1['b']); -- regards, Tom--- End Message ---
--- Begin Message ---Tom, et al -- ...and then Tom Rogers said... % % Hi, Hi! % % Sunday, January 5, 2003, 9:46:05 PM, you wrote: % ... % DTG> how do I undefine that element? % % unset($a1['b']); Ah! And here I was looking for 'undefine' (and boy o boy are there a lot of occurrences of *that* in the manual!). % % -- % regards, % Tom Thanks a bunch! & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!--- End Message ---
msg91679/pgp00002.pgp
Description: PGP signature
--- Begin Message ---I didn't wrote english well, Apache 1.3.27 + PHP 4.2.3 Compiled option ./configure --with-apxs=/usr/local/apache/bin/apxs \ --with-config-file-path=/usr/local \ --enable-trans-sid \ --enable-track-vars \ --with-zlib-dir=/usr/lib \ --with-zlib \ --enable-ftp \ --enable-calendar \ --enable-exif \ --with-mcrypt \ --with-mysql \ --disable-debug \ --enable-inline-optimization \ --enable-mailparse \ --with-gd=/usr/local/gd \ --with-freetype-dir=/usr/include/freetype2 \ --enable-freetype-4bit-antialias-hack \ --enable-gd-native-ttf \ --enable-gd-imgstrttf \ --with-ttf \ --with-imap \ --with-imap-ssl \ --with-kerberos \ --with-jpeg-dir=/usr/lib \ --with-png-dir=/usr/lib \ --with-gif-dir=/usr/lib install and works fine all but, <? include "http://URL/cgi-bin/count/zerocount/count.php"; ?> sometimes happened following error system, network, dns checking but all is fine and good work now Warning: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /wecan/USER_ID/HOME_DIR/nemo.html on line 64 Warning: Failed opening 'http://SITE_URL/cgi-bin/count/zerocount/count.php' for inclusion (include_path='.:/usr/local/lib/php') in /wecan/USER_ID/HOME_DIR/nemo.html on line 64 <? include "/cgi-bin/count/zerocount/count.php"; ?> No errors Please Search Google : php_network_getaddresses isn't PHP Problem?? only SYSTEM, Networking??--- End Message ---
--- Begin Message ---
Consider the following code...
class A
{
function Go()
{
switch (isset($this))
{
case true: echo 'Called Dynamically<br />'; break;
case false: echo 'Called Statically<br />'; break;
}
}
}
class B
{
function Go()
{
A::Go();
}
}
A::Go();
$a = new A();
$a->Go();
B::Go();
$b = new B();
$b->Go();
My understanding is that the output should be:
Called Statically
Called Dynamically
Called Statically
Called Statically
Yet the output is actually:
Called Statically
Called Dynamically
Called Statically
Called Dynamically
Now my question is, is this what was intended?
It seems that if you call a static class from within a dynamic instance of a
class, the static class then decides $this should reference the class from
which the static class was called
Anyone else come across this?
It could be useful, but right now, its bloody annoying! I need a class to be
called from within another clas, and it needs to know wether it has had an
instance created, or wether it is being statically called, and now I'll have
to write some kludge code instead...
///////////////////////////////////////////////////////////////////
// Sean Malloy
// Developer
// element
// t: +61 3 9510 7777
// f: +61 3 9510 7755
// m: 0413 383 683
///////////////////////////////////////////////////////////////////
DISCLAIMER:
� copyright protected element digital pty ltd 2002.
the information contained herein is the intellectual property
of element digital pty ltd and may contain confidential material.
you must not disclose, reproduce, copy, or use this information
in any way unless authorised by element digital pty ltd in writing
or except as permitted by any applicable laws including the
copyright act 1968 (cth).
--- End Message ---
--- Begin Message ---
You could check if a variable in $this exists:
class A
{
var $bla;
function Go()
{
switch(isset($this->bla))
{
case true: echo 'Called Dynamicaly<br />'; break;
case true: echo 'Called Statically<br />'; break;
}
}
}
Or, if that doesn't work, you could do this:
class A
{
var $dynamic = true;
function Go()
{
switch(isset($this->bla) && $this->bla == true)
{
case true: echo 'Called Dynamicaly<br />'; break;
case true: echo 'Called Statically<br />'; break;
}
}
}
Or:
class A
{
var $dynamic;
function A()
{
$this->dynamic = true;
}
function Go()
{
switch(isset($this->bla) && $this->bla == true)
{
case true: echo 'Called Dynamicaly<br />'; break;
case true: echo 'Called Statically<br />'; break;
}
}
}
Just some things you could try.
"Sean Malloy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Consider the following code...
>
> class A
> {
> function Go()
> {
> switch (isset($this))
> {
> case true: echo 'Called Dynamically<br />'; break;
> case false: echo 'Called Statically<br />'; break;
> }
> }
> }
>
> class B
> {
> function Go()
> {
> A::Go();
> }
> }
>
> A::Go();
> $a = new A();
> $a->Go();
>
> B::Go();
> $b = new B();
> $b->Go();
>
>
> My understanding is that the output should be:
>
> Called Statically
> Called Dynamically
> Called Statically
> Called Statically
>
> Yet the output is actually:
>
> Called Statically
> Called Dynamically
> Called Statically
> Called Dynamically
>
>
> Now my question is, is this what was intended?
>
> It seems that if you call a static class from within a dynamic instance of
a
> class, the static class then decides $this should reference the class from
> which the static class was called
>
> Anyone else come across this?
>
> It could be useful, but right now, its bloody annoying! I need a class to
be
> called from within another clas, and it needs to know wether it has had an
> instance created, or wether it is being statically called, and now I'll
have
> to write some kludge code instead...
>
>
>
>
> ///////////////////////////////////////////////////////////////////
> // Sean Malloy
> // Developer
> // element
> // t: +61 3 9510 7777
> // f: +61 3 9510 7755
> // m: 0413 383 683
> ///////////////////////////////////////////////////////////////////
>
> DISCLAIMER:
> � copyright protected element digital pty ltd 2002.
> the information contained herein is the intellectual property
> of element digital pty ltd and may contain confidential material.
> you must not disclose, reproduce, copy, or use this information
> in any way unless authorised by element digital pty ltd in writing
> or except as permitted by any applicable laws including the
> copyright act 1968 (cth).
>
--- End Message ---
--- Begin Message ---<snip> > php_admin_flag engine on > php_admin_flag log_errors on > php_admin_value error_reporting 7 > php_flag display_errors on > php_admin_value doc_root /var/www/ HERE WHAT TO WRITE TO HAVE </snip> Where can I find a list of all these php_admin parameters to use in Apaches' httpd.conf? -- Jochen Kaechelin [EMAIL PROTECTED]--- End Message ---
--- Begin Message ---I think they are just the same as in php.ini. "Jochen Kaechelin" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > <snip> > > php_admin_flag engine on > > php_admin_flag log_errors on > > php_admin_value error_reporting 7 > > php_flag display_errors on > > php_admin_value doc_root /var/www/ HERE WHAT TO WRITE TO HAVE > </snip> > > Where can I find a list of all these php_admin parameters to use in > Apaches' httpd.conf? > -- > Jochen Kaechelin > > [EMAIL PROTECTED] >--- End Message ---
--- Begin Message ---
On Sunday 05 January 2003 20:47, Jochen Kaechelin wrote:
> <snip>
>
> > php_admin_flag engine on
> > php_admin_flag log_errors on
> > php_admin_value error_reporting 7
> > php_flag display_errors on
> > php_admin_value doc_root /var/www/ HERE WHAT TO WRITE TO HAVE
>
> </snip>
>
> Where can I find a list of all these php_admin parameters to use in
> Apaches' httpd.conf?
manual > ini_set()
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Hideously disfigured by an ancient Indian curse?
WE CAN HELP!
Call (511) 338-0959 for an immediate appointment.
*/
--- End Message ---
--- Begin Message ---The bad side of this that all other HTML tags than <b> and <i> will be removed. > on 05/01/03 5:24 AM, Seraphim ([EMAIL PROTECTED]) wrote: > > > I use the htmlspecialchars() function to disable all html. This function > > basically puts a '\' in front of eacht html character and thus disables all > > html. > > You may not want to do this if you want to allow, for example <b></b> or > > other friendly html. If so you can use a regex to disable the <script> or > > </table> tags. > > > > Now that I think about it, it might be better to disable all html and later > > enable <i>,<b> etc (or define your own, like a lot of forums seem to do). > > What about striptags()? Designed EXACTLY for disabling HTML tags, except for > a list you allow: > > <? > $text = stiptags($text,'<b><i>'); // allows bold and italics > ?> > > Justin > >--- End Message ---
--- Begin Message ---
That doesn't make any sense and has nothing to do with Perl, since PHP will
magically convert perl.pl to 'perl.pl'. I think you should do something
like:
<?php exec('perl perl.pl'); ?>
Assumming you are on an Unix enviroment and Perl is installed.
"Leif K-Brooks" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Not good at perl, but you need to do:
> <?php exec('perl.pl'); ?>
>
> Sam wrote:
>
> >I don't know what the heck this is but it works:
> >
> >#!/usr/bin/perl
> >
> >$ENV{LD_LIBRARY_PATH} .=":.:..:../lib";
> >$ENV{CLASSPATH} .= ":Verisign.jar:.";
> >print `javac PFProJava.java`;
> >print `java PFProJava test-payflow.verisignscks.com`;
> >
> >How can it be done with PHP?
> >
> >OR
> >
> >run the perl script from a PHP script.
> >
> ><? exec(perl.pl) ?>
> >
> >didn't work.
> >
> >Thanks,
> >Sam
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
--- End Message ---
--- Begin Message ---Jurre Thiel wrote:I think perl will be magically converted to perl and pl to pl, and those two strings concatenatedThat doesn't make any sense and has nothing to do with Perl, since PHP will magically convert perl.pl to 'perl.pl'.
together using . inbetween will be perlpl
--- End Message ---
--- Begin Message ---
Sorry, i didn't think of that. I still think exec('perl perl.pl'); does the
job, not exec('perl.pl');
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> Jurre Thiel wrote:
>
> >That doesn't make any sense and has nothing to do with Perl, since PHP
will
> >magically convert perl.pl to 'perl.pl'.
> >
> I think perl will be magically converted to perl and pl to pl, and those
> two strings concatenated
> together using . inbetween will be perlpl
>
> >
> >
> >
> >
>
--- End Message ---
--- Begin Message ---The first line of the script had the magic incantation: #!/usr/local/bin/perl (or something very similar) which makes the leading 'perl' superfluous. PHP scripts can be made into "self executing" scripts in a similar fashion if the 1st line looks like: #!/path/to/the/php/command/line/executable This only applies to Unix and the executable bit must be set. Mark C. > -----Original Message----- > From: Jurre Thiel [mailto:[EMAIL PROTECTED]] > Sorry, i didn't think of that. I still think exec('perl > perl.pl'); does the > job, not exec('perl.pl'); >>--- End Message ---
--- Begin Message ---Hi Mike, I tried the first script you posted on the NG. This is what happens when I copy and paste your script: The formbox appears. I insert a number. I click submit. The number reverts back to 0. The URL script that you sent me works fine. I'm using MS Win 98/ Apache / PHP 4 Please advise if you get a chance if you know why I can't get this script to work. Thank you. Tony Ritter --- [This E-mail scanned for viruses by gonefishingguideservice.com]--- End Message ---
--- Begin Message ---This should be right, $TimeDiff is in seconds. Christopher J. Crane wrote:Doyou know how to compare time. I would like to get the difference in time
from now to when the file was last accessed.
I was thinking something like this:
<?PHP
$DirToCheck = "tempdata/";
echo "$Now<br><br>\n";
$TimeNow = time();
if ($handle = opendir($DirToCheck)) {
while (false !== ($file = readdir($handle))) {
$FileTimeUnix = fileatime($DirToCheck . $file);
$TimeDiff = $TimeNow - $FileTimeUnix;
echo " $file - Last accessed: " . date("F d Y H:i:s.",
fileatime($DirToCheck . $file)) . " - $TimeDiff<br>\n";
if($TimeDiff > 10000) { unlink($DirToCheck . $file); }
$TimeDiff = 0;
}
closedir($handle);
}
?>
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
you must prepend $DirToCheck to $file:of
filemtime($DirToCheck . $file)
Christopher J. Crane wrote:
I am trying to parse through a directory and get the modification dates
Whatthe file.
<?PHP
$DirToCheck = "tempdata/";
if ($handle = opendir($DirToCheck)) {
while (false !== ($file = readdir($handle))) {
echo " $file - Last Modified: " . date("F d Y H:i:s.",
filemtime($file)) . "<br>\n";
}
closedir($handle);
}
?>
All the files are coming back with a date of December 31 1969 19:00:00.
thanam I doing wrong? The next step is I want to check if the file is older
30 minutes and if so, I want to delete it. How would I go about that?
--- End Message ---
--- Begin Message --- Means php tried to access memory page address it did not have. Try to
find out if it was php itself or a loaded module, then upgrade the offending
part and see if it still happens again.
Ysrael Guzm�n wrote:
this is the message of the ERROR:
PHP has encountered an Access Violation at 012B7DE7
what this????
Ysrael Guzm�n Meza
--- End Message ---
--- Begin Message ---
Hi All,
So I install the jpgraph in Linux RedHat version 8.0, everything
running ok, except examples need special fonts resource, the message follow
bellow:
"Font File "/usr/X11R6/lib/X11/fonts/truetype/arialbd.ttf is not
readable or does not exist"
This problems occour when I execute the ganttext01.php present in
example directory, I know this directory don't exist in my system, but what
the procedure necessery to make this facility work,
Realy Thanks
Alex
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.427 / Virus Database: 240 - Release Date: 12/6/2002
--- End Message ---
--- Begin Message ---Hi, AtomicBoard v0.6.1, an advanced template-based forum system has just been released. please try it, we need your feedback. If you are a PHP developer looking for a challenging and fun project, please have a look at AtomicBoard, we are in need of more developers. have a look at: http://cal007300.student.utwente.nl/atomicboard/ cheers, - Vincent--- End Message ---
--- Begin Message ---
Hi,
I have a php file that set up a cookie that receives from a form and also uses it.
My problem is the first time the value is submitted via form. The cookie is setup
but I cannot not use it so I'd need to reload the web after setting up the cookie.
Myfile.php
if ($form_value != "0"){
setcookie("mycookie",$form_value,time() + 30660);
// Web should be reload here;
}
$cookie = $HTTP_COOKIE_VARS["mycookie"];
Any suggestion?
Thanks,
Tackel.
--- End Message ---
--- Begin Message ---TACKEL wrote:Hi,
I have a php file that set up a cookie that receives from a form and also uses it. My problem is the first time the value is submitted via form. The cookie is setup but I cannot not use it so I'd need to reload the web after setting up the cookie.
Myfile.php
if ($form_value != "0"){
// you should use if(isset($form_value)) {setcookie("mycookie",$form_value,time() + 30660);
$cookie=$form_value; // and no need to reload}
$cookie = $HTTP_COOKIE_VARS["mycookie"];
Any suggestion?
Thanks,
Tackel.
--- End Message ---
--- Begin Message ---
You could use a header() with Location: but why do you need to reload
the page? If you already have your data in $form_value then the data is
already available to you.
If you are using a newer version of PHP (> 4.1) you can reference the
information from the $_COOKIE array as well.
You could do this:
if ($form_value != "0"){
setcookie("mycookie",$form_value,time() + 30660);
$cookie = $form_value;
} elseif (isset($HTTP_COOKIE_VARS["mycookie"])) {
$cookie = $HTTP_COOKIE_VARS["mycookie"];
}
There are a number of other ways you could do it as well but that should
help you think about it.
Jason
On Sun, 2003-01-05 at 09:12, TACKEL wrote:
> Hi,
>
> I have a php file that set up a cookie that receives from a form and also uses it.
> My problem is the first time the value is submitted via form. The cookie is setup
> but I cannot not use it so I'd need to reload the web after setting up the cookie.
>
>
> Myfile.php
>
> if ($form_value != "0"){
> setcookie("mycookie",$form_value,time() + 30660);
> // Web should be reload here;
> }
> $cookie = $HTTP_COOKIE_VARS["mycookie"];
>
>
> Any suggestion?
>
> Thanks,
> Tackel.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message --- Yes, you are right $cookie = $HTTP_COOKIE_VARS["mycookie"]; should be in *else* part
Jason Sheets wrote:
This will always assign the value of $HTTP_COOKIE_VARS["mycookie"] to
$cookie, overwriting the $cookie = $form_value assignment which is what
you want if the page is being reloaded but is not what is desired on the
first page load.
Jason
On Sun, 2003-01-05 at 09:50, Marek Kilimajer wrote:
TACKEL wrote:
Hi,// you should use if(isset($form_value)) {
I have a php file that set up a cookie that receives from a form and also uses it. My problem is the first time the value is submitted via form. The cookie is setup but I cannot not use it so I'd need to reload the web after setting up the cookie.
Myfile.php
if ($form_value != "0"){
setcookie("mycookie",$form_value,time() + 30660);$cookie=$form_value; // and no need to reload
}--
$cookie = $HTTP_COOKIE_VARS["mycookie"];
Any suggestion?
Thanks,
Tackel.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I've been scratching my head over the following code
for a while now. It's supposed to check a given
weblog for specific tags, and if they're present,
update the weblog's table in my database. I believe
the problem is around the execution of the db query,
but I can't seem to get it figured out.
function is_news($address, $blogtitle, $host, $user,
$pass, $dbname){
$f = fopen($address, 'r');
$read = fread($f, 20000);
fclose($f);
$title_start = strpos($read, "<BCtitle>");
$title_end = strpos($read, "</BCtitle>");
$title = substr($read, $title_start, ($title_end -
$title_start));
$blog_start = strpos($read, "<BCblog>");
$blog_end = strpos($read, "</BCblog>");
$blog = substr($read, $blog_start, ($blog_end -
$blog_start));
$link = mysql_connect($host, $user, $pass)
or die("Can't connect to
database");
$query = "update bloggers set cache='$blog',
title='$title' where url='$address'";
if(mysql_db_query ($dbname, $query, $link)) {
$is_news = 1;
}else{
$is_news = 0;
}
return $is_news;
}
Thanks a million for any help,
Jesse Lawrence
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
what appeared when you printed the text of your query:
$query = "update bloggers set cache='$blog', title='$title' where url='$address'";
print $query;
I'm thinking that your single quotes preventd $blog, $title, $address form being
expanded.
----- Original Message -----
From: "Jesse Lawrence" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 05, 2003 10:27 AM
Subject: [PHP] Mysql update problems
I've been scratching my head over the following code
for a while now. It's supposed to check a given
weblog for specific tags, and if they're present,
update the weblog's table in my database. I believe
the problem is around the execution of the db query,
but I can't seem to get it figured out.
function is_news($address, $blogtitle, $host, $user,
$pass, $dbname){
$f = fopen($address, 'r');
$read = fread($f, 20000);
fclose($f);
$title_start = strpos($read, "<BCtitle>");
$title_end = strpos($read, "</BCtitle>");
$title = substr($read, $title_start, ($title_end -
$title_start));
$blog_start = strpos($read, "<BCblog>");
$blog_end = strpos($read, "</BCblog>");
$blog = substr($read, $blog_start, ($blog_end -
$blog_start));
$link = mysql_connect($host, $user, $pass)
or die("Can't connect to
database");
$query = "update bloggers set cache='$blog',
title='$title' where url='$address'";
if(mysql_db_query ($dbname, $query, $link)) {
$is_news = 1;
}else{
$is_news = 0;
}
return $is_news;
}
Thanks a million for any help,
Jesse Lawrence
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---On Monday 06 January 2003 00:27, Jesse Lawrence wrote: > I've been scratching my head over the following code > for a while now. It's supposed to check a given > weblog for specific tags, and if they're present, > update the weblog's table in my database. I believe > the problem is around the execution of the db query, > but I can't seem to get it figured out. [snip] So that other people don't have to scratch their heads as well could you tell us what the problem is? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* You'll wish that you had done some of the hard things when they were easier to do. */--- End Message ---
--- Begin Message --- No, the query is working fine... all variables are printing correctly. This is what has me confused. Everything seems to be as it should, it's just not updating the db table.
Rick Emery wrote:
what appeared when you printed the text of your query:
$query = "update bloggers set cache='$blog', title='$title' where url='$address'";
print $query;
I'm thinking that your single quotes preventd $blog, $title, $address form being expanded.
----- Original Message ----- From: "Jesse Lawrence" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 05, 2003 10:27 AM
Subject: [PHP] Mysql update problems
I've been scratching my head over the following code
for a while now. It's supposed to check a given
weblog for specific tags, and if they're present,
update the weblog's table in my database. I believe
the problem is around the execution of the db query,
but I can't seem to get it figured out.
function is_news($address, $blogtitle, $host, $user,
$pass, $dbname){
$f = fopen($address, 'r');
$read = fread($f, 20000);
fclose($f);
$title_start = strpos($read, "<BCtitle>");
$title_end = strpos($read, "</BCtitle>");
$title = substr($read, $title_start, ($title_end -
$title_start));
$blog_start = strpos($read, "<BCblog>");
$blog_end = strpos($read, "</BCblog>");
$blog = substr($read, $blog_start, ($blog_end -
$blog_start));
$link = mysql_connect($host, $user, $pass) or die("Can't connect to
database");
$query = "update bloggers set cache='$blog',
title='$title' where url='$address'";
if(mysql_db_query ($dbname, $query, $link)) {
$is_news = 1; }else{
$is_news = 0;
}
return $is_news;
}
Thanks a million for any help,
Jesse Lawrence
______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca
--- End Message ---
--- Begin Message ---
Then the problem is in MYSQL. to help determine this, ALWAYS--ALWAYS include the "or
die(mysql_error())" as part of the mysql_query():
mysql_db_query ($dbname, $query, $link) or die("Error: cannot read
table<BR>$query<BR>".mysql_error());
----- Original Message -----
From: "jesse" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 05, 2003 11:50 AM
Subject: Re: [PHP] Mysql update problems
No, the query is working fine... all variables are printing correctly.
This is what has me confused. Everything seems to be as it should, it's
just not updating the db table.
Rick Emery wrote:
> what appeared when you printed the text of your query:
> $query = "update bloggers set cache='$blog', title='$title' where url='$address'";
> print $query;
>
> I'm thinking that your single quotes preventd $blog, $title, $address form being
>expanded.
> ----- Original Message -----
> From: "Jesse Lawrence" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, January 05, 2003 10:27 AM
> Subject: [PHP] Mysql update problems
>
>
> I've been scratching my head over the following code
> for a while now. It's supposed to check a given
> weblog for specific tags, and if they're present,
> update the weblog's table in my database. I believe
> the problem is around the execution of the db query,
> but I can't seem to get it figured out.
>
> function is_news($address, $blogtitle, $host, $user,
> $pass, $dbname){
> $f = fopen($address, 'r');
> $read = fread($f, 20000);
> fclose($f);
> $title_start = strpos($read, "<BCtitle>");
> $title_end = strpos($read, "</BCtitle>");
> $title = substr($read, $title_start, ($title_end -
> $title_start));
>
>
> $blog_start = strpos($read, "<BCblog>");
> $blog_end = strpos($read, "</BCblog>");
> $blog = substr($read, $blog_start, ($blog_end -
> $blog_start));
>
> $link = mysql_connect($host, $user, $pass)
> or die("Can't connect to
> database");
>
> $query = "update bloggers set cache='$blog',
> title='$title' where url='$address'";
> if(mysql_db_query ($dbname, $query, $link)) {
> $is_news = 1;
> }else{
> $is_news = 0;
> }
>
> return $is_news;
>
> }
>
> Thanks a million for any help,
>
> Jesse Lawrence
>
>
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message --- I'm looking to extract the text from user-uploaded .doc files. Has anyone come across a class or function for this? If not, any advice on where I would go to figure out how to write one of my own?
thanks,
loop
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
--- End Message ---
--- Begin Message ---James Brennan wrote:I'm looking to extract the text from user-uploaded .doc files. Has anyone come across a class or function for this? If not, any advice on where I would go to figure out how to write one of my own?
thanks,
loop
search freshmeat.net for antiword its a beuatiful little command line utility -- Sean--- End Message ---
--- Begin Message ---When using the system() function, let's say starting up a program, can that program start in the background while the rest of the page is parsed or does it have to wait until the system command has finished whatever it is doing? Rick "Dost thou love life? Then do not squander time; for that's the stuff life is made of." - Ben Franklin--- End Message ---
--- Begin Message ---On Sun, 5 Jan 2003, thkiat wrote: > Do you kow how can I upgrade the PHP 4.1.1 in PHPTriad to PHP 4.3.0? > I need PHP 4.3.0. as it includes a version of gd (GD Library) as "standard > equipment." GD is not "standard equipment", a "special" version is just bundled in PHP source now. It sounds like you are using windows, this bundling has no affect on the windows distribution as it included all the pre-compiled binaries already, including GD's. In fact, I bet you already have a GD binary and just need to uncomment out in your php.ini but anyway 4.1.1 is old so you should upgrade. Like with any version of PHP you download it and follow the install instructions. http://www.php.net/downloads Regards, Philip--- End Message ---

