php-general Digest 1 Feb 2003 12:21:46 -0000 Issue 1857

Topics (messages 133843 through 133865):

Re: Delete files via PHP
        133843 by: Jason Wong

Re: another problem with 4.3.0 :  imagecreatefromjpeg undefined
        133844 by: Jason Wong

4.3 Install on Solaris
        133845 by: Weston Houghton
        133857 by: Philip Olson

I would like to display a list of the same products only if productPublic = staff or 
members.
        133846 by: Philip J. Newman
        133847 by: Tom Rogers

Screen Size detect??
        133848 by: Dade Register
        133850 by: Maxim Maletsky
        133851 by: Maxim Maletsky
        133856 by: Sean Malloy

Bug?
        133849 by: Todd Barr
        133854 by: Jason Sheets
        133855 by: Sean Malloy

fputs / fwrites ?
        133852 by: Lee Herron
        133853 by: Maxim Maletsky

Re: Unable to upload multiple files
        133858 by: Antti

Re: Introduction
        133859 by: SLanger.spirit21.de
        133860 by: Jason Wong

Re: Strange_session-problem_with_php-file_in_<img_src…
        133861 by: Victor Spĺng Arthursson

question on listbox.
        133862 by: Denis L. Menezes
        133865 by: Jason Wong

Strange problem
        133863 by: Denis L. Menezes

Function Stack
        133864 by: Joshua Moore-Oliva

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 ---
On Saturday 01 February 2003 03:23, Miguel Brás wrote:
> Hey, thx for your speech
>
> In a matter of fact, I have 2 books about  PHP and all they say about the
> unlink function (I use it in my upload system) is that it is suposed to
> force the delete of the temporary file that it is created during the upload
> process.
>
> So, i was never thinking that the unlink fuction was able to do it.

Could you tell us which books they are? They seem to be giving very poor 
advice. Uploaded files are _automatically_ deleted when the script ends. 
There is no need to force deletion of those temporary files.

-- 
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
------------------------------------------
/*
The best laid plans of mice and men are held up in the legal department.
*/

--- End Message ---
--- Begin Message ---
On Friday 31 January 2003 23:22, Robert Mena wrote:
> Hello again,
>
> another problem with 4.3.0. I have gd support but
> after the upgrade my scripts started complaing :
>
> Fatal error: Call to undefined function:
> imagecreatefromjpeg()
>
> My ./configure (the same used for ages).
>
> './configure' '--with-apxs' '--with-ttf' '--with-xml'
> '--with-gd' '--with-ftp' '--enable-session'
> '--enable-trans-sid' '--with-zlib'
> '--enable-inline-optimization' '--with-mcrypt'
> '--enable-sigchild' '--with-config-file-path=/etc' '--with-freetype'

You probably need to add "--with-jpeg-dir" as well (and make sure you really 
do have libjpeg installed).

-- 
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
------------------------------------------
/*
To love is good, love being difficult.
*/

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

I seem to be getting a silly error on Solaris when trying to do a PHP 4.3 make. I get an error that looks to me like the liner arguments are just too long. to be honest, I'm a bit stupified as to why this is happening or how to fix it. FWIW, I have compiled 4.23 just fine on that box.

Thanks,
Wes


p.s. here's the last bit of the error:

/bin/sh libtool --silent --mode=link gcc -export-dynamic -g -O2 -avoid-version -module -L/usr/ucblib -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -L/export/home/oracle/OraHome/lib -R /usr/ucblib -R /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.8.1 -R /export/home/oracle/OraHome/lib ext/ctype/ctype.lo ext/ftp/php_ftp.lo ext/ftp/ftp.lo ext/mysql/php_mysql.lo ext/mysql/libmysql/libmysql.lo ext/mysql/libmysql/errmsg.lo ext/mysql/libmysql/net.lo ext/mysql/libmysql/violite.lo ext/mysql/libmysql/password.lo ext/mysql/libmysql/my_init.lo ext/mysql/libmysql/my_lib.lo ext/mysql/libmysql/my_static.lo ext/mysql/libmysql/my_malloc.lo ext/mysql/libmysql/my_realloc.lo ext/mysql/libmysql/my_create.lo ext/mysql/libmysql/my_delete.lo ext/mysql/libmysql/my_tempnam.lo ext/mysql/libmysql/my_open.lo ext/mysql/libmysql/mf_casecnv.lo ext/mysql/libmysql/my_read.lo ext/mysql/libmysql/my_write.lo ext/mysql/libmysql/errors.lo ext/mysql/libmysql/my_error.lo ext/mysql/libmysql/my_getwd.lo ext/mysql/libmysql/my_div.lo ext/mysql/libmysql/mf_pack.lo ext/mysql/libmysql/my_messnc.lo ext/mysql/libmysql/mf_dirname.lo ext/mysql/libmysql/mf_fn_ext.lo ext/mysql/libmysql/mf_wcomp.lo ext/mysql/libmysql/typelib.lo ext/mysql/libmysql/safemalloc.lo ext/mysql/libmysql/my_alloc.lo ext/mysql/libmysql/mf_format.lo ext/mysql/libmysql/mf_path.lo ext/mysql/libmysql/mf_unixpath.lo ext/mysql/libmysql/my_fopen.lo ext/mysql/libmysql/mf_loadpath.lo ext/mysql/libmysql/my_pthread.lo ext/mysql/libmysql/my_thr_init.lo ext/mysql/libmysql/thr_mutex.lo ext/mysql/libmysql/mulalloc.lo ext/mysql/libmysql/string.lo ext/mysql/libmysql/default.lo ext/mysql/libmysql/my_compress.lo ext/mysql/libmysql/array.lo ext/mysql/libmysql/my_once.lo ext/mysql/libmysql/list.lo ext/mysql/libmysql/my_net.lo ext/mysql/libmysql/dbug.lo ext/mysql/libmysql/strmov.lo ext/mysql/libmysql/strxmov.lo ext/mysql/libmysql/strnmov.lo ext/mysql/libmysql/strmake.lo ext/mysql/libmysql/strend.lo ext/mysql/libmysql/strfill.lo ext/mysql/libmysql/is_prefix.lo ext/mysql/libmysql/int2str.lo ext/mysql/libmysql/str2int.lo ext/mysql/libmysql/strinstr.lo ext/mysql/libmysql/strcont.lo ext/mysql/libmysql/strcend.lo ext/mysql/libmysql/bchange.lo ext/mysql/libmysql/bmove.lo ext/mysql/libmysql/bmove_upp.lo ext/mysql/libmysql/longlong2str.lo ext/mysql/libmysql/strtoull.lo ext/mysql/libmysql/strtoll.lo ext/mysql/libmysql/charset.lo ext/mysql/libmysql/ctype.lo ext/oci8/oci8.lo ext/overload/overload.lo ext/pcre/pcrelib/maketables.lo ext/pcre/pcrelib/get.lo ext/pcre/pcrelib/study.lo ext/pcre/pcrelib/pcre.lo ext/pcre/php_pcre.lo ext/posix/posix.lo ext/session/session.lo ext/session/mod_files.lo ext/session/mod_mm.lo ext/session/mod_user.lo ext/standard/array.lo ext/standard/base64.lo ext/standard/basic_functions.lo ext/standard/browscap.lo ext/standard/crc32.lo ext/standard/crypt.lo ext/standard/cyr_convert.lo ext/standard/datetime.lo ext/standard/dir.lo ext/standard/dl.lo ext/standard/dns.lo ext/standard/exec.lo ext/standard/file.lo ext/standard/filestat.lo ext/standard/flock_compat.lo ext/standard/formatted_print.lo ext/standard/fsock.lo ext/standard/head.lo ext/standard/html.lo ext/standard/image.lo ext/standard/info.lo ext/standard/iptc.lo ext/standard/lcg.lo ext/standard/link.lo ext/standard/mail.lo ext/standard/math.lo ext/standard/md5.lo ext/standard/metaphone.lo ext/standard/microtime.lo ext/standard/pack.lo ext/standard/pageinfo.lo ext/standard/parsedate.lo ext/standard/quot_print.lo ext/standard/rand.lo ext/standard/reg.lo ext/standard/soundex.lo ext/standard/string.lo ext/standard/scanf.lo ext/standard/syslog.lo ext/standard/type.lo ext/standard/uniqid.lo ext/standard/url.lo ext/standard/url_scanner.lo ext/standard/var.lo ext/standard/versioning.lo ext/standard/assert.lo ext/standard/strnatcmp.lo ext/standard/levenshtein.lo ext/standard/incomplete_class.lo ext/standard/url_scanner_ex.lo ext/standard/ftp_fopen_wrapper.lo ext/standard/http_fopen_wrapper.lo ext/standard/php_fopen_wrapper.lo ext/standard/credits.lo ext/standard/css.lo ext/standard/var_unserializer.lo ext/standard/ftok.lo ext/standard/aggregation.lo ext/standard/sha1.lo ext/tokenizer/tokenizer.lo ext/xml/xml.lo ext/xml/expat/xmlparse.lo ext/xml/expat/xmlrole.lo ext/xml/expat/xmltok.lo regex/regcomp.lo regex/regexec.lo regex/regerror.lo regex/regfree.lo TSRM/TSRM.lo TSRM/tsrm_strtok_r.lo TSRM/tsrm_virtual_cwd.lo main/main.lo main/snprintf.lo main/spprintf.lo main/php_sprintf.lo main/safe_mode.lo main/fopen_wrappers.lo main/alloca.lo main/php_ini.lo main/SAPI.lo main/rfc1867.lo main/php_content_types.lo main/strlcpy.lo main/strlcat.lo main/mergesort.lo main/reentrancy.lo main/php_variables.lo main/php_ticks.lo main/streams.lo main/network.lo main/php_open_temporary_file.lo main/php_logos.lo main/output.lo main/memory_streams.lo main/user_streams.lo Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo Zend/zend_ini_scanner.lo Zend/zend_alloc.lo Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo Zend/zend_execute_API.lo Zend/zend_highlight.lo Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo Zend/zend_stack.lo Zend/zend_variables.lo Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo Zend/zend_list.lo Zend/zend_indent.lo Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lresolv -lm -ldl -lnsl -lsocket -lgcc -lcrypt -lnsl -lsocket -lgen -ldl -lsched -lclntsh -o sapi/cli/php
Output line too long.
Output line too long.
Output line too long.
gcc: rege: No such file or directory
make: *** [sapi/cli/php] Error 1

------------------------------------------------------------------------ ---
The selection and placement of letters on this page was
determined automatically by a computer program. Any
resemblance to actual words, sentences, or paragraphs is
pure coincidence, and no liability will be assumed for
such coincidences.
------------------------------------------------------------------------ ---

--- End Message ---
--- Begin Message ---
On Fri, 31 Jan 2003, Weston Houghton wrote:

> 
> All,
> 
> I seem to be getting a silly error on Solaris when trying to do a PHP  
> 4.3 make. I get an error that looks to me like the liner arguments are  
> just too long. to be honest, I'm a bit stupified as to why this is  
> happening or how to fix it. FWIW, I have compiled 4.23 just fine on  
> that box.
[snip]

Are you using the GNU utilities?  PHP requires them, for example,
sed must be of GNU origin.  Same for bison, flex, etc.  This is
a common problem on Solaris these days as it comes with a broken
sed.  GNU good.

Regards,
Philip

--- End Message ---
--- Begin Message ---
I would like to list 2 possable items in a mysql queary.

SELECT * FROM products WHERE productType = '$productType AND Where
productPublic = 'staff' OR productPublic = 'members' ORDER BY productId DESC
LIMIT 10

I would like to display a list of the same products only if productPublic =
staff or members.

At the moment what i have just gives me the 1st 10 items.

Any help




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

Saturday, February 1, 2003, 2:00:51 PM, you wrote:
PJN> I would like to list 2 possable items in a mysql queary.

PJN> SELECT * FROM products WHERE productType = '$productType AND Where
PJN> productPublic = 'staff' OR productPublic = 'members' ORDER BY productId DESC
PJN> LIMIT 10

PJN> I would like to display a list of the same products only if productPublic =
PJN> staff or members.

PJN> At the moment what i have just gives me the 1st 10 items.

PJN> Any help

you need brackets to sort out the logic


SELECT *
 FROM products
 WHERE productType = '$productType AND (productPublic = 'staff' OR productPublic = 
'members')
 ORDER BY productId DESC
 LIMIT 10

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
I'm trying to detect the screen size of any client
browser, or at least IE. Is there a php function that
can do this? If not, does anyone have any ideas on a
JS that would work too? Plz help. Thanx.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--- End Message ---
--- Begin Message ---
There is no way to do that with PHP.

PHP/JavaScript rule #1:

        PHP = Client Side
        JS  = Server Side

Obviously, client's browser is Client Side and PHP, which is Server Side,
cannot be used for detecting Client's properties on page request (page
wasn't prepared by PHP yet to activate any JS).

With JS you can detect screen sizes by using JavaScript `screen' and
`window' objects.  Find them on developer.netscape.com.

The wildest combination of PHP with client's screen sizes would be adding
JS code into a page that sets the width/height (JS) variables as the
page starts loading to then launch an 1x1 pixel image with these two
variables passed as the URL parameters of the image tag and, the image
is actually to be a PHP script which temporarily records it. 

Comparing the sessions of the current page and image's request you would
be able to retrieve the screen size before continuing the page loads,
adjusting the HTML to fit into that very screen.

But, that is only theoretical. Technically it would mean a lot of
trouble. Firstly because you would need to suspend the page load till
when the client requested that image so your server knows the screen
width/height, to then release the rest of thepage to browser. Not all
browsers will support it either and you might end up in a lot of loops
and slow response times/timeouts.

I have once done something silly like that for a project which *really*
depended on it (a videogame). And, I wouldn't do it once again :)

Best solution? Perhaps using an absolute width for HTML tables (100%)
or a fixed (minimal) page width (775 px recommended)

P.S: Hope this email gets read archived and read from there :)

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Fri, 31 Jan 2003 20:48:19 -0800 (PST) Dade Register <[EMAIL PROTECTED]> wrote:

> I'm trying to detect the screen size of any client
> browser, or at least IE. Is there a php function that
> can do this? If not, does anyone have any ideas on a
> JS that would work too? Plz help. Thanx.
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
On Sat, 01 Feb 2003 18:44:19 +0100 Maxim Maletsky <[EMAIL PROTECTED]> wrote:

> There is no way to do that with PHP.
> 
> PHP/JavaScript rule #1:
> 
>       PHP = Client Side
>       JS  = Server Side

Geez.... I mean viceversa :) In Stalin's times I'd get killed for
certain mistakes :)


-- 
Maxim Maletsky
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Create index.htm;

<script language="JavaScript">
var width  = screen.width;
var height = screen.height;
window.location = 'index.php?width=' + width + '&height=' + height;
</script>

and in index.php

$width = $_GET['width'];
$height = $_GET['height'];


etc etc

-----Original Message-----
From: Dade Register [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 1 February 2003 3:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Screen Size detect??


I'm trying to detect the screen size of any client
browser, or at least IE. Is there a php function that
can do this? If not, does anyone have any ideas on a
JS that would work too? Plz help. Thanx.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

--- End Message ---
--- Begin Message ---
Hello all

I am having issues passing vars in the url

example

here is my url
http://localhost/tsatest.php?Sub_Task=2

and here is my code
$link = odbc_connect( 'TSA','','');
$Query = "SELECT * from projects where sub_task='$Sub_Task'";
$Result = odbc_do($link, $Query);

All this returns is a blank screen.....

any suggestions?
--- End Message ---
--- Begin Message ---
Hello Todd,

It sounds like register globals are not enabled and your code relies on
register globals being enabled, register globals now defaults to off.

If you have a recent version of PHP (>= 4.1) you should use the super
globals, most likely you are looking for $_GET.

You could change your code to $Query = "SELECT * from projects where
sub_task='{$_GET['Sub_Task']}'"; which should work.  

You can find out more about the predefined variables at:
http://www.php.net/manual/en/language.variables.predefined.php

If you absolutely need to you can also turn register globals back on
either from php.ini or by using .htaccess.

Jason
On Fri, 2003-01-31 at 22:46, Todd Barr wrote:
> Hello all
> 
> I am having issues passing vars in the url
> 
> example
> 
> here is my url
> http://localhost/tsatest.php?Sub_Task=2
> 
> and here is my code
> $link = odbc_connect( 'TSA','','');
> $Query = "SELECT * from projects where sub_task='$Sub_Task'";
> $Result = odbc_do($link, $Query);
> 
> All this returns is a blank screen.....
> 
> any suggestions?

--- End Message ---
--- Begin Message ---
sounds like you should turn error reporting on

a blank page usually means PHP has encountered an error, but DisplayErrors
is off in php.ini

-----Original Message-----
From: Todd Barr [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 1 February 2003 4:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Bug?


Hello all

I am having issues passing vars in the url

example

here is my url
http://localhost/tsatest.php?Sub_Task=2

and here is my code
$link = odbc_connect( 'TSA','','');
$Query = "SELECT * from projects where sub_task='$Sub_Task'";
$Result = odbc_do($link, $Query);

All this returns is a blank screen.....

any suggestions?

--- End Message ---
--- Begin Message ---
Okay, so I want to open a file, get a small number from it (less than 3
digits) then overwrite a new number (incremented the original by 1) and
close the file.

The goal is to do this in the fastest way possible .. I don't like having to
open the file more than once to do this.

I've tried:
$cfile = fopen("lcnt.txt", 'r+');
$lcnt = fgets($cfile,10);

This results in $lcnt having a value of 1 (from value in text file)

Now, if I increment it:

$nc = $lcnt+1;

then write it back to the file:

$nul = fwrite($cfile, $nc);

It writes starting at where the last read left off -- I want to start at
zero offset so to overwrite the existing value. I can't find a method for
resetting the offset pointer without having to close the file and reopen it
with w+

There must be a simpler way to do this and I have a mental block.


--- End Message ---
--- Begin Message ---
Please, don't hijack(*) the threads.

(*) Hijack a thread - replying to an email from the usergroup modifying
its subject and body making it look like a new post. Emails have also
the in-reply-to headers which make the threads visualize in mail clients
as the follow ups, although was intended as a new thread.

-- 
Maxim Maletsky
[EMAIL PROTECTED]


On Fri, 31 Jan 2003 23:41:12 -0600 "Lee Herron" <[EMAIL PROTECTED]> wrote:

> Okay, so I want to open a file, get a small number from it (less than 3
> digits) then overwrite a new number (incremented the original by 1) and
> close the file.
> 
> The goal is to do this in the fastest way possible .. I don't like having to
> open the file more than once to do this.
> 
> I've tried:
> $cfile = fopen("lcnt.txt", 'r+');
> $lcnt = fgets($cfile,10);
> 
> This results in $lcnt having a value of 1 (from value in text file)
> 
> Now, if I increment it:
> 
> $nc = $lcnt+1;
> 
> then write it back to the file:
> 
> $nul = fwrite($cfile, $nc);
> 
> It writes starting at where the last read left off -- I want to start at
> zero offset so to overwrite the existing value. I can't find a method for
> resetting the offset pointer without having to close the file and reopen it
> with w+
> 
> There must be a simpler way to do this and I have a mental block.
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
You don't even have a "file" form element, or an element named
"userfile" so your FOR loop will never run...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


Yes I do. I just forgot to put it here.

<input class='nappi' size='20' type='file' name='userfile[]'>

-antti


--- End Message ---
--- Begin Message ---
Hello Julie

Have you checked what is passed in your post / get request???

A Simple way of doing this is using a script similar to this one

<?PHP 
        while(list($key, $value) = each($_POST)) // use $_GET for get 
request
        {
                echo '<br>'.$key.'='.$value;  // this prints to the 
browser 
        }
?>

This will show you a simple list of all variables being passed to your 
script. I had a problem once with forms that for empty fields the 
variables were set to
contain an empty string so a call to isset($var) still returns true. Not 
sure how this happend or why but it did...
If you run the above script you can at least see if the form returns the 
variables that are set and what they contain. 
Before I forget don't run this script  before your header() or else you 
will get an error stating that headers have allready been send.

Hope it helps

Stefan Langer

P.S.: As stated before for security reasons it is better to rely on $_POST 
and $_GET global arrays and register_globals turned off.
--- End Message ---
--- Begin Message ---
On Saturday 01 February 2003 17:39, [EMAIL PROTECTED] wrote:
> Hello Julie
>
> Have you checked what is passed in your post / get request???
>
> A Simple way of doing this is using a script similar to this one
>
> <?PHP
>         while(list($key, $value) = each($_POST)) // use $_GET for get
> request
>         {
>                 echo '<br>'.$key.'='.$value;  // this prints to the
> browser
>         }
> ?>

A easier way to achieve the above is simply:

  print_r($_POST);


-- 
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
------------------------------------------
/*
Unix:  Some say the learning curve is steep, but you only have to climb it 
once.
-- Karl Lehenbauer
*/

--- End Message ---
--- Begin Message ---
fredagen den 31 januari 2003 kl 18.08 skrev Chris Shiflett:

Instead of trying to tell us what the problem is, just
explain what trouble you are having. We can then tell *you*
what the problem is.
Could the problem have something to do with the fact that the function that returns the value of the session is called from within another function, and that it's defined outside this function?

Sincerely

Victor

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

I have a listbox which I populate from a query with the database. It is working fine. 
But additinally, I want the first item to be "Select category". Can someone please 
help me how to modify by below written code to do the above?

My code : Quote :


<?php 
    //connecting to the database
$link = mysql_connect("localhost","MyDomain","MyPass");
if ($link){
   Print "";
   }  else {
   Print "No connection to the database";
   }
   if (!mysql_select_db("MyDomain_com")){
    Print "Couldn't connect database";
 } else {
 Print ""."<br>\n";
 }

$sql="SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName";
$result=mysql_query($sql);

While($Category=mysql_fetch_array($result))
 {
 Print("<OPTION VALUE=\"$Category[0]\">$Category[0]\n");
 }

?>

Unquote

Thanks very much

Denis
--- End Message ---
--- Begin Message ---
On Saturday 01 February 2003 19:08, Denis L. Menezes wrote:
> Hello friends.
>
> I have a listbox which I populate from a query with the database. It is
> working fine. But additinally, I want the first item to be "Select
> category". Can someone please help me how to modify by below written code
> to do the above?
>
> My code : Quote :
>
>
> <?php
>     //connecting to the database
> $link = mysql_connect("localhost","MyDomain","MyPass");
> if ($link){
>    Print "";
>    }  else {
>    Print "No connection to the database";
>    }
>    if (!mysql_select_db("MyDomain_com")){
>     Print "Couldn't connect database";
>  } else {
>  Print ""."<br>\n";
>  }

  echo "<option ...";

> $sql="SELECT DISTINCT CategoryName From Categories ORDER BY CategoryName";
> $result=mysql_query($sql);
>
> While($Category=mysql_fetch_array($result))
>  {
>  Print("<OPTION VALUE=\"$Category[0]\">$Category[0]\n");
>  }
>
> ?>
>
> Unquote

-- 
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
------------------------------------------
/*
If you are good, you will be assigned all the work.  If you are real
good, you will get out of it.
*/

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

I have the following script.  Both the errors show green font when actually the first 
error should give a red font. Am I doing something wrong here?

Quote:


if($CategoryName==""){
   Print "<font color=\#FF0000\">You have not entered the category name. Please go 
back and enter the category name.</font>";
   Exit;
   }
   if($password==""){
   Print "<font color=\#00FF00\">You have not entered the password. Please go back and 
enter the password.</font>";
   Exit;
   }


Unquote

Thanks
Denis
--- End Message ---
--- Begin Message ---
Is there any way to access the Function Stack from php?

I would really like it for debugging, ala java style or C debugging style, 
where I could get a list of function like


>From afunction line 83
>From bfunction line 179
>From cfunction line 345

Error here..

If I could somehow access the function stack as an array that woul dbe 
superb!!

Does anyone know if this kind of functionality exists?  Is there a function 
stack in Zend that I could create a module to access?

Josh.
--- End Message ---

Reply via email to