php-general Digest 13 Apr 2001 14:15:39 -0000 Issue 625

Topics (messages 48388 through 48446):

MySQL Results NULL Error
        48388 by: Chris Anderson

Fetch_row
        48389 by: Mike P
        48417 by: Steve Edberg
        48418 by: John Keith

Re: is_null
        48390 by: CC Zona
        48398 by: Plutarck

removing slashes from template file
        48391 by: Franklin Hays
        48400 by: Chris Adams
        48401 by: Franklin Hays
        48402 by: Plutarck
        48403 by: Franklin Hays
        48404 by: Chris Adams

Curser
        48392 by: Mike P

Re: Newsgroups like this one?
        48393 by: Plutarck

Re: Easy News Script
        48394 by: Plutarck
        48431 by: Christian Reiniger

Re: Newbie MySQL Table Work
        48395 by: Plutarck

Re: Problem?
        48396 by: Plutarck

Re: What variable are being sent to my script?
        48397 by: Plutarck
        48426 by: Johannes Janson

Re: no reponse -- Need FTP help
        48399 by: Plutarck
        48405 by: David Minor
        48406 by: trogers
        48407 by: Plutarck
        48430 by: Christian Reiniger

Re: ROUND inconsistency
        48408 by: Yasuo Ohgaki
        48421 by: Yasuo Ohgaki
        48434 by: Sinisa Milivojevic

Getting one of each result from MySQL
        48409 by: Plutarck
        48410 by: Jason N. Perkins
        48411 by: Jason N. Perkins
        48412 by: Jason N. Perkins

crap! look at the mess that i made!
        48413 by: Jason N. Perkins
        48415 by: Plutarck

Re: Do any of you provide hosting?
        48414 by: Richard Kurth
        48419 by: Plutarck

Problem solved, thanks!
        48416 by: Plutarck

return parse error
        48420 by: Peter Harkins
        48422 by: Jeffrey Paul
        48423 by: Yasuo Ohgaki

apache module win32
        48424 by: Dominick Vansevenant
        48425 by: Alexander Wagner
        48429 by: Dominick Vansevenant

Re: [PHP-QA] Looking for users list
        48427 by: Sebastian Bergmann

Re: stdin/stderr
        48428 by: Jake Fan

install question: idiot guide to apache and phph and mysql on win NT 4
        48432 by: Peter Van Dijck
        48436 by: Johannes Janson
        48438 by: Peter Van Dijck

Re: Developing new PHP modules
        48433 by: Bo Kleve

MySQL for translation ?
        48435 by: Marian Vasile
        48440 by: Altunergil, Oktay

getting all variables from session into array
        48437 by: Tobias Talltorp
        48439 by: Rasmus Lerdorf
        48443 by: Tobias Talltorp

Weird Messages upon install upgrade
        48441 by: Chris Aitken

Parsing HTML tags
        48442 by: Chris Empson
        48444 by: Brian Paulson
        48445 by: Tobias Talltorp

Calling Functions without all the arguments
        48446 by: Chris Aitken

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]


----------------------------------------------------------------------


If I grab values from fields and they contain nothing, and I retrieve them using 
mysql_field_array, it will give an index out of range. Is there a way to prevent the 
error or do I have to keep putting a @ in front of the variable declaration?




Can I use Mysql fetch_row to specify which row i want to get? 
Like---$row[5]=mysql_fetch_row($result) ?
Mike P
[EMAIL PROTECTED]




At 2:17 AM +0000 4/13/01, Mike P wrote:
>Can I use Mysql fetch_row to specify which row i want to get?
>Like---$row[5]=mysql_fetch_row($result) ?
>Mike P
>[EMAIL PROTECTED]
>

Are you talking about a specific row in the mySQL result set? If so, 
use the mysql_result() function. However, this function only returns 
one column at a time, so you'd have to loop, something like:

    $i=0;
    unset($row);
    while ($Value = mysql_result($ResultId, 4, $i)) {
       $row[] = $Value;
       $i++;
    }

Note I used row # 4 in the mysql_result() call instead of 5, since 
(I'm 89% sure) row counts are 0-based.

I'm also pretty sure you CANNOT use mysql_result() to position to the 
desired row, then use mysql_fetch_array() or a similar function to 
fetch the whole row.

See

        http://www.php.net/manual/en/function.mysql-result.php

for more info.

You may be able to use the mysql LIMIT functionality to do what you want:

        $Query = 'SELECT * FROM table ORDER BY name LIMIT 4,1';

This grabs the fifth (again, row counts are 0-based) row. See

        http://www.mysql.com/doc/S/E/SELECT.html

Incidentally, your original statement

        $row[5]=mysql_fetch_row($result);

would simply create a 1-element array $row, with the array index 5. 
If this was your first fetch statement, $row[5] would still contain 
the first row of the result set.


        -steve

-- 
+----------- 12 April 2001: Forty years of manned spaceflight -----------+
| Steve Edberg                           University of California, Davis |
| [EMAIL PROTECTED]                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+-------------------------- www.yurisnight.net --------------------------+




[EMAIL PROTECTED] (Mike P) writes:

> Can I use Mysql fetch_row to specify which row i want to get? 
> Like---$row[5]=mysql_fetch_row($result) ?

You might try:

// move row pointer to 5th row
mysql_data_seek ($result, 4); 

// fetch current row
list (...) = mysql_fetch_row ($result);





In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Jennifer) 
wrote:

> I wanted to use is_null, but it isn't available in my version
> (4.0B2)
> 
> What would be an equivalent?  I'm fairly new to PHP.
> 
> I was using isset, but sometimes it is set to Null.
> 
> Null values are unacceptable, but zero is a perfectly acceptable
> value for what I want.

Untested, but I think this should work:

if(empty($val) and $val !==0 and $val !=='')
   {
   echo 'null';
   }

-- 
CC




It doesn't tell you if a variable is actually null, but unless you
specifically need to know if it is actually "NULL", just testing for truth
is usually enough.

For most uses it works fine, but if you really need to know wether or not
it's null, take one of the other suggestions.


For instance, if you need to see if someone submitted something to the
$username variable, use:

if ($username)
{
// stuff
}


--
Plutarck
Should be working on something...
...but forgot what it was.


"Jennifer" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I wanted to use is_null, but it isn't available in my version
> (4.0B2)
>
> What would be an equivalent?  I'm fairly new to PHP.
>
> I was using isset, but sometimes it is set to Null.
>
> Null values are unacceptable, but zero is a perfectly acceptable
> value for what I want.
>
> Jennifer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Asked this earlier but didn't get a response, may have been lost in the
volume or I need to clarify things.  If the latter please let me
know.  Some help is greatly appreciated as I am stuck.

Experiencing a frustrating problem on this end with slashes being added to
my template files.  Here are the details: 

Using PHP on a webhost that compiled php as a cgi in my www/cgi-bin
directory. 

I have all HTML files in templates/filename.tpl and all PHP files in
includes/filename.inc, this includes the template.inc file from PHPLib. 

I have a file called 'script' with the following in it: 

 <?php 
require('includes/Directory.inc'); 
include('includes/Header.inc'); 
// Now parse a second template: 
$t->set_file("MainHandle","MainGadget.tpl"); 
// wholePage.ihtml has "{MyOutput}" in it 
$vari= $t->parse("MyFinalOutput","MainHandle"); 
// All {MyOutput}'s get replaced 
$t->p("MyFinalOutput"); 
// output the value of MyFinalOutput 
/*eval( "?>".$vari );*/ 
include('includes/Footer.inc'); 
?> 

include/Directory.inc has the following in it: 

<?php 
include('includes/Template.inc'); 
$url_array=explode("/",$REQUEST_URI); 
$url_cat=$url_array[3]; 
$url_grp=$url_array[4]; 
$url_misc=$url_array[5]; 
$t = new Template("/www/hostname/ocean/templates/"); 
$title = "name"; 

if($url_misc == 'misc') { 
$Handle='MiscHandle'; 
$Template='MiscGadget.tpl'; 
} 
elseif ($url_grp == 'tanks') { 
$Handle='TankHandle'; 
 $Template='TankGadget.tpl'; 
} 
elseif ($url_cat == 'psupply') { 
// These three lines are the same as the first example: 
$Handle='PowerHandle'; 
$Template='PowerGadget.tpl'; 
} 
elseif ($url_cat == 'purpose') { 
$Handle='PurposeHandle'; 
$Template='PurposeGadget.tpl'; 
} else { 
$Handle='IntroHandle'; 
$Template='IntroGadget.tpl'; 
} 
$t->set_file("$Handle","$Template"); 
$t->set_var("name",$title); 
$t->parse("MyOutput","$Handle"); 
?> 

Now, this setup work without a hitch on my personal development server
where PHP is loaded as a module in Apache. The file called via the
'script' above is loaded into the MainGadget.tpl template and displayed
without a problem. Everything, including javascript, works great. 

Now, I moved this code to the providers server, where the only difference
I can tell is php works as a cgi , and I get output from the HTML files
with slashes added to the HTML, such as: 

<a href=\'about.php\'
onMouseOut=\'MM_swapImgRestore()\" 
onMouseOver=\"MM_swapImage(\'about\',\'\',\'graphics/toolsbar3_01.gif\',1)\"><img
name=\"about\" border=\"0\" src=\"graphics/toolsbar_01.gif\" width=\"105\" 
height=\"35\"></a> 
<a href=\'contact.php\' onMouseOut=\'MM_swapImgRestore()\'
onMouseOver=\'MM_swapImage(\'contact\',\'\',\'graphics/toolsbar3_02.gif\',1)\"><img
name=\"contact\" border=\"0\" src=\"graphics/toolsbar_02.gif\" width=\"96\" 
height=\"35\"></a>

Everything else is output just fine. The only HTML with this in it is the
{MyOutput} files from templates directory (.tpl files). I am not very
familiar with PHPLib but imagine there is some other not so subtle item I
am missing since things work great on my linux/apache/php4 server. 

Any ideas? I have tried using stripslashes() in the 'script' above but get
errors. Is there something unique to the php cgi I am missing? Something
else? 

Any all help is greaty appreciated!! 

Thanks, 

//frank


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







On 12 Apr 2001 19:20:44 -0700, Franklin Hays <[EMAIL PROTECTED]> wrote:
>Any ideas? I have tried using stripslashes() in the 'script' above but get
>errors. Is there something unique to the php cgi I am missing? Something
>else? 

Check your magic quotes settings on both systems using phpinfo(). I bet
magic_quotes_runtime is set on in your provider's settings but not your
development system's php.ini.





Chris,

This is correct.  The provider has the following:

magic_quotes_gpc        ON      ON
magic_quotes_runtime    ON      ON
magic_quotes_sybase     OFF     OFF

and I have:

magic_quotes_gpc        ON      ON
magic_quotes_runtime    OFF     OFF
magic_quotes_sybase     OFF     OFF

Is there anyway I can turn this off locally?  Such as in .htaccess or
within the script itself?

Thanks for the feedback!

//frank
 
|
|Check your magic quotes settings on both systems using phpinfo(). I bet
|magic_quotes_runtime is set on in your provider's settings but not your
|development system's php.ini.
|
|-- 
|PHP General Mailing List (http://www.php.net/)
|To unsubscribe, e-mail: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]
|To contact the list administrators, e-mail: [EMAIL PROTECTED]
|
|





http://us.php.net/manual/en/function.set-magic-quotes-runtime.php


Someone should make the manual search a little better...it couldn't find a
search for "magic" ;(


--
Plutarck
Should be working on something...
...but forgot what it was.


"Franklin Hays" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> Chris,
>
> This is correct.  The provider has the following:
>
> magic_quotes_gpc ON ON
> magic_quotes_runtime ON ON
> magic_quotes_sybase OFF OFF
>
> and I have:
>
> magic_quotes_gpc        ON      ON
> magic_quotes_runtime    OFF     OFF
> magic_quotes_sybase     OFF     OFF
>
> Is there anyway I can turn this off locally?  Such as in .htaccess or
> within the script itself?
>
> Thanks for the feedback!
>
> //frank
>
> |
> |Check your magic quotes settings on both systems using phpinfo(). I bet
> |magic_quotes_runtime is set on in your provider's settings but not your
> |development system's php.ini.
> |
> |--
> |PHP General Mailing List (http://www.php.net/)
> |To unsubscribe, e-mail: [EMAIL PROTECTED]
> |For additional commands, e-mail: [EMAIL PROTECTED]
> |To contact the list administrators, e-mail: [EMAIL PROTECTED]
> |
> |
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>







Thanks to Chris Adams this problem is now solved.  magic_quotes_runtime
was set to ON at my hosting service.  I used
set_magic_quotes_runtime(0) in the top of my script and the site works
like a champ now.  If you want magic quotes to be ON then just use 1
instead.

http://www.php.net/manual/en/function.set-magic-quotes-runtime.php

Thanks Chris!!

//frank 

On Thu, 12 Apr 2001, Franklin Hays wrote:

|Date: Thu, 12 Apr 2001 20:15:32 -0700 (PDT)
|From: Franklin Hays <[EMAIL PROTECTED]>
|To: [EMAIL PROTECTED]
|Subject: [PHP] removing slashes from template file
|
|Asked this earlier but didn't get a response, may have been lost in the
|volume or I need to clarify things.  If the latter please let me
|know.  Some help is greatly appreciated as I am stuck.
|
|Experiencing a frustrating problem on this end with slashes being added to
|my template files.  Here are the details: 
|
|Using PHP on a webhost that compiled php as a cgi in my www/cgi-bin
|directory. 
|
|I have all HTML files in templates/filename.tpl and all PHP files in
|includes/filename.inc, this includes the template.inc file from PHPLib. 
|
|I have a file called 'script' with the following in it: 
|
| <?php 
|require('includes/Directory.inc'); 
|include('includes/Header.inc'); 
|// Now parse a second template: 
|$t->set_file("MainHandle","MainGadget.tpl"); 
|// wholePage.ihtml has "{MyOutput}" in it 
|$vari= $t->parse("MyFinalOutput","MainHandle"); 
|// All {MyOutput}'s get replaced 
|$t->p("MyFinalOutput"); 
|// output the value of MyFinalOutput 
|/*eval( "?>".$vari );*/ 
|include('includes/Footer.inc'); 
|?> 
|
|include/Directory.inc has the following in it: 
|
|<?php 
|include('includes/Template.inc'); 
|$url_array=explode("/",$REQUEST_URI); 
|$url_cat=$url_array[3]; 
|$url_grp=$url_array[4]; 
|$url_misc=$url_array[5]; 
|$t = new Template("/www/hostname/ocean/templates/"); 
|$title = "name"; 
|
|if($url_misc == 'misc') { 
|$Handle='MiscHandle'; 
|$Template='MiscGadget.tpl'; 
|} 
|elseif ($url_grp == 'tanks') { 
|$Handle='TankHandle'; 
| $Template='TankGadget.tpl'; 
|} 
|elseif ($url_cat == 'psupply') { 
|// These three lines are the same as the first example: 
|$Handle='PowerHandle'; 
|$Template='PowerGadget.tpl'; 
|} 
|elseif ($url_cat == 'purpose') { 
|$Handle='PurposeHandle'; 
|$Template='PurposeGadget.tpl'; 
|} else { 
|$Handle='IntroHandle'; 
|$Template='IntroGadget.tpl'; 
|} 
|$t->set_file("$Handle","$Template"); 
|$t->set_var("name",$title); 
|$t->parse("MyOutput","$Handle"); 
|?> 
|
|Now, this setup work without a hitch on my personal development server
|where PHP is loaded as a module in Apache. The file called via the
|'script' above is loaded into the MainGadget.tpl template and displayed
|without a problem. Everything, including javascript, works great. 
|
|Now, I moved this code to the providers server, where the only difference
|I can tell is php works as a cgi , and I get output from the HTML files
|with slashes added to the HTML, such as: 
|
|<a href=\'about.php\'
|onMouseOut=\'MM_swapImgRestore()\" 
|onMouseOver=\"MM_swapImage(\'about\',\'\',\'graphics/toolsbar3_01.gif\',1)\"><img
|name=\"about\" border=\"0\" src=\"graphics/toolsbar_01.gif\" width=\"105\" 
|height=\"35\"></a> 
|<a href=\'contact.php\' onMouseOut=\'MM_swapImgRestore()\'
|onMouseOver=\'MM_swapImage(\'contact\',\'\',\'graphics/toolsbar3_02.gif\',1)\"><img
|name=\"contact\" border=\"0\" src=\"graphics/toolsbar_02.gif\" width=\"96\" 
|height=\"35\"></a>
|
|Everything else is output just fine. The only HTML with this in it is the
|{MyOutput} files from templates directory (.tpl files). I am not very
|familiar with PHPLib but imagine there is some other not so subtle item I
|am missing since things work great on my linux/apache/php4 server. 
|
|Any ideas? I have tried using stripslashes() in the 'script' above but get
|errors. Is there something unique to the php cgi I am missing? Something
|else? 
|
|Any all help is greaty appreciated!! 
|
|Thanks, 
|
|//frank
|
|
|-- 
|PHP General Mailing List (http://www.php.net/)
|To unsubscribe, e-mail: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]
|To contact the list administrators, e-mail: [EMAIL PROTECTED]
|
|
|
|
|-- 
|PHP General Mailing List (http://www.php.net/)
|To unsubscribe, e-mail: [EMAIL PROTECTED]
|For additional commands, e-mail: [EMAIL PROTECTED]
|To contact the list administrators, e-mail: [EMAIL PROTECTED]
|
|





On Thu, Apr 12, 2001 at 09:01:22PM -0700, Franklin Hays wrote:
> 
> Chris,
> 
> This is correct.  The provider has the following:
> 
> magic_quotes_gpc      ON      ON
> magic_quotes_runtime  ON      ON
> magic_quotes_sybase   OFF     OFF
> 
> and I have:
> 
> magic_quotes_gpc        ON      ON
> magic_quotes_runtime    OFF     OFF
> magic_quotes_sybase     OFF     OFF
> 
> Is there anyway I can turn this off locally?  Such as in .htaccess or
> within the script itself?

ini_set("magic_quotes_runtime", "off") would probably work. (There's a
counterpart ini_get() which is also useful). 

Otherwise, .htaccess will also work:
php_flag magic_quotes_runtime off




While Im on the subject ....Is there anything that resembles a recorset 
curser I can use with mysql?
Mike P
[EMAIL PROTECTED]




lol, no problem :)

I might use the mail list anyway...by making a new Message Rule in outlook
express I can stuff the messages over into their own folder.

Then I just list the account last so my important messages get checked
first, and viola.


Someone really should create a listing of techie newsgroups ;)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Alvin Tan"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> yes you're right - i seem to have misread plutarck's mail. apologies ;)
>
> @lvin
>
> -----Original Message-----
> From: John R.Marshall [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 13, 2001 4:04 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Newsgroups like this one?
>
>
> On 11 Apr 2001 21:07:01 -0700 Alvin Tan said...
>
> > Hi Plutarck,
> >
> > The 'mailing list' at MySQL _is_ very much like this one and is also
very
> > active. Send mail to [EMAIL PROTECTED] to subscribe.
>
> Except that it is a *mailing* list not a *newsgroups* format (like
> news.php.net) which was what the Plutark was asking about. ;-)
>
> Personally I don't know how anyone can stand getting this many posts
> cluttering up their mail reader. I'll stick with Gravity thank you very
> much. :-)
>
> And sorry I don't know about any mySQL newsgroups..
>
> --
> John R. Marshall
> JRM Studios.com - http://www.jrmstudios.com
> The Hotrodding Network - http://www.hotrodding.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






It's easy once you get the hang of it.

I use:

// Format of MySQL DATETIME timestamp.
$time = date("Y-m-d H:i:s");

$time is ready for insertion into MySQL. To get the time out though you'll
need to use the unix timestamp function in mysql.

That's a bit tougher to get the hang of :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Zeus"" <[EMAIL PROTECTED]> wrote in message
004e01c0c3b0$5dc7a7c0$1cd218d2@zeus">news:004e01c0c3b0$5dc7a7c0$1cd218d2@zeus...
> True but hehe I can't seem to do it witht he datetime thing.
>
> I'm not sure how am I going to insert the date and time into the mySQL
> database.
>
> ----- Original Message -----
> From: Chris Anderson <[EMAIL PROTECTED]>
> To: Zeus <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, 13 April, 2001 1:27 AM
> Subject: Re: [PHP] Easy News Script
>
>
> > I prefer to write my own
> > ----- Original Message -----
> > From: "Zeus" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, April 12, 2001 10:11 AM
> > Subject: [PHP] Easy News Script
> >
> >
> > I'm sure many of you heard of newsphp ? (the newspro-clone).
> >
> > Somehow I felt attached to it except that it doesn't use databases for
its
> > file storing.
> >
> > Does anyone know a good similar script (easy to setup) that uses mySQL?
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






On Friday 13 April 2001 04:36, you wrote:
> It's easy once you get the hang of it.
>
> I use:
>
> // Format of MySQL DATETIME timestamp.
> $time = date("Y-m-d H:i:s");
>
> $time is ready for insertion into MySQL. To get the time out though
> you'll need to use the unix timestamp function in mysql.

Using MySQL's NOW() function is a bit easier :)

> That's a bit tougher to get the hang of :)

SELECT FROM_UNIXTIME(time_field) AS foo FROM mytable;

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"The number of Unix installations has grown to 10, with more expected."
 -- The Unix Programmer's Manual, 2nd Edition, June 1972




Use the mysql_query as mentioned. You need the CREATE TABLE syntax.

For all your basic SQL syntax ponderings, I found a great site:

http://sqlcourse.com

Helped me out tremendously.

For the create table:

http://sqlcourse.com/create.html


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
000301c0c373$a3522960$b01012d1@null">news:000301c0c373$a3522960$b01012d1@null...
Alright I finally got around to installing MySQL on my cpu, and I
sucessfully created a database. Now I have a reeeeaaaallllyyy dumb question.
In the manual I see no functions for creating tables in a database through
code. Maybe I'm just missing the function. Can someone help me?







Nothing keeping you from doing it, but it can occasionally be a pain to have
everything on just one page without using includes.

I like to take all my function declarations and stick them in another file
(if it's database related I stick it in the database file, or authorization
related goes in the auth file, etc). Then you just include them at the top
of pages where you'll need them.

It really speeds up your scripts because code that won't be used right then
isn't evaluated at all.

But if you want to, say, have a 500 page test script on one page, you could
probably best do it by using includes.

Makes it more readable and faster too, if you aren't going to spit out the
whole thing at once.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Wee Chua" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
> I have a question that can I do my dynamic web application in one page
> without any other hyperlink page if I have all the classes needed to run
the
> dynamic web application? Are there any Pros and Cons for running
application
> on one page? The application is mainly used for ERP. Thank you.
>
> Calvin Chua
> Systems Analyst
> InterClean Equipment, Inc.
> 734-975-2967
> www.InterClean.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Even better, there is a whole PHP function just for that.

I use the following code in scripts where I need to debug the available
variables and their values:

// Print all available variables.
$arr = get_defined_vars();

print_r($arr);


I love print_r ;)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Brandon Orther wrote:
>
> > I there a way for me to find out what variables are being sent to
script?
> > Example:
> > http://www.myscript.com/myscript.php?var1=asdf&var2=asdf
> >
> > that above would be $var1 and $var2
>
>     Stick <? phpinfo() ?> at the end of your script, and go through it so
you
> can see all the nifty variables that PHP sets for you when you pass
arguments
> to it.  Good way to learn too.
>
>     AMK4
>
> --
> W |
>   |  I haven't lost my mind; it's backed up on tape somewhere.
>   |____________________________________________________________________
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
>   SysAdmin / Websmith                           .     800.441.3873 x130
>   Photo Craft Laboratories, Inc.             .        eFax 248.671.0909
>   http://www.pcraft.com                  .         3550 Arapahoe Ave #6
>   .................. .  .  .     .               Boulder, CO 80303, USA
>
>






"Brandon Orther" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I there a way for me to find out what variables are being sent to script?
> Example:
>
> http://www.myscript.com/myscript.php?var1=asdf&var2=asdf
>
> that above would be $var1 and $var2
>

if it is a form with post as method you can use this script to
see all submitted vars:

while (list($key, $value)=each($HTTP_POST_VARS) ) {
    echo "$key = $value <br>";
}

Johannes






Or you could just put a PHP script on the target server that will take the
input via GET and store the data for you. So you don't even have to use FTP.


--
Plutarck
Should be working on something...
...but forgot what it was.


"Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> sure.
>
> keep track of the files on the server drive, then open a connection using
> fopen() and fputs the contents of each file.
>
> On 4/12/01 3:13 PM, "David Minor" <[EMAIL PROTECTED]> wrote:
>
> > Well, I didn't get a response from my previous post, so I'm trying
again.  I
> > need to collect a group of files in a form and ftp them to a different
> > server than the script is located on.  Can this be done? how?
> >
> > Thank you,
> > David Minor
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






hmm, good idea, but the only access I have to the remote machine is ftp.
Can't put a script on it.  I am getting the feeling that I actually have to
move the file(s) from the user's machine to my server and then transfer them
to the FTP site?  I was hoping there would be a way to transfer directly
from the user to the remote FTP site.  But now that I think about it, I
guess probably not.  so the trick would be to let the form upload them to
/tmp and then move them to the remote site.  Takes twice as long. :(  I'm
talking about 10-15 MB at a time while the user waits for confirmation.
That's a long wait (even moving it once).  Any ideas?

dm

Plutarck wrote: 
> 
> Or you could just put a PHP script on the target server that will take the
> input via GET and store the data for you. So you don't even have to use FTP.
> 
> 
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
> 
> 
> "Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> sure.
>> 
>> keep track of the files on the server drive, then open a connection using
>> fopen() and fputs the contents of each file.





Hi
Probably the only way will be with a java applet to do the transfer 
directly to the other host.
Not sure if applets can connect to a host that they did not originate from....
(not done much with java yet :)
Tom


At 11:09 PM 12/04/01 -0500, David Minor wrote:
>hmm, good idea, but the only access I have to the remote machine is ftp.
>Can't put a script on it.  I am getting the feeling that I actually have to
>move the file(s) from the user's machine to my server and then transfer them
>to the FTP site?  I was hoping there would be a way to transfer directly
>from the user to the remote FTP site.  But now that I think about it, I
>guess probably not.  so the trick would be to let the form upload them to
>/tmp and then move them to the remote site.  Takes twice as long. :(  I'm
>talking about 10-15 MB at a time while the user waits for confirmation.
>That's a long wait (even moving it once).  Any ideas?
>
>dm
>
>Plutarck wrote:
> >
> > Or you could just put a PHP script on the target server that will take the
> > input via GET and store the data for you. So you don't even have to use 
> FTP.
> >
> >
> > --
> > Plutarck
> > Should be working on something...
> > ...but forgot what it was.
> >
> >
> > "Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> sure.
> >>
> >> keep track of the files on the server drive, then open a connection using
> >> fopen() and fputs the contents of each file.
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]





You don't have to make the user wait for confirmation.

What you could do if you wanted to be sure to tell the user if the
connection failed or not, is to have him give his email addy for
confirmation. When the file move is done, make a call to mail().

Once you've gotten the file from the user, display a confirmation that the
file was recieved and will now be perminately stored.

Stick your file move code, ftp or whatever, into a function. Then use
http://us.php.net/manual/en/function.register-shutdown-function.php to call
the function.

If the function does it's job properly, have it mail the user with success.
Otherwise you probably want to have it send the error to yourself, or email
the user that the file didn't work.


Only do this all once you are reasonably certain that there are no bugs in
the code. Otherwise if there is an error, you'll never know it!


--
Plutarck
Should be working on something...
...but forgot what it was.


"David Minor" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> hmm, good idea, but the only access I have to the remote machine is ftp.
> Can't put a script on it.  I am getting the feeling that I actually have
to
> move the file(s) from the user's machine to my server and then transfer
them
> to the FTP site?  I was hoping there would be a way to transfer directly
> from the user to the remote FTP site.  But now that I think about it, I
> guess probably not.  so the trick would be to let the form upload them to
> /tmp and then move them to the remote site.  Takes twice as long. :(  I'm
> talking about 10-15 MB at a time while the user waits for confirmation.
> That's a long wait (even moving it once).  Any ideas?
>
> dm
>
> Plutarck wrote:
> >
> > Or you could just put a PHP script on the target server that will take
the
> > input via GET and store the data for you. So you don't even have to use
FTP.
> >
> >
> > --
> > Plutarck
> > Should be working on something...
> > ...but forgot what it was.
> >
> >
> > "Lindsay Adams" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >> sure.
> >>
> >> keep track of the files on the server drive, then open a connection
using
> >> fopen() and fputs the contents of each file.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






On Friday 13 April 2001 06:09, you wrote:
> hmm, good idea, but the only access I have to the remote machine is
> ftp. Can't put a script on it.  I am getting the feeling that I

Er, yes, that's the point :)

You want to move files from host A (webserver with PHP installed) to host 
B (ftp access only), right?
Then you can write a script on A that, using the ftp functions built into 
PHP, transfers the files to B

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"The number of Unix installations has grown to 10, with more expected."
 -- The Unix Programmer's Manual, 2nd Edition, June 1972




MySQL is returning floor. (I'm not a MySQL heavy user, though :)

PHP's result is correct for its function name, I think.
If MySQL returns floor for round(), how about use floor() in PHP?

Regards,
--
Yasuo Ohgaki


"Lee Howard" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Using MySQL 3.23.32 on RedHat Linux 7.0...
>
> MySQL's ROUND function rounds 5 up when the preceding digit is odd and down
> when the preceding digit is even.
>
> mysql> select round(1.5);
> +------------+
> | round(1.5) |
> +------------+
> |          2 |
> +------------+
> 1 row in set (0.00 sec)
>
> mysql> select round(2.5);
> +------------+
> | round(2.5) |
> +------------+
> |          2 |
> +------------+
> 1 row in set (0.00 sec)
>
> I think that this is technically the correct behavior, scientifically,
> anyway.  However, this is not the common "lay-man's" method of rounding,
> which is to always round 5 up, as exhibited by PHP-4.0.4pl1...
>
> <? echo round(1.5); ?>
> <br>
> <? echo round(2.5); ?>
>
> Apache 1.3.14 output for this is:
>
> 2
> 3
>
> This discrepancy causes a difficulty in programming PHP and MySQL together,
> for example, because all of the rounding must be done in either PHP or
> MySQL but not both partially unless you want conflicting data.
>
> I would like to see MySQL ROUND() syntax expand to be ROUND(X,D,M) where
> optional M value indicates the method of rounding, the default being the
> current method.
>
> I would also like to see PHP round() syntax expand to be
> double round (double val [, int precision] [, char method])
> where the optional method value indicates the method of rounding, the
> default being the current method.
>
> Thanks.
>
> Lee Howard
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Correction, MySQL is not returning floor, since it returns 2 for round(1.5). - I
didn't see it.
MySQL should not return 2 for round(2.5), but it should return 3. I think it's
MySQL bug.

How about ask in MySQL mailing list?

--
Yasuo Ohgaki


""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message
9b60qv$v9b$[EMAIL PROTECTED]">news:9b60qv$v9b$[EMAIL PROTECTED]...
> MySQL is returning floor. (I'm not a MySQL heavy user, though :)
>
> PHP's result is correct for its function name, I think.
> If MySQL returns floor for round(), how about use floor() in PHP?
>
> Regards,
> --
> Yasuo Ohgaki
>
>
> "Lee Howard" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Using MySQL 3.23.32 on RedHat Linux 7.0...
> >
> > MySQL's ROUND function rounds 5 up when the preceding digit is odd and down
> > when the preceding digit is even.
> >
> > mysql> select round(1.5);
> > +------------+
> > | round(1.5) |
> > +------------+
> > |          2 |
> > +------------+
> > 1 row in set (0.00 sec)
> >
> > mysql> select round(2.5);
> > +------------+
> > | round(2.5) |
> > +------------+
> > |          2 |
> > +------------+
> > 1 row in set (0.00 sec)
> >
> > I think that this is technically the correct behavior, scientifically,
> > anyway.  However, this is not the common "lay-man's" method of rounding,
> > which is to always round 5 up, as exhibited by PHP-4.0.4pl1...
> >
> > <? echo round(1.5); ?>
> > <br>
> > <? echo round(2.5); ?>
> >
> > Apache 1.3.14 output for this is:
> >
> > 2
> > 3
> >
> > This discrepancy causes a difficulty in programming PHP and MySQL together,
> > for example, because all of the rounding must be done in either PHP or
> > MySQL but not both partially unless you want conflicting data.
> >
> > I would like to see MySQL ROUND() syntax expand to be ROUND(X,D,M) where
> > optional M value indicates the method of rounding, the default being the
> > current method.
> >
> > I would also like to see PHP round() syntax expand to be
> > double round (double val [, int precision] [, char method])
> > where the optional method value indicates the method of rounding, the
> > default being the current method.
> >
> > Thanks.
> >
> > Lee Howard
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Lee Howard writes:
> Using MySQL 3.23.32 on RedHat Linux 7.0...
> 
> MySQL's ROUND function rounds 5 up when the preceding digit is odd and down
> when the preceding digit is even.
> 
> mysql> select round(1.5);
> +------------+
> | round(1.5) |
> +------------+
> |          2 |
> +------------+
> 1 row in set (0.00 sec)
> 
> mysql> select round(2.5);
> +------------+
> | round(2.5) |
> +------------+
> |          2 |
> +------------+
> 1 row in set (0.00 sec)
> 
> I think that this is technically the correct behavior, scientifically,
> anyway.  However, this is not the common "lay-man's" method of rounding,
> which is to always round 5 up, as exhibited by PHP-4.0.4pl1...
> 
>       <? echo round(1.5); ?>
>       <br>
>       <? echo round(2.5); ?>
> 
> Apache 1.3.14 output for this is:
> 
>       2
>       3
> 
> This discrepancy causes a difficulty in programming PHP and MySQL together,
> for example, because all of the rounding must be done in either PHP or
> MySQL but not both partially unless you want conflicting data.
> 
> I would like to see MySQL ROUND() syntax expand to be ROUND(X,D,M) where
> optional M value indicates the method of rounding, the default being the
> current method.
> 
> I would also like to see PHP round() syntax expand to be 
>       double round (double val [, int precision] [, char method])
> where the optional method value indicates the method of rounding, the
> default being the current method.
> 
> Thanks.
> 
> Lee Howard


Hi!

This topic has been covered in all depth on [EMAIL PROTECTED]

Please search the archives on ROUND and you will find all info.


Regards,

Sinisa

      ____  __     _____   _____  ___     ==  MySQL AB
     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Sinisa Milivojevic
    /*/ /*/ /*/   \*\_   |*|   |*||*|     mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Larnaca, Cyprus
  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____
  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^
             /*/             \*\                Developers Team




I need to query a MySQL database with something like: "select guild from
table_name"

I'm going to take "guild" and eventually make a drop-down box with the
information, but that I can handle.

The thing is, I want to have only one entry for each guild, and I want them
to be in alphabetical order.

My current idea is to read all the results into an array with a while loop,
then use array_unique on it, then run sort on that.

Is this really the best way to do it, or am I missing a simpler solution?



--
Plutarck
Should be working on something...
...but forgot what it was.






> The thing is, I want to have only one entry for each guild, and I want
them
> to be in alphabetical order.

try the following sql:
SELECT DISTINCT guild FROM tablename ORDER BY tablename

--

:: jason n. perkins
:: email -> jason[at]somebodydial911.com
:: url -> www.somebodydial911.com
:: "for a vegetarian rents, you're a (obscene gerund, expletive) evil shot."








> The thing is, I want to have only one entry for each guild, and I want
them
> to be in alphabetical order.

try the following sql:
"select distinct guild from tablename order by guild"


--

:: jason n. perkins
:: email -> jason[at]somebodydial911.com
:: url -> www.somebodydial911.com
:: "for a vegetarian rents, you're a (obscene gerund, expletive) evil shot."








> The thing is, I want to have only one entry for each guild, and I want
them
> to be in alphabetical order.


try the following sql:
"select distinct guild from tablename order by guild"


--

:: jason n. perkins
:: email -> jason[at]somebodydial911.com
:: url -> www.somebodydial911.com
:: "for a vegetarian rents, you're a (obscene gerund, expletive) evil shot."








sorry about all the posts...i was getting a message that an error had
occured and my message wouldn't be posted. like a dumbass i took it at face
value...

--

:: jason n. perkins
:: email -> jason[at]somebodydial911.com
:: url -> www.somebodydial911.com
:: "for a vegetarian rents, you're a (obscene gerund, expletive) evil shot."








lmao

No problem. And my problem is solved :)

Thanks to you and John Keith for your quick help. Greatly reduces the amount
of work I need to do in multiple instances!


--
Plutarck
Should be working on something...
...but forgot what it was.


""Jason N. Perkins"" <[EMAIL PROTECTED]> wrote in message
9b64n1$ha4$[EMAIL PROTECTED]">news:9b64n1$ha4$[EMAIL PROTECTED]...
> sorry about all the posts...i was getting a message that an error had
> occured and my message wouldn't be posted. like a dumbass i took it at
face
> value...
>
> --
>
> :: jason n. perkins
> :: email -> jason[at]somebodydial911.com
> :: url -> www.somebodydial911.com
> :: "for a vegetarian rents, you're a (obscene gerund, expletive) evil
shot."
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>







Take a look at northwesthost.com


> I currently am using Thehostpros.com for my hosting, but I can't 
> say its been a pleasant experience. I had to have them install 
> PHP because they are more ASP oriented. So that cost me more. 
> Then I wanted MySQL and they have spent 3 months saying they'll 
> install that. Basicly here's what I need:
> Someone who can host my domain (I own the domain already)
> Can provide MySQL and PHP. Both up-to-date.
> Can give around 60 meg of space (ballpark, less should be fine)
> Also a way to set up subdomains without needing to go through the 
> admin (some hosts can do his). But this isn't necessary.
> Can anyone help with that?
> 
> 




http://cihosts.com/ has always made me drool...you might only be one of
90,000, but they are very very customer-centric.

They'll do anything to make you happy it would seem, but if you get a
dedicated server...you are basically like a little god to them, lol. 24/7
unlimited tech support, as long as they don't have to actually do anything
with your setup. They'll tell you what to do to, say, correctly configure
sendmail, but if they have to do it for you it costs money (obviously).

Still, their ecommerce plan has the most space I've ever seen for such a low
price. 700 megs for 25$ a month *drool*

Plus they charge for bandwidth, which is only believable because they are
the largest DNR/ASP/ISP around. Or at least they are an "industry
leader"...*still drooling over the dedicated servers*


Anyway, for cheaper service I've talked to www.elitehosts.com tech support
and they are quite nice. They also allow unlimited subdomains, email
accounts, and ftp accounts, but their bandwidth and storage space is low.

For $14 you get 50mb and 3gigs of transfer.

If you are looking to pay under $18, there are plenty of good choices, but
for over that I'd go with cihosts. The space they provide is just
monstrous...but I don't know about subdomains.

I couldn't find a mention on subdomains :(

They provide 50 ftp accounts and 10 telnet on the smallest ecommerce
plan...bah, but zero mentions of subdomains. You could always ask :)


--
Plutarck
Should be working on something...
...but forgot what it was.


""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message
000201c0c373$a1d01d40$b01012d1@null">news:000201c0c373$a1d01d40$b01012d1@null...
I currently am using Thehostpros.com for my hosting, but I can't say its
been a pleasant experience. I had to have them install PHP because they are
more ASP oriented. So that cost me more. Then I wanted MySQL and they have
spent 3 months saying they'll install that. Basicly here's what I need:
Someone who can host my domain (I own the domain already)
Can provide MySQL and PHP. Both up-to-date.
Can give around 60 meg of space (ballpark, less should be fine)
Also a way to set up subdomains without needing to go through the admin
(some hosts can do his). But this isn't necessary.
Can anyone help with that?








"distinct" and "order by" are all I need.

Thanks to John Keith and John Perkins for their quick answers!


--
Plutarck
Should be working on something...
...but forgot what it was.


""Plutarck"" <[EMAIL PROTECTED]> wrote in message
9b6229$48j$[EMAIL PROTECTED]">news:9b6229$48j$[EMAIL PROTECTED]...
> I need to query a MySQL database with something like: "select guild from
> table_name"
>
> I'm going to take "guild" and eventually make a drop-down box with the
> information, but that I can handle.
>
> The thing is, I want to have only one entry for each guild, and I want
them
> to be in alphabetical order.
>
> My current idea is to read all the results into an array with a while
loop,
> then use array_unique on it, then run sort on that.
>
> Is this really the best way to do it, or am I missing a simpler solution?
>
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






        This generates a parse error: 
                mysql_connect("localhost", "root", "rootpw") or return("bar"); 
 
        But all the following work fine: 
                mysql_connect("localhost", "root", "rootpw") or die("bar"); 
 
                mysql_connect("localhost", "root", "rootpw") or print("bar"); 
 
                if (!mysql_connect("localhost", "root", "rootpw")) { 
                        return("bar"); 
                } 
 
        Why? mysql_connect returns false on failure either way... I notice die  

and print are functions but return seems not to be, it doesn't have a  
'function.[name].html' file in the manual. *scratches head* I can't see  

any reason in the manual for this behavior. Am I missing something? 
 
        PHP is running on Linux 2.2.19 and identifies as '4.0.2'. phpinfo also 
says:
'./configure' '--with-mysql' '--with-apache=../apache_1.3.12' '--
enable-track-vars' '--disable-debug' '--disable-xml'
         







At 03:56 AM 4/13/2001, Peter Harkins wrote:
>         This generates a parse error:
>                 mysql_connect("localhost", "root", "rootpw") or 
> return("bar");
>
>         But all the following work fine:
>                 mysql_connect("localhost", "root", "rootpw") or die("bar");
>
>                 mysql_connect("localhost", "root", "rootpw") or 
> print("bar");
>
>                 if (!mysql_connect("localhost", "root", "rootpw")) {
>                         return("bar");
>                 }
>
>         Why? mysql_connect returns false on failure either way... I 
> notice die


return isn't a function but a language construct.   This is why the third 
working line with the curlybraces works, and without them it doesn't.

include() is a language construct too.  the particulars of using language 
constructs (like return() and include()) with control structure syntax are 
explained on the page for include().

http://us2.php.net/manual/en/function.include.php

-j (aka sneak)



----------------------------------------------
[EMAIL PROTECTED]      -           0x514DB5CB
he who lives these words shall not taste death
becoming nothing yeah yeah
forever liquid cool





"or" requires expression. "return" is not a expression.
That why you get parse error.

Regards,
--
Yasuo Ohgaki


""Peter Harkins"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> This generates a parse error:
> mysql_connect("localhost", "root", "rootpw") or return("bar");
>
> But all the following work fine:
> mysql_connect("localhost", "root", "rootpw") or die("bar");
>
> mysql_connect("localhost", "root", "rootpw") or print("bar");
>
> if (!mysql_connect("localhost", "root", "rootpw")) {
> return("bar");
> }
>
> Why? mysql_connect returns false on failure either way... I notice die
>
> and print are functions but return seems not to be, it doesn't have a
> 'function.[name].html' file in the manual. *scratches head* I can't see
>
> any reason in the manual for this behavior. Am I missing something?
>
> PHP is running on Linux 2.2.19 and identifies as '4.0.2'. phpinfo also
> says:
> './configure' '--with-mysql' '--with-apache=../apache_1.3.12' '--
> enable-track-vars' '--disable-debug' '--disable-xml'
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Hello,

I am looking for a compiled win32 apache module for php4, I suppose this is
a DLL, can anyone tell me where I can find this? Otherwise I'll have to
install Visual C or something. The more features the better I suppose.

Thanks,

Dominick






Dominick Vansevenant wrote:
> I am looking for a compiled win32 apache module for php4, I suppose
> this is a DLL, can anyone tell me where I can find this? Otherwise
> I'll have to install Visual C or something. The more features the
> better I suppose.

http://www.php4win.de

regards
Wagner

-- 
Assumption is the mother of all fuck-ups.




Thanks, that was fast :-)

D.

-----Original Message-----
From: Alexander Wagner [mailto:[EMAIL PROTECTED]]
Sent: vrijdag 13 april 2001 11:01
To: Dominick Vansevenant; Php-General
Subject: Re: [PHP] apache module win32


Dominick Vansevenant wrote:
> I am looking for a compiled win32 apache module for php4, I suppose
> this is a DLL, can anyone tell me where I can find this? Otherwise
> I'll have to install Visual C or something. The more features the
> better I suppose.

http://www.php4win.de

regards
Wagner

--
Assumption is the mother of all fuck-ups.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Cyril Beaussier wrote:
> I m looking for a list of PHP business web sites
> Yahoo, HP, IBM or Amazon use PHP for its official site?
> Thanks for help

  The QA in php-qa@ does not stand for "Questions & Answers", but for
"Quality Assurance". Please ask your question on the php-general
mailinglist, thank you.

-- 
 sebastian bergmann                            [EMAIL PROTECTED]
                                       http://www.sebastian-bergmann.de

 bonn.phpug.de | www.php.net | www.phpOpenTracker.de | www.titanchat.de




Is there a way to execute a system command and get both stdin and stderr 
into separate variables (without storing either one of them into a temp 
file)?





Apologies if this is off topic, and apologies for double posting to the 
install list! I'm just completely stuck...

for home development I want to install apache and phph and mysql on win NT 4.
It's my first time.
I was trying to find the apache install for win but I can't seem to find it 
here:
http://httpd.apache.org/dist/httpd/
On this page:
http://httpd.apache.org/docs/windows.html
it says:
"You should download the binary build of Apache for Windows named as 
apache_1_3_#-win32-with_src.msi if you are interested in the source code, 
or simply apache_1_3_#-win32-no_src.msi if you don't plan to do anything 
with the source code and appreciate a faster download"

But I can't find that file for download!
Is there any idiot's guide to doing these installs? (I'm going to have to 
turn mod-rewrite on, and maybe a few options for PHP but that will be it)

Thanks for any help! I would really love to get this done this weekend asap...
Peter

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://liga1.com: building multiple language/culture websites





Hi,

I'll spare you from the stuff with stupid question and answers....
http://httpd.apache.org/dist/httpd/binaries/win32/ is the address
to the win32 binary. get 1.3.19 cause some more einvironment variables
are supported. To set the wholee thing up I can recommend this:
http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/
covers the installation of PHP, Apache, MySQL and SSL.

good luck
Johannes

"Peter Van Dijck" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Apologies if this is off topic, and apologies for double posting to the
> install list! I'm just completely stuck...
>
> for home development I want to install apache and phph and mysql on win NT
4.
> It's my first time.
> I was trying to find the apache install for win but I can't seem to find
it
> here:
> http://httpd.apache.org/dist/httpd/
> On this page:
> http://httpd.apache.org/docs/windows.html
> it says:
> "You should download the binary build of Apache for Windows named as
> apache_1_3_#-win32-with_src.msi if you are interested in the source code,
> or simply apache_1_3_#-win32-no_src.msi if you don't plan to do anything
> with the source code and appreciate a faster download"
>
> But I can't find that file for download!
> Is there any idiot's guide to doing these installs? (I'm going to have to
> turn mod-rewrite on, and maybe a few options for PHP but that will be it)
>
> Thanks for any help! I would really love to get this done this weekend
asap...
> Peter
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> http://liga1.com: building multiple language/culture websites
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Ok, I have Apache running, and PHP running.
However, when I look at http://localhost/test.php it works (e.g. phpinfo() 
shows all the info), but I get 3 popups:

"Unable to load dynamic library 'php_pdf.dll' - The specified module could 
not be found."

I click OK

"The dynamic link library isqlt09a.dll could not be found in the specified path
f:\PROGRA~1\APACHE~1\apache\cgi-bin\php;.;C:\WINNT\System32;C:\WINNT\system;C:\WINNT;F:\jdk1.3.0_01\bin\;C:\WINNT\system32;C:\WINNT;."

I click OK

"Unable to load dynamic library 
'F:\PROGRA~1\APACHE~1\Apache\cgi-bin\PHP\EXTENSIONS/php_ifx.dll' - The 
specified module could not be found."

I click OK

So that is weird. Another weird thing is that at the top of any PHP page I 
put there and run, it prijnts to the screen this: "X-Powered-By: PHP/4.0.4 
Content-type: text/html "

Any help / ideas?
Thanks! This is going alright for my first time ever install ... :)
Peter


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://liga1.com: building multiple language/culture websites





There was an article in the January 2001 issue of Webtechniques
(http://www.webtechniques.com) titled "Extending PHP" where Sterling Hughes
builds a module for converting between Roman and Arabic numerals.

/BoK

>"Carlos Serrão" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Hi all,
>>
>> I don't know if I'm in the correct mailling list or not, but
>> could someone provide me with some information about the developement
>> of new PHP modules (documentation, source-code, ...) ?
>>
>> Thanks in advance.
>>
>> Best regards,
>>
>> _____________________________________________________________
>> Carlos Serrão                          [EMAIL PROTECTED]
>>                                  http://www.carlos-serrao.com
>> DCTI - IS/IT Department        IS/IT Research and Development
>> ADETTI/ISCTE - Av.Forcas Armadas     1600-082 LISBOA Portugal
>> Tel.: +351217903064/+351217903901         Fax:  +351217935300

 --------------------------------------------------
 Bo Kleve                   Mail:  [EMAIL PROTECTED]
 Linkoping University       Phone: +46 13 281761
 Sweden                     Fax:   +46 13 284400






I have a web site for online ads.

I want to translate my web site in at least 3 languages.

The main problem is that I don't know which solution I should use...
I have one solution but I think it will slow down my web site...
The solution is:

put all the words (or phrases) in a database and just do some selects in the
database. the table it will look like this (example):
Id     Word        En          Ro
1      Iagree      I agree.    Sunt de acord.

I will select using "Iagree" identifier and I will get the translation in
both languages.

The question is...
It will slow down a lot this procedure in case of a web site full with
pages, search engine, forum, boards etc., and minimum 10.000 visitors a day
?

Thanx a lot

Marian





Why don't you define all of those in seperate text files and include the
correct text file according to the users' preference.

You can take a look at how Mantis (it's a ligthning fast and small Bug
Tracking tool) does this at http://mantisbt.sourceforge.net


Oktay

-----Original Message-----
From: Marian Vasile [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 13, 2001 8:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL for translation ?


I have a web site for online ads.

I want to translate my web site in at least 3 languages.

The main problem is that I don't know which solution I should use...
I have one solution but I think it will slow down my web site...
The solution is:

put all the words (or phrases) in a database and just do some selects in the
database. the table it will look like this (example):
Id     Word        En          Ro
1      Iagree      I agree.    Sunt de acord.

I will select using "Iagree" identifier and I will get the translation in
both languages.

The question is...
It will slow down a lot this procedure in case of a web site full with
pages, search engine, forum, boards etc., and minimum 10.000 visitors a day
?

Thanx a lot

Marian


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




I know this question has been up here before, but all the searches I did
turned up with to many or no hits, so I couldnīt find anything.

I want to get all the variables from a session and get them into an array
like this:

$sessionvar[userid]
$sessionvar[user]
$sessionvar[email]
...

I think I remember something call vardump or something, but I couldīt find
it in the manual.

Any thoughts?
// Tobias






There is already such an array.  It is $HTTP_SESSION_VARS

-Rasmus

On Fri, 13 Apr 2001, Tobias Talltorp wrote:

> I know this question has been up here before, but all the searches I did
> turned up with to many or no hits, so I couldnīt find anything.
>
> I want to get all the variables from a session and get them into an array
> like this:
>
> $sessionvar[userid]
> $sessionvar[user]
> $sessionvar[email]
> ...
>
> I think I remember something call vardump or something, but I couldīt find
> it in the manual.
>
> Any thoughts?
> // Tobias
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Does it act as a "normal" array like:
$array = array(one => "Number One", two => "Number Two");

How would I go about to make this loop work (if I use the above array it
works):

while(list($key, $val) = each($HTTP_SESSION_VARS))

 echo "$key - $val";
}

Regards,
// Tobias Talltorp

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> There is already such an array.  It is $HTTP_SESSION_VARS
>
> -Rasmus
>
> On Fri, 13 Apr 2001, Tobias Talltorp wrote:
>
> > I know this question has been up here before, but all the searches I did
> > turned up with to many or no hits, so I couldnīt find anything.
> >
> > I want to get all the variables from a session and get them into an
array
> > like this:
> >
> > $sessionvar[userid]
> > $sessionvar[user]
> > $sessionvar[email]
> > ...
> >
> > I think I remember something call vardump or something, but I couldīt
find
> > it in the manual.
> >
> > Any thoughts?
> > // Tobias
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi All,

Ive just run into some bizarre problem. I upgraded to a more recent
version of PHP and have run into some bizarre problem.

We were running version 4.0bsomething on a FreeBSD box with Apache and ive
just installed 4.0.3pl1 and ive managed to get pretty much everything
working, except for a couple of sites ive designed im coming up with some
weird errors on functions which  otherwise have been working fine. They
only started appearing when I upgraded the version of PHP.

Here is the errors im getting when I call the page.....

---------------------------------------

Warning: Missing argument 2 for stripe() in /location/to/included/file.php on line 257
Warning: Missing argument 3 for stripe() in /location/to/included/file.php on line 257

---------------------------------------

Now, line 257 looks like this (ive included the rest of the function, but
the first line is line 257)

---------------------------------------

function stripe($title,$bgcolor,$fgcolor) {
        global $darkcolor, $lightcolor;
        if (!$bgcolor && !$fgcolor) {
                $bgcolor="$darkcolor";
                $fgcolor="$lightcolor";
        }
?>
<table BORDER=0 WIDTH="100%" BGCOLOR=<?echo($bgcolor)?>><tr><td>
<b><font color=<?echo($fgcolor)?> size=+1 FACE="helvetica,arial">&nbsp;
<? echo($title) ?></font></b></td></tr></table>
<?

}

-----------------------------------------

This isnt the only function which is causing me problems but this is the
smallest one for an example.

Is there something I havent compiled into PHP properly? or can there be
something else?

Any help on this would be greatly appreciated.



Thanks


Chris






Could anyone tell me how to extract a string from between a pair of HTML 
tags?

Specifically, I would like to extract the page title from between the 
<title> and </title> tags. I have read the regular expression docs and I'm 
still a bit stuck.

Can anyone help?

Thanks in advance, 

Chris Empson

[EMAIL PROTECTED]





I use this function

function title($filename,$dir)
        {
 $loc = "path/to/dir/where/file/is";
    if(is_file("$loc/$filename"))
        {
    $open=fopen("$loc/$filename","r");
                 while(!feof($open))
                   {
            $line=fgets($open,255);
                           $string = $line;
             while(ereg( '<title>([^<]*)</title>(.*)', $string, $regs ) )
                               {
                                   $string = $regs[2];
                                }
                   }
                 return $regs[1];
                }
        }


call it like so

print(title("home.htm","web/articles"));

The only drawback is if there is any < > tags in between the <title></title>
tags it will not get the title, also if the title is on two lines like this

<title>This is the title of
my page</title>

it won't get the title either.

hth

Thank you
Brian Paulson
Sr. Web Developer
[EMAIL PROTECTED]
http://www.chieftain.com
1-800-269-6397

-----Original Message-----
From: Chris Empson [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 13, 2001 8:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Parsing HTML tags


Could anyone tell me how to extract a string from between a pair of HTML
tags?

Specifically, I would like to extract the page title from between the
<title> and </title> tags. I have read the regular expression docs and I'm
still a bit stuck.

Can anyone help?

Thanks in advance,

Chris Empson

[EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







// Get the webpage into a string
$html = join ("", file ("http://www.altavista.com"));

// Using eregi
eregi("<title>(.*)</title>", $html, $tag_contents);

// Using preg_match (faster than eregi)
// The i in the end means that it is a case insensitive match
preg_match("/<title>(.*)<\/title>/i", $html, $tag_contents);

$title = $tag_contents[1];

// Tobias

"Chris Empson" <[EMAIL PROTECTED]> wrote in message
9b6vkl$jpf$[EMAIL PROTECTED]">news:9b6vkl$jpf$[EMAIL PROTECTED]...
> Could anyone tell me how to extract a string from between a pair of HTML
> tags?
>
> Specifically, I would like to extract the page title from between the
> <title> and </title> tags. I have read the regular expression docs and I'm
> still a bit stuck.
>
> Can anyone help?
>
> Thanks in advance,
>
> Chris Empson
>
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






On Fri, 13 Apr 2001, Chris Aitken wrote:

>---------------------------------------
>
>Warning: Missing argument 2 for stripe() in /location/to/included/file.php on line 257
>Warning: Missing argument 3 for stripe() in /location/to/included/file.php on line 257
>
>---------------------------------------
>

Okay, ive managed to do some more playing, and come up with some more
info.

The above error only shows up when I have a function being called without
all the arguments filled in.  For example, if I have a function as
"function blah($foo,$bar)" and call the function with both $foo and $bar
set, it will run just fine. But if I call it with only $foo it comes up
with these errors.

The thing is, the previous version of PHP must have alowed me to call
functions without all the arguments and it never batted an eyelid or gave 
an error.

My question is, is there something I didnt compile into the new PHP, or is
there a line in php.ini file I need to modify so that it doesnt show these
errors up (or should I adjust my code so that I dont call functions
without all the arguments) ?



Chris




Reply via email to