php-windows Digest 3 Feb 2003 01:26:38 -0000 Issue 1569

Topics (messages 18298 through 18305):

Re: Selected Value!
        18298 by: Bobo Wieland

Problem closing COM object
        18299 by: Chris Kranz

Re: HEEEELP! CAN'T WRITE ON A FILE
        18300 by: phplam

PHP 4.3.0 vs 4.2.3
        18301 by: Norbert Grüttner

Looping through the mysql_field_name function
        18302 by: Davy Obdam

Re: [PHP] Looping through the mysql_field_name function
        18303 by: Philip Olson

Images-weird!!
        18304 by: Mihail Bota

xml rdf and php
        18305 by: parvez Soobhany

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 ---
Do you get a selection at all? A select-tag should, in xhtml (that i think
everyone should use), look like this:

<select size='1' name='mySelect'>
    <option value='0' selected='selected'>First object</option>
    <option value='1'>Second Object</option>
    ...
    <option value='n'>n Object</option>
</select>

I usually use mysql_fetch_object like this:

<?php
$question = "SELECT * FROM fp_kat ORDER BY kat_name";
$result = mysql_query($question, $link_id);
echo("<select size='1' name='kat'>\n");
while ($fp_kat = mysql_fetch_object($result)) {
    if ($fp_kat->kat_id == $id) {
        echo("\t<option value='".$fp_kat->kat_id."'
selected='selected'>".$fp_kat->kat_name."</option>\n");
    }
    else {
        echo("\t<option
value='".$fp_kat->kat_id."'>".$fp_kat->kat_name."</option>\n");
    }
  echo("</select>\n");
?>

also; have you checked that $id holds the right value? And that it is of the
same type in both the db and in the php code?


. bobo . www.elstudion.com . www.elstudion.com/bobo/ .



"Anthony Judd" <[EMAIL PROTECTED]> skrev i meddelandet
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i have also tried:
>
> function retrieve_category()
>  {
>   $cat = mysql_query("SELECT category_id FROM category");
>   while ($current_row = mysql_fetch_row($cat))
>    {
>        $row = $current_row[0]; //changed here
>        if ($row == $id)
>          {
>            printf("<option selected>%s</option>\n",$current_row[0]);
>          }
>         else
>          {
>            printf("<option>%s</option>\n",$current_row[0]);
>          }
>    }
>  }
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hey there,

I've built a nice little app for a client that will open a COM object,
and save data to an Excel spreadsheet. However, I'm having problems
closing it. It seems to close fine on my laptop, but on my clients
machine, the instance of Excel stays loaded, and multiple instances are
loaded every time the script is run.

I've tried several different methods of closing it, that's why this code
is a little longer than the examples around...

Code:

...
$ex->Application->ActiveWorkbook->Close("False");
$wkb->Release();
$ex->Quit();
$ex->Release();
unset($wkb);
unset($ex);

chris kranz
fatcuban.com


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

I did it !!!!!
I did it !!!!!
I follow your instructions and I did it.
I reinstalled 4.2.3 instead of RC2.
Now, all is right

Thanks a lot. Thanks to you also chris fo

phplam

"Phplam" <[EMAIL PROTECTED]> escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello !
> I'm in a mess. Please help me.
> Every time I tried to write with fwrite or fputs in a file, I get an error
> on windows nt sp6 , ie6 from "Doc. Watson" saying that Apache.exe makes an
> application access error .
> Filesystem functions: is_readable, is_writable,fopen,fclose are ok . I can
> create, find and open the file.
> versions: PHP 4.2.3, APACHE 1.3
> httpd.conf :
>    Alias /test/ "C:/Apache/htdocs/test/"
>
>     <Directory "C:/Apache/htdocs/test">
>         Options Indexes MultiViews
>         AllowOverride None
>         Order allow,deny
>         Allow from all
>     </Directory>
> ----------
> example1:
> // start buffering the output
> ob_start();
> $filename = "c:\\apache\\htdocs\\test\files\\mifile.txt";
> // output format - either "www" or "file"
> $output = "file";
> // print some output
> print "Welcome to the Matrix, Neo";
> // now decide what to do with the buffered output
> if ($output == "www")
> {
>  // either print the contents of the buffer...
>  ob_end_flush();
> }
> else
> {
>  // ... or write it to a file
>  $data = ob_get_contents();
>  chmod ($filename, 0777);
>  $fp = fopen ($filename, "wb+");
> //ERROR IS HERE
>  fwrite($fp, $data);
>  fclose($fp);
>  ob_end_clean();
> }
>
> example 2:
> //I've tried each of the following 5 $filename assignments.
> //$filename = "c:\\apache\\htdocs\\mcm\\mifile.txt";
> //$filename = "/mifile.txt";
> //$filename = "mifile.txt";
> //$filename = "c:\\tmp\\mifile.txt";
> $filename = "c:\\apache\\htdocs\\test\files\\mifile.txt";
> $somecontent = "Add this to the file\n";
> $fp = fopen($filename,"wb");
> // Write $somecontent to our opened file.
> //ERROR IS HERE
>     if (!fwrite($fp, $somecontent)) {
>         print "Cannot write to file ($filename)";
>         exit;
>     }
> fclose($fp);
>
>
>
>
>


--- End Message ---
--- Begin Message ---
Dear NG,

I have developped a small PHP application under W98, PWS and PHP 4.3.0.

Trying to call the PHP modules on my real website i get error message:

PHP Fatal error: Unable to open /php_test.php in Unknown on line 0

The URL in the browsers shows
internet                         //myweb/php_test.php
called on my localhost  //localhost/scripts/php_test.php.

Any ideas what might be wrong? Could it be a problem the my ISP has PHP
4.2.3 installe?

Best regards
  Norbert Gruettner


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

I have a problem that probably very simple, but i cannot figure it out right now....
I need to get the field names of my database. I have a query like select * from books and now i wanna have both the result and the field name. I have been trying with mysql_field_name, but not succesfully...

$i = 0;
for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) {
echo mysql_field_name($db->sqlResult, $i)."<br />";
$i++;
}

Can anyone help me please.. Your help is greatly appreciated;-)

Best regards,

Davy Obdam
mailto:[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
On Sun, 2 Feb 2003, Davy Obdam wrote:

> Hi ppl,
> 
> I have a problem that probably very simple, but i cannot figure it out 
> right now....
> I need to get the field names of my database. I have a query like select 
> * from books and now i wanna have both the result and the field name. I 
> have been trying with mysql_field_name, but not succesfully...
> 
> $i = 0;
> for($a=0; $a < sizeof(mysql_field_name($db->sqlResult, $i)); $a++) {
>     echo mysql_field_name($db->sqlResult, $i)."<br />";
>     $i++;
> }
> 
> Can anyone help me please.. Your help is greatly appreciated;-)

Please read the example in the manual as well as the user
contributed notes.  They show how to do this:

  http://www.php.net/mysql_field_name

See also: mysql_num_fields()

Regards,
Philip

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

If you have time, please run the code below. It is a very simple code
which has 2 nested loops and assigns colors to a given value. If the
product of $i and $j is smaller or equal to 256 (exactly the number of
colors allowed), then  you'll get a random pattern. If this product is
bigger than 256, then the last rows (i.e. all those cells with indexes
bigger than 256) of the rectangle will have the last
color encountered (as if is the 256'th), even though I only have 13
possible colors in the code.

Anybody has an indea to overcome this thing? Am I missing something, or
this is due to a problem in PHP (PHP 4.2.1, Win 2k), or GD?
I spent 3 days on this problem with no avail!

Thanks!

Mihai
 ---
<?php
$image=imageCreate(500,500);
$white=imageColorAllocate($image,255,255,255);
imageFilledRectangle($image,0,0,500,500,$white);
for ($i=0; $i<17; $i++) {
for ($j=0; $j<17; $j++) {
$qq=rand(0,13);
if ($qq==1) {
$vstrong=imageColorAllocate($image, 255, 0, 0);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$vstrong);
}
elseif ($qq==0) {
$nueste=imageColorAllocate($image, 255, 255, 0);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$nueste);
}
elseif ($qq==2) {
$strong=imageColorAllocate($image, 255, 0, 100);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$strong);
}
elseif ($qq==3) {
$smoderate=imageColorAllocate($image, 255, 100, 100);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$smoderate);
}
elseif ($qq==4) {
$moderate=imageColorAllocate($image, 255, 210, 100);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$moderate);
}
elseif ($qq==5) {
$color3=imageColorAllocate($image, 0, 255, 255);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color3);
}
elseif ($qq==6) {
$color4=imageColorAllocate($image, 0, 255, 200);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color4);
}
elseif ($qq==7) {
$color5=imageColorAllocate($image, 0, 100, 255);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color5);
}

elseif ($qq==8) {
$color6=imageColorAllocate($image, 0, 100, 200);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color6);
}
elseif ($qq==9) {
$color7=imageColorAllocate($image, 200, 0, 0);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$color7);
}
elseif ($qq==12) {
$justis=imageColorAllocate($image, 0, 0, 138);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$justis);
}
else {
$ciudat=imageColorAllocate($image, 0, 0, 255);
imagefilledrectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$ciudat);
}

}
}
Header("Content-type: image/png");
imagePNG($image);
imageDestroy($image);
?>
---



--- End Message ---
--- Begin Message ---
hii 
i'm a university student, doing my project on rdf , xml and php. i'm tying to use php 
dom of php3.0 to create xml pages and to add tags...but the functions are not 
functioning...the function are declared as undefined...can any one help
plus, has any one some knowledge about how to to use RDF with PHP, for qurying XML 
pages
--- End Message ---

Reply via email to