[PHP] Including only I want

2002-04-13 Thread Alberto Wagner

Is there any way to include only the lines that I want in an other PHP file?

something like Include();

like lines number 5,6 and 7.

only this ones and not the entire script?




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




Re: RE: [PHP] Including only I want

2002-04-13 Thread Alberto Wagner

But its exactely what I don't want

13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote:

Break those lines out into another file...
=C=
*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Alberto Wagner [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 13, 2002 4:33 AM
To: Php General Mailling List
Subject: [PHP] Including only I want


Is there any way to include only the lines that I want in an other PHP file?

something like Include();

like lines number 5,6 and 7.

only this ones and not the entire script?




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



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








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




Re: RE: RE: [PHP] Including only I want

2002-04-13 Thread Alberto Wagner

I want to make a module system, that open a module and get the first $numberlines of 
it that will be some configuration 
variables, the $numberlines will probably be at top of file, at line 1, then I want to 
script to get the variables and 
execute them in the kernel.php, allowing me to make modules with configs with only one 
file



13/04/2002 12:23:50, Cal Evans [EMAIL PROTECTED] wrote:

I guess it would help if you explained what you are trying to do.  the
answer to your initial question is no.

=C=

*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Alberto Wagner [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 13, 2002 5:09 AM
To: [EMAIL PROTECTED]; Php General Mailling List
Subject: Re: RE: [PHP] Including only I want


But its exactely what I don't want

13/04/2002 11:11:54, Cal Evans [EMAIL PROTECTED] wrote:

Break those lines out into another file...
=C=
*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Alberto Wagner [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 13, 2002 4:33 AM
To: Php General Mailling List
Subject: [PHP] Including only I want


Is there any way to include only the lines that I want in an other PHP
file?

something like Include();

like lines number 5,6 and 7.

only this ones and not the entire script?




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



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








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









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




[PHP] A way to use WWW-Autorization

2002-03-30 Thread Alberto Wagner

I need a good autorizating script that works in any browser an apache server

Alberto
Tkz





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




[PHP] Sql results

2002-03-30 Thread Alberto Wagner

$Sql_Query_Login Returns an empty mysql array like:

$Sql_Query_Login = Mysql_Query(SELECT Nome FROM users WHERE User = 'Anyone')

There isn't a user if name Anyone...

Why

If (!$Sql_Query_Login) {
   Echo Ninguem;
}

Is returning False?




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




Re: [PHP] MySQL Connection Error - mysql_select_db

2002-03-30 Thread Alberto Wagner

31/03/2002 01:02:04, Patrick Hartnett [EMAIL PROTECTED] wrote:

You Need to use the command
Mysql_Select_Db($db_name) Or Die(Unable to connect!);

after connect with mysql

I use something like this:

mysql_connect($db_host, $db_user, $db_pass) or die (Unable to connect!);
Mysql_Select_Db($db_name) Or Die(Unable to connect!);

I don't use a $connection like var.


here is a function used to authenticate users against mysql database.  
Problem is, I am not connecting for some reason.  I have the db variables:
$db_host
$db_user
$db_pass
$db_name

They are populated from an include (x.php) in the beginning of the php 
section.  It is getting past the connect statement, but it is not selecting 
the proper database, and gives a:

Error in query: No Database Selected

in the error trap below (die).  Any ideas what is wrong?  Am I missing some 
syntax, or what?
Thanks.

Patrick

##

function authenticate($user, $pass)
{

   // check login and password
   // connect and execute query
   $connection = mysql_connect($db_host, $db_user, $db_pass) or die (Unable 
to connect!);
   $query = SELECT id from users WHERE username = '$user' AND password = 
PASSWORD('$pass');
   mysql_select_db($db_name);
   //mysql_select_db(devweb); --what it should be, from file
   $result = mysql_query($query, $connection) or die (Error in query:  . 
mysql_error());

   // if row exists - user/pass combination is correct
   if (mysql_num_rows($result) == 1)
   {
   return 1;
   }
   // user/pass combination is wrong
   else
   {
   return 0;
   }
}

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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








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




Re: [PHP] Sql results

2002-03-30 Thread Alberto Wagner

But I Want a way to do something if there isn't any result



31/03/2002 01:52:10, Jason Wong [EMAIL PROTECTED] wrote:

On Sunday 31 March 2002 07:29, Alberto Wagner wrote:
 $Sql_Query_Login Returns an empty mysql array like:

 $Sql_Query_Login = Mysql_Query(SELECT Nome FROM users WHERE User =
 'Anyone')

 There isn't a user if name Anyone...

 Why

 If (!$Sql_Query_Login) {
Echo Ninguem;
 }

 Is returning False?

mysql_query() returns a resource id, which is a *pointer* to the results and 
not the actual results themselves.

To get at the actual results you need to follow up with one of:

mysql_fetch_array()
mysql_fetch_row()
mysql_fetch_assoc()

See manual for details and examples.

Also you should put some error-checking in your code as per the examples in 
the manual.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Bennett's Laws of Horticulture:
   (1) Houses are for people to live in.
   (2) Gardens are for plants to live in.
   (3) There is no such thing as a houseplant.
*/

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








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




[PHP] Why?

2002-03-24 Thread Alberto Wagner

Why everyone uses $foo or $foobar as examples?




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




[PHP] Include Error on PHP 4.1.2

2002-03-23 Thread Alberto Wagner

I can't include anything on my php scripts

Failed opening 'Pagina_Inicial.php' for inclusion (include_path='c:\php4\pear')

How to fix it?




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




Re: [PHP] Select then update

2002-03-23 Thread Alberto Wagner

You need to put {} in the while function like this

while {
do this
}


$query = SELECT name FROM users;
$ret = mysql_query($query);
while(list($name) = mysql_fetch_row($ret)) or die(Error: .mysql_error()) {
print (your name is $name);

$query_update[name] = (UPDATE my_other_table set name = $name);
$result = mysql_query($query_update[name]);
or die(Error: .mysql_error());
};


23/03/2002 20:58:14, Jen Downey [EMAIL PROTECTED] wrote:

Hi all!

Just wondering, If I have a query like:

$query = SELECT name FROM users;
$ret = mysql_query($query);
while(list($name) = mysql_fetch_row($ret)) or die(Error: .mysql_error());
print (your name is $name);

$query_update [name] = (UPDATE my_other_table set name = $name);
$result = mysql_query($query_update[name]);
or die(Error: .mysql_error());

Why wont this work?

I am trying to select the user name from the user table and then update
another table with that user name. But it doesn't seem to want to update the
other table

I get no errors when running the script.

Thanks in advance
Jennifer Downey



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







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



 End of forwarded message 





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