[PHP-DB] PHP & MySQL High CPU on Query

2012-06-12 Thread David Christensen
I have a situation where a query run from PHP/Zend Framework on a MySQL
database seems to hit the CPU harder than the same query run via the
MySQL command line.

The query is a simple SELECT statement querying 2 tables, 12 columns
with a short WHERE clause that filters the results to less than 100
records.

ZF is using the PDO adapter.  I've seen the query cause mysqld to show a
spike up to 50+% cpu while the query is run from a PHP call, and the
same query from the client barely nudges the process to 1%.

Is there something I can do to gather more data on what's going on and
why this is happening?  I'd expect some overhead, but that much of a
difference seems wrong.

Thanks for your advice,

David Christensen

=

This electronic mail is solely for the use of the intended recipient, 
and may contain information that is privileged, 
confidential and exempt from disclosure under applicable law. 
If the reader of this message is not the intended recipient 
– whether as addressed or as should reasonably be surmised by the reader – 
you are hereby notified that any dissemination, distribution or copying of this 
electronic mail 
or any attachment is strictly prohibited. 
If you have received this communication in error, 
please do not print, copy, retransmit, disseminate or otherwise use the 
information 
contained herein or attached hereto and notify us immediately 
by replying to the electronic mail address listed above. 
After notifying us, please delete the copy you received. 
Thank you.


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



[PHP-DB] [PHP] mySQL query assistance...

2010-11-29 Thread Daniel P. Brown
On Mon, Nov 29, 2010 at 14:35, Don Wieland  wrote:
> Hi all,
>
> Is there a list/form to get some help on compiling mySQL queries? I am
> executing them via PHP, but do not want to ask for help here if it is no the
> appropriate forum. Thanks ;-)

   Yes.

   For MySQL queries, write to the MySQL General list at
my...@lists.mysql.com.  For PHP-specific database questions (for any
database backend, not strictly MySQL), such as problems in connecting
to the database, questions on support for database platform/version,
or even query processing, you should use php...@lists.php.net.

   For your convenience, both have been CC'd on this email.

--

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/



-- 

Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Peter Lind
On 29 April 2010 16:44, Alexander Schunk  wrote:
> Hello,
>
> i have it now as follows:
>
> while($dbbenutzer = mysql_fetch_assoc($sqlbenutzername))
>        while($dbpasswort = mysql_fetch_assoc($sqlpasswort)){

You have things very twisted. Check the code posted by Karl - you only
need *ONE* row containing your *TWO* fields. mysql_fetch_assoc()
retrieves that *ONE* row from a MySQL result set as an array - so
having those two while statements will do you no good.

Regards
Peter


-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Karl DeSaulniers

Yes. You are correct. Did not include that part, sry.
Dont forget mysql_real_escape_string.
:)

Karl


On Apr 29, 2010, at 9:37 AM, Peter Lind wrote:


On 29 April 2010 15:00, Karl DeSaulniers  wrote:

Hi,
Maybe try...

$benutzername = $_GET['username'];
$pass = $_GET['password'];

$result = "SELECT * FROM usertable WHERE  
sqlbenutzername='$benutzername'";


Don't use values from $_GET without sanitizing first. If using mysql_*
functions, sanitize with mysql_real_escape_string() first.


while($r = mysql_fetch_row($result)) {
   $dbbenutzer = $r["sqlbenutzername"];
   $dbpasswort = $r["sqlpasswort"];
}
  if($benutzername == $dbbenutzer && $pass == $dbpasswort){


This would work but only if you're storing passwords in the database
in clear text - which is a Bad Thing and should be avoided. Hash the
passwords before storing and compare with a hashed version, not the
cleartext.

Regards
Peter

--

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Peter Lind
On 29 April 2010 15:00, Karl DeSaulniers  wrote:
> Hi,
> Maybe try...
>
> $benutzername = $_GET['username'];
> $pass = $_GET['password'];
>
> $result = "SELECT * FROM usertable WHERE sqlbenutzername='$benutzername'";

Don't use values from $_GET without sanitizing first. If using mysql_*
functions, sanitize with mysql_real_escape_string() first.

> while($r = mysql_fetch_row($result)) {
>        $dbbenutzer = $r["sqlbenutzername"];
>        $dbpasswort = $r["sqlpasswort"];
> }
>       if($benutzername == $dbbenutzer && $pass == $dbpasswort){

This would work but only if you're storing passwords in the database
in clear text - which is a Bad Thing and should be avoided. Hash the
passwords before storing and compare with a hashed version, not the
cleartext.

Regards
Peter

-- 

WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51


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



Re: [PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Karl DeSaulniers

Hi,
Maybe try...

$benutzername = $_GET['username'];
$pass = $_GET['password'];

$result = "SELECT * FROM usertable WHERE  
sqlbenutzername='$benutzername'";

while($r = mysql_fetch_row($result)) {
$dbbenutzer = $r["sqlbenutzername"];
$dbpasswort = $r["sqlpasswort"];
}
   if($benutzername == $dbbenutzer && $pass == $dbpasswort){
 echo 'Sie haben sich erfolgreich angemeldet';
 echo 'Willkommen';


Karl

On Apr 29, 2010, at 7:25 AM, Alexander Schunk wrote:


Hello,

i am writing a small login script for a website.

The username and passwort are stored in a database in two separate  
columns.


I have it like this:

while($dbbenutzer = mysql_fetch_row($sqlbenutzername))
while($dbpasswort = mysql_fetch_row($sqlpasswort)){


   echo $dbbenutzer[$i];
   echo $dbpasswort[$j];
   if($benutzername == $dbbenutzer and $pass == $dbpasswort){
 echo 'Sie haben sich erfolgreich angemeldet';
 echo 'Willkommen';
  }
}

   }

Sice the values are entries in rows in two columns, i use
mysql_fetch_row to get the entries.

Then i want to compare the returned values of the sql statement with
the values provided by the user.

My problem now is only get the first value pair of username and
passwort, not the second.
For instance the first value pair is moritz 123456 which i get
returned but i dont get returned the second value pair thomas thorr.

thank you
yours sincerly
Alexander Schunk

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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



[PHP-DB] php mysql comparing two rows in two columns for username and passwort

2010-04-29 Thread Alexander Schunk
Hello,

i am writing a small login script for a website.

The username and passwort are stored in a database in two separate columns.

I have it like this:

while($dbbenutzer = mysql_fetch_row($sqlbenutzername))
while($dbpasswort = mysql_fetch_row($sqlpasswort)){


   echo $dbbenutzer[$i];
   echo $dbpasswort[$j];
   if($benutzername == $dbbenutzer and $pass == $dbpasswort){
 echo 'Sie haben sich erfolgreich angemeldet';
 echo 'Willkommen';
  }
}

   }

Sice the values are entries in rows in two columns, i use
mysql_fetch_row to get the entries.

Then i want to compare the returned values of the sql statement with
the values provided by the user.

My problem now is only get the first value pair of username and
passwort, not the second.
For instance the first value pair is moritz 123456 which i get
returned but i dont get returned the second value pair thomas thorr.

thank you
yours sincerly
Alexander Schunk

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



[PHP-DB] php mysql calendar

2009-08-04 Thread nikos
Hello list
Can someone suggest me a php mysql calender, easy configurable for
special needs?
I found some googling but the most of them query records form a specific
table and its impossible to change the sql query.
Thank you in advance
Nikos


Re: [PHP-DB] PHP- Mysql problem

2009-06-28 Thread Gary
Daniel,

Now that is just funny stuff...

Have you tried

http://lmgtfy.com/?q=access+denied+for+user+odbc+localhost

or the newer

http://www.lmbify.com/search.php?s=access+denied+for+user+odbc+localhost




"Daniel Brown"  wrote in message 
news:ab5568160906180636r239f214eh7e4871da7139c...@mail.gmail.com...
> On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN
> NADARAJAH wrote:
>>
>> Warning: mysql_query() [function.mysql-query]: Access denied for user 
>> 'ODBC'@'localhost' (using password: NO) in 
>> C:\wamp\www\ap_v5\inc\profile.inc.php on line 285
>
> http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO)
>
> http://fart.ly/dm6m7
>
> -- 
> 
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 



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



Re: [PHP-DB] PHP- Mysql problem

2009-06-18 Thread Daniel Brown
On Thu, Jun 18, 2009 at 06:03, NADARAJAH SIVASUTHAN
NADARAJAH wrote:
>
> Warning: mysql_query() [function.mysql-query]: Access denied for user 
> 'ODBC'@'localhost' (using password: NO) in 
> C:\wamp\www\ap_v5\inc\profile.inc.php on line 285

http://google.com/search?q=Access%20denied%20for%20user%20'ODBC'@'localhost'%20(using%20password:%20NO)

http://fart.ly/dm6m7

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP-DB] PHP- Mysql problem

2009-06-18 Thread Bastien Koert
On Thu, Jun 18, 2009 at 6:03 AM, NADARAJAH SIVASUTHAN
NADARAJAH wrote:
>
>
>
> Dear all,
>
>        When I try to retrive data from two tables using JOIN OR INNER JOIN it 
> display error message
>
> given below;
>
>
>
> Warning: mysql_query() [function.mysql-query]: Access denied for user 
> 'ODBC'@'localhost' (using password: NO) in 
> C:\wamp\www\ap_v5\inc\profile.inc.php on line 285
>
> Warning: mysql_query() [function.mysql-query]: A link to the server could not 
> be established in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285
>
> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result 
> resource in C:\wamp\www\ap_v5\inc\profile.inc.php on line 288
>
>
>
>
>
> what may be the reason?
>
>
>
> Normally PHP-mysql works fine.
>
> Can you figure it out and give me the possible solution?
>
>
>
> Thank you.
>
> suthan
>
>
>
> _
> Windows Live™: Keep your life in sync. Check it out!
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009

The db user account that you are attempting the connection with does
not have access to the db. Check the account details

-- 

Bastien

Cat, the other other white meat

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



[PHP-DB] PHP- Mysql problem

2009-06-18 Thread NADARAJAH SIVASUTHAN NADARAJAH

 

Dear all,

When I try to retrive data from two tables using JOIN OR INNER JOIN it 
display error message

given below;

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 
'ODBC'@'localhost' (using password: NO) in 
C:\wamp\www\ap_v5\inc\profile.inc.php on line 285

Warning: mysql_query() [function.mysql-query]: A link to the server could not 
be established in C:\wamp\www\ap_v5\inc\profile.inc.php on line 285

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result 
resource in C:\wamp\www\ap_v5\inc\profile.inc.php on line 288

 

 

what may be the reason?

 

Normally PHP-mysql works fine.

Can you figure it out and give me the possible solution?

 

Thank you.

suthan

 

_
Windows Live™: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009

Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Chris

Micah Gersten wrote:

Chris wrote:

Micah Gersten wrote:

Chris wrote:

Micah Gersten wrote:

Which is the fastest driver for this?
ADODB
PDO
mysqli

Either mysqli or pdo since they'd deal with the mysql client directly.

ADODB is a php library, so it's not going to be as fast because you
have php code overhead.


ADODB is precompiled for PHP5.   Do you know of any tests?

It's a dll or .so file?



On Linux, it's an .so file, yes:
http://packages.debian.org/lenny/i386/php5-adodb/filelist


Didn't know that :) Cool.

--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Micah Gersten
Chris wrote:
> Micah Gersten wrote:
>> Chris wrote:
>>> Micah Gersten wrote:
 Which is the fastest driver for this?
 ADODB
 PDO
 mysqli
>>> Either mysqli or pdo since they'd deal with the mysql client directly.
>>>
>>> ADODB is a php library, so it's not going to be as fast because you
>>> have php code overhead.
>>>
>>
>> ADODB is precompiled for PHP5.   Do you know of any tests?
>
> It's a dll or .so file?
>

On Linux, it's an .so file, yes:
http://packages.debian.org/lenny/i386/php5-adodb/filelist

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




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



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Chris

YVES SUCAET wrote:

How does the "default" php_mysql.dll compare to these? Is mysqli faster than
mysql?


I'd call that a native driver.

No idea about mysqli vs mysql.

--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Chris

Micah Gersten wrote:

Chris wrote:

Micah Gersten wrote:

Which is the fastest driver for this?
ADODB
PDO
mysqli

Either mysqli or pdo since they'd deal with the mysql client directly.

ADODB is a php library, so it's not going to be as fast because you
have php code overhead.



ADODB is precompiled for PHP5.   Do you know of any tests?


It's a dll or .so file?

--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Micah Gersten
Chris wrote:
> Micah Gersten wrote:
>> Which is the fastest driver for this?
>> ADODB
>> PDO
>> mysqli
>
> Either mysqli or pdo since they'd deal with the mysql client directly.
>
> ADODB is a php library, so it's not going to be as fast because you
> have php code overhead.
>

ADODB is precompiled for PHP5.   Do you know of any tests?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



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



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread YVES SUCAET
How does the "default" php_mysql.dll compare to these? Is mysqli faster than
mysql?

tia,

Yves

-- Original Message --
Received: Wed, 19 Nov 2008 04:00:46 PM CST
From: Chris <[EMAIL PROTECTED]>
To: Micah Gersten <[EMAIL PROTECTED]>Cc: PHP DB 
Subject: Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

Micah Gersten wrote:
> Which is the fastest driver for this?
> ADODB
> PDO
> mysqli

Either mysqli or pdo since they'd deal with the mysql client directly.

ADODB is a php library, so it's not going to be as fast because you have 
php code overhead.

-- 
Postgresql & php tutorials
http://www.designmagick.com/


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






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



Re: [PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Chris

Micah Gersten wrote:

Which is the fastest driver for this?
ADODB
PDO
mysqli


Either mysqli or pdo since they'd deal with the mysql client directly.

ADODB is a php library, so it's not going to be as fast because you have 
php code overhead.


--
Postgresql & php tutorials
http://www.designmagick.com/


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



[PHP-DB] PHP MySQL Driver Choice -- Fastest?

2008-11-19 Thread Micah Gersten
Which is the fastest driver for this?
ADODB
PDO
mysqli
Anything else?

-- 


Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-20 Thread Evert Lammerts
I should've checked the assumption.

A little strange though for a scripting language. I'd say, since
default behaviour of mysql_* functions is to assume the last opened
link when a parameter is not passed, and since default behaviour is to
evaluate null, false and 0 the same, mysql_* functions should issue a
warning when a not valid link is passed but still use the last opened
link (in that logic, null should also generate a warning though). I'm
guessing the reason is that mysql_connect returns false when it fails,
but i can't see a reason why an undefined variable cannot be used.

All that and I don't remember what it was for.

On Fri, Jun 20, 2008 at 1:57 AM, Chris <[EMAIL PROTECTED]> wrote:
>
>> [new code]
>> if (!mysql_connect($a, $b, $c)) return;
>>
>> if (!mysql_select_db($dbname)) return;
>>
>> $res = mysql_query("SELECT * FROM manual;", $link);
>> [/new code]
>
>
> Isn't going to work because $link is not defined and definitely not a
> resource like mysql_query expects.
>
>> OR, optionally, to surpress the warnings:
>>
>> [new code]
>> if (!mysql_connect($a, $b, $c)) return;
>>
>> $link = null;
>>
>> if (!mysql_select_db($dbname)) return;
>>
>> $res = mysql_query("SELECT * FROM manual;", $link);
>> [/new code]
>
> Isn't going to work because mysql_query needs a resource to connect to.
> You've defined $link as null.
>
> $ cat test.php
>  $user = 'my_db_user';
> $pass = 'my_pass';
> $host = 'localhost';
> $db = 'my_db';
>
> error_reporting(E_ALL);
> ini_set('display_errors', true);
>
> if (!mysql_connect($host, $user, $pass)) {
>die("unable to connect");
> }
>
> if (!mysql_select_db($db)) {
>die("unable to choose db");
> }
>
> $link = null;
> $res = mysql_query('select version() as version', $link);
> while ($row = mysql_fetch_assoc($res)) {
>print_r($row);
> }
>
>
> $ php test.php
>
> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> resource in /path/to/test.php on line 19
>
> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL
> result resource in /path/to/test.php on line 20
>
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-19 Thread Chris

> [new code]
> if (!mysql_connect($a, $b, $c)) return;
> 
> if (!mysql_select_db($dbname)) return;
> 
> $res = mysql_query("SELECT * FROM manual;", $link);
> [/new code]


Isn't going to work because $link is not defined and definitely not a
resource like mysql_query expects.

> OR, optionally, to surpress the warnings:
> 
> [new code]
> if (!mysql_connect($a, $b, $c)) return;
> 
> $link = null;
> 
> if (!mysql_select_db($dbname)) return;
> 
> $res = mysql_query("SELECT * FROM manual;", $link);
> [/new code]

Isn't going to work because mysql_query needs a resource to connect to.
You've defined $link as null.

$ cat test.php
http://www.designmagick.com/

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-19 Thread bateivan

Eric,

You gessed right. Both of the files are in my "docroot" directory.
I tried this. Unfortunely, it did not work ( perhaps, I did not use it
right), although, I followed your instructions.

Isaak gave me an idea which solved my problem (see his replies).

Thank you


Eric-275 wrote:
> 
> 
> 
> http://myprojects.srhost.info
> eric{at}myprojects{dot}srhost{dot}info
> - Original Message - 
> From: "bateivan" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, June 17, 2008 11:19 PM
> Subject: [PHP-DB] PHP-MySQL connection for particular module
> 
> 
> : 
> : Hello,
> : 
> : First of all, please, have in mind that I am new in this business.
> : 
> : I have a problem connecting with data base in one particular module.
> That's
> : right. The rest of the modules can connect to db, update tables with new
> : info but this one is refusing giving me message like this:
> : 
> : "Warning: mysql_query() [function.mysql-query]: Access denied for user
> : 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache
> Software
> : Foundation\Apache2.2\htdocs\login.php on line 17
> : 
> 
> This error message state that you have provided a wrong username and / or
> password
> use the die also to ensure the connection was created.
> 
> : Warning: mysql_query() [function.mysql-query]: A link to the server
> could
> : not be established in
> : D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php
> on
> : line 17"
> : 
> : 
> : It is a authentication module and this is the fragment of the code which
> is
> : giving me a hard time:
> : 
> :
> ***
> :  : include $_SERVER['DOCUMENT_ROOT'].
> : '/layout.php';
> : 
> 
> Let's your included page on the same directory. Say f:\webroot\docroot
> As
> f:\webroot\docroot\layout.php
> f:\webroot\docroot\login.php
> 
> then try change the line from
> 
>  include $_SERVER['DOCUMENT_ROOT'].
>  '/layout.php';
> 
> to
> 
> $app_root = './';
>  include ($app_root . 'layout.php');
> 
> 
> : switch($_REQUEST['req']){ 
> :
> : case "validate":
> : 
> :$validate = mysql_query("SELECT * FROM members
> :WHERE username = '{$_POST['username']}'
> :AND password = md5('{$_POST['password']}')"
> :);
> : 
> : etc
> : 
> :
> ***
> : 
> : My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can
> see
> : my program files are on D:\. All this may not be important but I listed
> : anyway.
> : It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
> : replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.
> : 
> : I am using persisten connection which should be on until you restart the
> : server. I have a file included in every page for connection with MySQL
> and
> : data base.
> : PHP manual says that "mysql_query" reuses the existing connection or try
> to
> : create one if not present (I think, according to the warning is trying
> to
> : create one).
> : I had been checking after each step using phpinfo() if the connection is
> : there and it's there but for some reason the above fragment does not
> work.
> : As I mentioned above the rest of my modules are working fine with mysql.
> : 
> : I checked the "php.ini" file. I compared it to "php.ini.recomended" from
> the
> : .zip distribusion package and they are almost identical exept couple of
> : things for error reporting.
> : I, also checked FAQ, mail listings and other forums but it does not seem
> : anybody had a similar problem.
> : 
> : In one of my tests I included a line for connection just before the
> problem
> : lines, as described below, and it worked but my intention is to keep
> such
> : lines in a separate files and include them in every page instead.
> : 
> :
> ***
> : ...
> : 
> : $link = mysql_pconnect('localhost', 'root', 'testing');
> : 
> : 
> :$validate = mysql_query("SELECT * FROM members
> :WHERE username = '{$_POST['username']}'
> :AND password = md5('{$_POST[

Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-19 Thread Isaak Malik
It's great that you got your problem solved :).

On Thu, Jun 19, 2008 at 12:30 PM, bateivan <[EMAIL PROTECTED]> wrote:

>
> Hello Isaak,
>
> You've scored the bulleye! It works!
> Also, I tested by including "common.php" instead of "database.php" and it
> worked too.
> This solution is perfect for me as I can keep my code compact and tidy.
>
> I would, definetely, recommend this site to my fellow developers.
>
> Thank you very much, Isaak and all the rest of the guys who took interst in
> my problem.
> Best regards.
>
>
> Isaak Malik-3 wrote:
> >
> > To Evert:
> >
> > 4. I am posting some of my code to compare. Module "carmade.php" works
> > v.s.
> > "login.php" which does not. Also, I am posting my "database.php" which is
> > establishing the connection and is included in every page through
> > "layout.php"->"common.php"->"database.php".
> >
> > To bateivan:
> >
> > I can only guess that the database.php file isn't correctly loaded via
> > layout.php, did you already try to include database.php into the module
> in
> > which it wasn't working? If so and it works then the issue is probably
> > caused by incorrectly including that file, otherwise it has to be
> > something
> > else...
> >
> > And register_globals allows you to use short variables for super global
> > arrays. Ex: $name instead of $_POST['name'], etc.
> >
> >
> > On Wed, Jun 18, 2008 at 9:47 PM, Evert Lammerts <
> [EMAIL PROTECTED]>
> > wrote:
> >
> >> Pastebin works lots better when you're posting code: www.pastebin.com
> >>
> >> I don't see your database.php included in both of these modules. Where
> >> do you include it?
> >>
> >> EVert
> >>
> >> On Wed, Jun 18, 2008 at 9:38 PM, bateivan <[EMAIL PROTECTED]> wrote:
> >> >
> >> > Hello,
> >> >
> >> > To answer these qwestions:
> >> > 1. I am using "include" in my code.
> >> > 2. About the "$link = mysql_connect('localhost', 'root', 'testing');"
> >> > variable. I can just include this line before mysql_query function and
> >> it
> >> > works even without entering into mysql_query the "$link" variable.
> >> (Like
> >> the
> >> > connection is waking up).
> >> > 3.My php.ini register_globals is off as suggested for new versions of
> >> PHP
> >> > but include file should work instead according to the manual.
> >> > 4. I am posting some of my code to compare. Module "carmade.php" works
> >> v.s.
> >> > "login.php" which does not. Also, I am posting my "database.php" which
> >> is
> >> > establishing the connection and is included in every page through
> >> > "layout.php"->"common.php"->"database.php".
> >> >
> >> > carmade.php:
> >> >  >> > include $_SERVER['DOCUMENT_ROOT'].
> >> >'/layout.php';
> >> >
> >> > // Quick Login session check
> >> > login_check();
> >> >
> >> > switch($_REQUEST['req']){
> >> >   // Insert Case
> >> >   case "create_carmade":
> >> > myheader("Добавяне на автомобилни марки в списъка");
> >> >
> >> > // Double check form posted values are there
> >> > // before performing INSERT query
> >> > if(!$_POST['car_descr']){
> >> > echo 'Липсва информациятя от формата!'.
> >> > 'Моля, използвайте бутона'.
> >> > 'Назад и въведете данните отново!';
> >> >  footer();
> >> > exit();
> >> > }
> >> >
> >> > // Insert Query
> >> > $sql = mysql_query("INSERT INTO carmade
> >> > (car_descr)
> >> > VALUES('{$_POST['car_descr']}')");
> >> >
> >> > // Insert query results
> >> > if(!$sql){
> >> > echo "Грешка при въвеждане на данните:".mysql_error();
> >> > } else {
> >> >
> >> > echo 'Марката "'.$_POST['car_descr'].
> >> > '"е въведенас номер:'.mysql_insert_id();
> >> > echo ' /admin/carmade.php?req=new_carmade Искате ли да'.
> >> >'въведете друга марка? ';
> >> > }
> >> >   break;
> >> >
> >> >   // Create car made form case
> >> >   case "new_carmade":
> >> >  myheader("Въвеждане на нова автомобилна марка");
> >> >  include $_SERVER['DOCUMENT_ROOT'].
> >> >  '/html/forms/carmade_insert.html';
> >> >  footer();
> >> >   break;
> >> >
> >> >   default:
> >> >  myheader("Администриране на списъка с автомобилните марки");
> >> >  include $_SERVER['DOCUMENT_ROOT'].
> >> >  '/html/carmade_admin.html';
> >> >  footer();
> >> >   break;
> >> >
> >> > }
> >> > ?>
> >> >
> >> > login.php:
> >> >  >> > include $_SERVER['DOCUMENT_ROOT'].
> >> >'/layout.php';
> >> >
> >> >
> >> > switch($_REQUEST['req']){
> >> >
> >> > case "validate":
> >> >
> >> >   $validate = mysql_query("SELECT * FROM members
> >> >   WHERE username = '{$_POST['username']}'
> >> >   AND password = md5('{$_POST['password']}')"
> >> >   );
> >> >
> >> >   $num_rows = mysql_num_rows($validate);
> >> >
> >> >   if($num_rows == 1){
> >> >  while($row = mysql_fetch_assoc($validate)){
> >> > 

Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-19 Thread bateivan

Hello Isaak,

You've scored the bulleye! It works!
Also, I tested by including "common.php" instead of "database.php" and it
worked too.
This solution is perfect for me as I can keep my code compact and tidy.

I would, definetely, recommend this site to my fellow developers.

Thank you very much, Isaak and all the rest of the guys who took interst in
my problem.
Best regards.


Isaak Malik-3 wrote:
> 
> To Evert:
> 
> 4. I am posting some of my code to compare. Module "carmade.php" works
> v.s.
> "login.php" which does not. Also, I am posting my "database.php" which is
> establishing the connection and is included in every page through
> "layout.php"->"common.php"->"database.php".
> 
> To bateivan:
> 
> I can only guess that the database.php file isn't correctly loaded via
> layout.php, did you already try to include database.php into the module in
> which it wasn't working? If so and it works then the issue is probably
> caused by incorrectly including that file, otherwise it has to be
> something
> else...
> 
> And register_globals allows you to use short variables for super global
> arrays. Ex: $name instead of $_POST['name'], etc.
> 
> 
> On Wed, Jun 18, 2008 at 9:47 PM, Evert Lammerts <[EMAIL PROTECTED]>
> wrote:
> 
>> Pastebin works lots better when you're posting code: www.pastebin.com
>>
>> I don't see your database.php included in both of these modules. Where
>> do you include it?
>>
>> EVert
>>
>> On Wed, Jun 18, 2008 at 9:38 PM, bateivan <[EMAIL PROTECTED]> wrote:
>> >
>> > Hello,
>> >
>> > To answer these qwestions:
>> > 1. I am using "include" in my code.
>> > 2. About the "$link = mysql_connect('localhost', 'root', 'testing');"
>> > variable. I can just include this line before mysql_query function and
>> it
>> > works even without entering into mysql_query the "$link" variable.
>> (Like
>> the
>> > connection is waking up).
>> > 3.My php.ini register_globals is off as suggested for new versions of
>> PHP
>> > but include file should work instead according to the manual.
>> > 4. I am posting some of my code to compare. Module "carmade.php" works
>> v.s.
>> > "login.php" which does not. Also, I am posting my "database.php" which
>> is
>> > establishing the connection and is included in every page through
>> > "layout.php"->"common.php"->"database.php".
>> >
>> > carmade.php:
>> > > > include $_SERVER['DOCUMENT_ROOT'].
>> >'/layout.php';
>> >
>> > // Quick Login session check
>> > login_check();
>> >
>> > switch($_REQUEST['req']){
>> >   // Insert Case
>> >   case "create_carmade":
>> > myheader("Добавяне на автомобилни марки в списъка");
>> >
>> > // Double check form posted values are there
>> > // before performing INSERT query
>> > if(!$_POST['car_descr']){
>> > echo 'Липсва информациятя от формата!'.
>> > 'Моля, използвайте бутона'.
>> > 'Назад и въведете данните отново!';
>> >  footer();
>> > exit();
>> > }
>> >
>> > // Insert Query
>> > $sql = mysql_query("INSERT INTO carmade
>> > (car_descr)
>> > VALUES('{$_POST['car_descr']}')");
>> >
>> > // Insert query results
>> > if(!$sql){
>> > echo "Грешка при въвеждане на данните:".mysql_error();
>> > } else {
>> >
>> > echo 'Марката "'.$_POST['car_descr'].
>> > '"е въведенас номер:'.mysql_insert_id();
>> > echo ' /admin/carmade.php?req=new_carmade Искате ли да'.
>> >'въведете друга марка? ';
>> > }
>> >   break;
>> >
>> >   // Create car made form case
>> >   case "new_carmade":
>> >  myheader("Въвеждане на нова автомобилна марка");
>> >  include $_SERVER['DOCUMENT_ROOT'].
>> >  '/html/forms/carmade_insert.html';
>> >  footer();
>> >   break;
>> >
>> >   default:
>> >  myheader("Администриране на списъка с автомобилните марки");
>> >  include $_SERVER['DOCUMENT_ROOT'].
>> >  '/html/carmade_admin.html';
>> >  footer();
>> >   break;
>> >
>> > }
>> > ?>
>> >
>> > login.php:
>> > > > include $_SERVER['DOCUMENT_ROOT'].
>> >'/layout.php';
>> >
>> >
>> > switch($_REQUEST['req']){
>> >
>> > case "validate":
>> >
>> >   $validate = mysql_query("SELECT * FROM members
>> >   WHERE username = '{$_POST['username']}'
>> >   AND password = md5('{$_POST['password']}')"
>> >   );
>> >
>> >   $num_rows = mysql_num_rows($validate);
>> >
>> >   if($num_rows == 1){
>> >  while($row = mysql_fetch_assoc($validate)){
>> > $_SESSION['login'] = true;
>> > $_SESSION['userid'] = $row['member_id'];
>> > $_SESSION['first_name'] = $row['first_name'];
>> > $_SESSION['last_name']  = $row['last_name'];
>> > $_SESSION['email_address'] = $row['email_address'];
>> >
>> > if($row['admin_access'] == 1){
>> >$_SESSION['admin_access'] = true;
>> > }
>> > $login_time = m

Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-19 Thread Evert Lammerts
What you said wasn't wrong - you'd just produce a couple of warnings.
By taking away the assignment of the $link variable you're unsetting
it, meaning it will have a value equal to NULL. All of the following
should work.

[old code]
if (!($link = mysql_connect($a, $b, $c))) return;

if (!mysql_select_db($dbname)) return;

$res = mysql_query("SELECT * FROM manual;", $link);
[/old code]

[new code]
if (!mysql_connect($a, $b, $c)) return;

if (!mysql_select_db($dbname)) return;

$res = mysql_query("SELECT * FROM manual;", $link);
[/new code]

OR, optionally, to surpress the warnings:

[new code]
if (!mysql_connect($a, $b, $c)) return;

$link = null;

if (!mysql_select_db($dbname)) return;

$res = mysql_query("SELECT * FROM manual;", $link);
[/new code]

Evert

On Thu, Jun 19, 2008 at 9:12 AM, Isaak Malik <[EMAIL PROTECTED]> wrote:
> My mistake then, it's been a while that I used it that way so some things do
> fade away from my mind.
>
> On Thu, Jun 19, 2008 at 1:57 AM, Chris <[EMAIL PROTECTED]> wrote:
>
>> Isaak Malik wrote:
>> > Because then the connection resource isn't stored in the $link variable
>> > and you will be able to use the mysql functions without passing that
>> > variable to each function.
>>
>> RTM again.
>>
>> The link parameter is completely optional.
>>
>> If you don't specify it, it uses the last connection created.
>>
>> I can do this and it's perfectly valid:
>>
>> $link = mysql_connect($server, $user, $pass);
>> if (!$link) {
>>  die ("Unable to connect to the database server");
>> }
>>
>> $db_selected = mysql_select_db($databasename);
>> if (!$db_selected) {
>>  die("Unable to connect to the database $databasename");
>> }
>>
>> $result = mysql_query("select 1");
>>
>> --
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>
>
>
>
> --
> Isaak Malik
> Web Developer
>

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-19 Thread Isaak Malik
My mistake then, it's been a while that I used it that way so some things do
fade away from my mind.

On Thu, Jun 19, 2008 at 1:57 AM, Chris <[EMAIL PROTECTED]> wrote:

> Isaak Malik wrote:
> > Because then the connection resource isn't stored in the $link variable
> > and you will be able to use the mysql functions without passing that
> > variable to each function.
>
> RTM again.
>
> The link parameter is completely optional.
>
> If you don't specify it, it uses the last connection created.
>
> I can do this and it's perfectly valid:
>
> $link = mysql_connect($server, $user, $pass);
> if (!$link) {
>  die ("Unable to connect to the database server");
> }
>
> $db_selected = mysql_select_db($databasename);
> if (!$db_selected) {
>  die("Unable to connect to the database $databasename");
> }
>
> $result = mysql_query("select 1");
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>



-- 
Isaak Malik
Web Developer


Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-18 Thread Chris
Isaak Malik wrote:
> Because then the connection resource isn't stored in the $link variable
> and you will be able to use the mysql functions without passing that
> variable to each function.

RTM again.

The link parameter is completely optional.

If you don't specify it, it uses the last connection created.

I can do this and it's perfectly valid:

$link = mysql_connect($server, $user, $pass);
if (!$link) {
  die ("Unable to connect to the database server");
}

$db_selected = mysql_select_db($databasename);
if (!$db_selected) {
  die("Unable to connect to the database $databasename");
}

$result = mysql_query("select 1");

-- 
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-18 Thread Isaak Malik
To Evert:

4. I am posting some of my code to compare. Module "carmade.php" works v.s.
"login.php" which does not. Also, I am posting my "database.php" which is
establishing the connection and is included in every page through
"layout.php"->"common.php"->"database.php".

To bateivan:

I can only guess that the database.php file isn't correctly loaded via
layout.php, did you already try to include database.php into the module in
which it wasn't working? If so and it works then the issue is probably
caused by incorrectly including that file, otherwise it has to be something
else...

And register_globals allows you to use short variables for super global
arrays. Ex: $name instead of $_POST['name'], etc.


On Wed, Jun 18, 2008 at 9:47 PM, Evert Lammerts <[EMAIL PROTECTED]>
wrote:

> Pastebin works lots better when you're posting code: www.pastebin.com
>
> I don't see your database.php included in both of these modules. Where
> do you include it?
>
> EVert
>
> On Wed, Jun 18, 2008 at 9:38 PM, bateivan <[EMAIL PROTECTED]> wrote:
> >
> > Hello,
> >
> > To answer these qwestions:
> > 1. I am using "include" in my code.
> > 2. About the "$link = mysql_connect('localhost', 'root', 'testing');"
> > variable. I can just include this line before mysql_query function and it
> > works even without entering into mysql_query the "$link" variable. (Like
> the
> > connection is waking up).
> > 3.My php.ini register_globals is off as suggested for new versions of PHP
> > but include file should work instead according to the manual.
> > 4. I am posting some of my code to compare. Module "carmade.php" works
> v.s.
> > "login.php" which does not. Also, I am posting my "database.php" which is
> > establishing the connection and is included in every page through
> > "layout.php"->"common.php"->"database.php".
> >
> > carmade.php:
> >  > include $_SERVER['DOCUMENT_ROOT'].
> >'/layout.php';
> >
> > // Quick Login session check
> > login_check();
> >
> > switch($_REQUEST['req']){
> >   // Insert Case
> >   case "create_carmade":
> > myheader("Добавяне на автомобилни марки в списъка");
> >
> > // Double check form posted values are there
> > // before performing INSERT query
> > if(!$_POST['car_descr']){
> > echo 'Липсва информациятя от формата!'.
> > 'Моля, използвайте бутона'.
> > 'Назад и въведете данните отново!';
> >  footer();
> > exit();
> > }
> >
> > // Insert Query
> > $sql = mysql_query("INSERT INTO carmade
> > (car_descr)
> > VALUES('{$_POST['car_descr']}')");
> >
> > // Insert query results
> > if(!$sql){
> > echo "Грешка при въвеждане на данните:".mysql_error();
> > } else {
> >
> > echo 'Марката "'.$_POST['car_descr'].
> > '"е въведенас номер:'.mysql_insert_id();
> > echo ' /admin/carmade.php?req=new_carmade Искате ли да'.
> >'въведете друга марка? ';
> > }
> >   break;
> >
> >   // Create car made form case
> >   case "new_carmade":
> >  myheader("Въвеждане на нова автомобилна марка");
> >  include $_SERVER['DOCUMENT_ROOT'].
> >  '/html/forms/carmade_insert.html';
> >  footer();
> >   break;
> >
> >   default:
> >  myheader("Администриране на списъка с автомобилните марки");
> >  include $_SERVER['DOCUMENT_ROOT'].
> >  '/html/carmade_admin.html';
> >  footer();
> >   break;
> >
> > }
> > ?>
> >
> > login.php:
> >  > include $_SERVER['DOCUMENT_ROOT'].
> >'/layout.php';
> >
> >
> > switch($_REQUEST['req']){
> >
> > case "validate":
> >
> >   $validate = mysql_query("SELECT * FROM members
> >   WHERE username = '{$_POST['username']}'
> >   AND password = md5('{$_POST['password']}')"
> >   );
> >
> >   $num_rows = mysql_num_rows($validate);
> >
> >   if($num_rows == 1){
> >  while($row = mysql_fetch_assoc($validate)){
> > $_SESSION['login'] = true;
> > $_SESSION['userid'] = $row['member_id'];
> > $_SESSION['first_name'] = $row['first_name'];
> > $_SESSION['last_name']  = $row['last_name'];
> > $_SESSION['email_address'] = $row['email_address'];
> >
> > if($row['admin_access'] == 1){
> >$_SESSION['admin_access'] = true;
> > }
> > $login_time = mysql_query("UPDATE members
> >   SET last_login=now()
> >   WHERE id='{$row['id']}'");
> >   }
> >   header("Location: /loggedin.php");
> >   } else {
> >  myheader("Входът в административната зона е неуспешен!");
> >  echo 'Входът в страницата не е успешен!';
> >  echo 'Проверете потребителското си '.
> >   'име и паролата си и опитайте пак или се '.
> >   'обадете на администратора.';
> >  footer();
> >   }
> > break;
> >
> > default:
> >   myheader("Вход!");
> >  include $_SERVER['DOCUME

Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-18 Thread Evert Lammerts
Pastebin works lots better when you're posting code: www.pastebin.com

I don't see your database.php included in both of these modules. Where
do you include it?

EVert

On Wed, Jun 18, 2008 at 9:38 PM, bateivan <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> To answer these qwestions:
> 1. I am using "include" in my code.
> 2. About the "$link = mysql_connect('localhost', 'root', 'testing');"
> variable. I can just include this line before mysql_query function and it
> works even without entering into mysql_query the "$link" variable. (Like the
> connection is waking up).
> 3.My php.ini register_globals is off as suggested for new versions of PHP
> but include file should work instead according to the manual.
> 4. I am posting some of my code to compare. Module "carmade.php" works v.s.
> "login.php" which does not. Also, I am posting my "database.php" which is
> establishing the connection and is included in every page through
> "layout.php"->"common.php"->"database.php".
>
> carmade.php:
>  include $_SERVER['DOCUMENT_ROOT'].
>'/layout.php';
>
> // Quick Login session check
> login_check();
>
> switch($_REQUEST['req']){
>   // Insert Case
>   case "create_carmade":
> myheader("Добавяне на автомобилни марки в списъка");
>
> // Double check form posted values are there
> // before performing INSERT query
> if(!$_POST['car_descr']){
> echo 'Липсва информациятя от формата!'.
> 'Моля, използвайте бутона'.
> 'Назад и въведете данните отново!';
>  footer();
> exit();
> }
>
> // Insert Query
> $sql = mysql_query("INSERT INTO carmade
> (car_descr)
> VALUES('{$_POST['car_descr']}')");
>
> // Insert query results
> if(!$sql){
> echo "Грешка при въвеждане на данните:".mysql_error();
> } else {
>
> echo 'Марката "'.$_POST['car_descr'].
> '"е въведенас номер:'.mysql_insert_id();
> echo ' /admin/carmade.php?req=new_carmade Искате ли да'.
>'въведете друга марка? ';
> }
>   break;
>
>   // Create car made form case
>   case "new_carmade":
>  myheader("Въвеждане на нова автомобилна марка");
>  include $_SERVER['DOCUMENT_ROOT'].
>  '/html/forms/carmade_insert.html';
>  footer();
>   break;
>
>   default:
>  myheader("Администриране на списъка с автомобилните марки");
>  include $_SERVER['DOCUMENT_ROOT'].
>  '/html/carmade_admin.html';
>  footer();
>   break;
>
> }
> ?>
>
> login.php:
>  include $_SERVER['DOCUMENT_ROOT'].
>'/layout.php';
>
>
> switch($_REQUEST['req']){
>
> case "validate":
>
>   $validate = mysql_query("SELECT * FROM members
>   WHERE username = '{$_POST['username']}'
>   AND password = md5('{$_POST['password']}')"
>   );
>
>   $num_rows = mysql_num_rows($validate);
>
>   if($num_rows == 1){
>  while($row = mysql_fetch_assoc($validate)){
> $_SESSION['login'] = true;
> $_SESSION['userid'] = $row['member_id'];
> $_SESSION['first_name'] = $row['first_name'];
> $_SESSION['last_name']  = $row['last_name'];
> $_SESSION['email_address'] = $row['email_address'];
>
> if($row['admin_access'] == 1){
>$_SESSION['admin_access'] = true;
> }
> $login_time = mysql_query("UPDATE members
>   SET last_login=now()
>   WHERE id='{$row['id']}'");
>   }
>   header("Location: /loggedin.php");
>   } else {
>  myheader("Входът в административната зона е неуспешен!");
>  echo 'Входът в страницата не е успешен!';
>  echo 'Проверете потребителското си '.
>   'име и паролата си и опитайте пак или се '.
>   'обадете на администратора.';
>  footer();
>   }
> break;
>
> default:
>   myheader("Вход!");
>  include $_SERVER['DOCUMENT_ROOT'].
>  '/html/forms/login_form.html';
>   footer();
> break;
> }
> ?>
>
> database.php:
>  $link = mysql_pconnect('localhost','root','testing');
> $set = mysql_query('SET NAMES CP1251');
> $set = mysql_query('SET_COLLATION=CP1251_GENERAL_CI');
> mysql_select_db('samek_db', $link) or die(mysql_error());
>
> ?>
>
> common.php:
> 
> // Include Meta Content Class
> include $_SERVER['DOCUMENT_ROOT'].'/classes/clsMetaContent.php';
>
> // Include Email Class
> include $_SERVER['DOCUMENT_ROOT'].'/classes/clsEmail.php';
>
> // Include Database Connection File
> include $_SERVER['DOCUMENT_ROOT'].'/includes/database.php';
>
> // Include Session File
> include $_SERVER['DOCUMENT_ROOT'].'/includes/session.php';
>
> ?>
>
> Thank you for your help
>
>
> You're very welcome, I understand that you need a solution which allows you
> to keep using the connection this way.
>
> I doubt that your php.ini is the cause so I'll suggest the following:
>
> Try executing your MySQL queries by passing the $link variable to the
> function a

Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-18 Thread bateivan

Hello,

To answer these qwestions:
1. I am using "include" in my code.
2. About the "$link = mysql_connect('localhost', 'root', 'testing');"
variable. I can just include this line before mysql_query function and it
works even without entering into mysql_query the "$link" variable. (Like the
connection is waking up).
3.My php.ini register_globals is off as suggested for new versions of PHP
but include file should work instead according to the manual.
4. I am posting some of my code to compare. Module "carmade.php" works v.s.
"login.php" which does not. Also, I am posting my "database.php" which is
establishing the connection and is included in every page through
"layout.php"->"common.php"->"database.php".

carmade.php:
Липсва информациятя от формата!'.
 'Моля, използвайте бутона'.
 'Назад и въведете данните отново!';
  footer();
 exit();
 }
 
 // Insert Query
 $sql = mysql_query("INSERT INTO carmade
 (car_descr)
 VALUES('{$_POST['car_descr']}')");
   
 // Insert query results  
 if(!$sql){
 echo "Грешка при въвеждане на данните:".mysql_error();
 } else {
 
 echo 'Марката "'.$_POST['car_descr'].
 '"е въведенас номер:'.mysql_insert_id();
 echo ' /admin/carmade.php?req=new_carmade Искате ли да'.
'въведете друга марка? ';
 } 
   break;
   
   // Create car made form case
   case "new_carmade":
  myheader("Въвеждане на нова автомобилна марка");
  include $_SERVER['DOCUMENT_ROOT'].
  '/html/forms/carmade_insert.html';
  footer();
   break;
   
   default:
  myheader("Администриране на списъка с автомобилните марки");
  include $_SERVER['DOCUMENT_ROOT'].
  '/html/carmade_admin.html';
  footer();
   break;
   
}
?>

login.php:
Входът в страницата не е успешен!';
  echo 'Проверете потребителското си '.
   'име и паролата си и опитайте пак или се '.
   'обадете на администратора.';
  footer();
   }
break;

default:
   myheader("Вход!");
  include $_SERVER['DOCUMENT_ROOT'].
  '/html/forms/login_form.html';
   footer();
break;
}
?>  

database.php:


common.php:


Thank you for your help


You're very welcome, I understand that you need a solution which allows you
to keep using the connection this way.

I doubt that your php.ini is the cause so I'll suggest the following:

Try executing your MySQL queries by passing the $link variable to the
function as the connection resource:

mysql_query("SELECT...", $link);

Something that also might cause it is that you use (include|require)_once
and that this module doesn't have access to the connection resource, if this
is the case change it into include|require and see if that solves your
issue. If not then could you please post some example code of your module if
possible so we can be more helpful?

Also be sure that you global $link; it in functions (I don't know if this
required since I didn't use it this way for a long while).

Could you also please answer to the list instead of directly to me as this
might also be informative for others.

-- 
View this message in context: 
http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17990192.html
Sent from the Php - Database mailing list archive at Nabble.com.


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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-18 Thread bateivan

Thank you, Chris,

I tried your suggestion using regular connection. Unfortunately, I got the
same result.
See my reply to Isaak,s reply where I am going to post portion of my code to
visualize what I am talking about.

Thanx again


chris smith-9 wrote:
> 
> 
>> It means that either your mysql conenction details are not correctly set
>> or
>> the connection resource isn't accessible for your mysql functions. I
>> suggest
>> you first try by replacing:
>> 
>> $link = mysql_pconnect('localhost', 'root', 'testing');
>> 
>> into:
>> 
>> mysql_pconnect('localhost', 'root', 'testing');
> 
> Why? How is that going to help fix the problem?
> 
> Personally I'd say to *not* use persistent connections as it will cause
> you problems later.
> 
> Use a normal connection:
> 
> $link = mysql_connect($server, $user, $pass);
> 
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17989584.html
Sent from the Php - Database mailing list archive at Nabble.com.


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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-18 Thread Isaak Malik
Because then the connection resource isn't stored in the $link variable and
you will be able to use the mysql functions without passing that variable to
each function.

On Wed, Jun 18, 2008 at 1:51 AM, Chris <[EMAIL PROTECTED]> wrote:

>
> > It means that either your mysql conenction details are not correctly set
> or
> > the connection resource isn't accessible for your mysql functions. I
> suggest
> > you first try by replacing:
> >
> > $link = mysql_pconnect('localhost', 'root', 'testing');
> >
> > into:
> >
> > mysql_pconnect('localhost', 'root', 'testing');
>
> Why? How is that going to help fix the problem?
>
> Personally I'd say to *not* use persistent connections as it will cause
> you problems later.
>
> Use a normal connection:
>
> $link = mysql_connect($server, $user, $pass);
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>



-- 
Isaak Malik
Web Developer


Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Roberto Carlos García Luís

excuseme but, you can access by terminal? [shell]

ODBC is the user? or is a ODBC database?

Please answer me and i can help you.

**Excuse me my english is bad. :(

El 17/06/2008, a las 06:51 p.m., Chris escribió:



It means that either your mysql conenction details are not  
correctly set or
the connection resource isn't accessible for your mysql functions.  
I suggest

you first try by replacing:

$link = mysql_pconnect('localhost', 'root', 'testing');

into:

mysql_pconnect('localhost', 'root', 'testing');


Why? How is that going to help fix the problem?

Personally I'd say to *not* use persistent connections as it will  
cause

you problems later.

Use a normal connection:

$link = mysql_connect($server, $user, $pass);

--
Postgresql & php tutorials
http://www.designmagick.com/

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




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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Chris

> It means that either your mysql conenction details are not correctly set or
> the connection resource isn't accessible for your mysql functions. I suggest
> you first try by replacing:
> 
> $link = mysql_pconnect('localhost', 'root', 'testing');
> 
> into:
> 
> mysql_pconnect('localhost', 'root', 'testing');

Why? How is that going to help fix the problem?

Personally I'd say to *not* use persistent connections as it will cause
you problems later.

Use a normal connection:

$link = mysql_connect($server, $user, $pass);

-- 
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Eric


http://myprojects.srhost.info
eric{at}myprojects{dot}srhost{dot}info
- Original Message - 
From: "bateivan" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, June 17, 2008 11:19 PM
Subject: [PHP-DB] PHP-MySQL connection for particular module


: 
: Hello,
: 
: First of all, please, have in mind that I am new in this business.
: 
: I have a problem connecting with data base in one particular module. That's
: right. The rest of the modules can connect to db, update tables with new
: info but this one is refusing giving me message like this:
: 
: "Warning: mysql_query() [function.mysql-query]: Access denied for user
: 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
: Foundation\Apache2.2\htdocs\login.php on line 17
: 

This error message state that you have provided a wrong username and / or 
password
use the die also to ensure the connection was created.

: Warning: mysql_query() [function.mysql-query]: A link to the server could
: not be established in
: D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
: line 17"
: 
: 
: It is a authentication module and this is the fragment of the code which is
: giving me a hard time:
: 
: 
***
: http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
: Sent from the Php - Database mailing list archive at Nabble.com.
: 
: 
: -- 
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:

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



Re: [PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread Isaak Malik
If you get an error of this kind:

"Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\login.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in
D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
line 17"

It means that either your mysql conenction details are not correctly set or
the connection resource isn't accessible for your mysql functions. I suggest
you first try by replacing:

$link = mysql_pconnect('localhost', 'root', 'testing');

into:

mysql_pconnect('localhost', 'root', 'testing');

On 6/17/08, bateivan <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
>
> First of all, please, have in mind that I am new in this business.
>
> I have a problem connecting with data base in one particular module. That's
> right. The rest of the modules can connect to db, update tables with new
> info but this one is refusing giving me message like this:
>
> "Warning: mysql_query() [function.mysql-query]: Access denied for user
> 'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache
> Software
> Foundation\Apache2.2\htdocs\login.php on line 17
>
> Warning: mysql_query() [function.mysql-query]: A link to the server could
> not be established in
> D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
> line 17"
>
>
> It is a authentication module and this is the fragment of the code which is
> giving me a hard time:
>
>
> ***
>  include $_SERVER['DOCUMENT_ROOT'].
> '/layout.php';
>
> switch($_REQUEST['req']){
>
> case "validate":
>
>$validate = mysql_query("SELECT * FROM members
>WHERE username = '{$_POST['username']}'
>AND password = md5('{$_POST['password']}')"
>);
>
> etc
>
>
> ***
>
> My platform is WinXP on drive F:\ (I have Win'98 on C:\) and as you can see
> my program files are on D:\. All this may not be important but I listed
> anyway.
> It is installed Apache 2.2.6 using windows installer, PHP 5.2.6 (I just
> replaced 5.2.5 hoping to fix the problem), and MySQL 5.0.45.
>
> I am using persisten connection which should be on until you restart the
> server. I have a file included in every page for connection with MySQL and
> data base.
> PHP manual says that "mysql_query" reuses the existing connection or try to
> create one if not present (I think, according to the warning is trying to
> create one).
> I had been checking after each step using phpinfo() if the connection is
> there and it's there but for some reason the above fragment does not work.
> As I mentioned above the rest of my modules are working fine with mysql.
>
> I checked the "php.ini" file. I compared it to "php.ini.recomended" from
> the
> .zip distribusion package and they are almost identical exept couple of
> things for error reporting.
> I, also checked FAQ, mail listings and other forums but it does not seem
> anybody had a similar problem.
>
> In one of my tests I included a line for connection just before the problem
> lines, as described below, and it worked but my intention is to keep such
> lines in a separate files and include them in every page instead.
>
>
> ***
> ...
>
> $link = mysql_pconnect('localhost', 'root', 'testing');
>
>
>$validate = mysql_query("SELECT * FROM members
>WHERE username = '{$_POST['username']}'
>AND password = md5('{$_POST['password']}')"
>);
> etc.
>
> ***
>
> As I metioned, this is an authentication module and, may be, that's why is
> behaving diferently from the rest or I need to do some setup changes in
> "php.ini" which I am not familiar with.
>
> If anyone has had simmilar problem I would appreciate his/her input.
> Please,
> help me resolve this mistery.
>
> --
> View this message in context:
> http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
> Sent from the Php - Database mailing list archive at Nabble.com.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
Isaak Malik
Web Developer


[PHP-DB] PHP-MySQL connection for particular module

2008-06-17 Thread bateivan

Hello,

First of all, please, have in mind that I am new in this business.

I have a problem connecting with data base in one particular module. That's
right. The rest of the modules can connect to db, update tables with new
info but this one is refusing giving me message like this:

"Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in D:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\login.php on line 17

Warning: mysql_query() [function.mysql-query]: A link to the server could
not be established in
D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\login.php on
line 17"


It is a authentication module and this is the fragment of the code which is
giving me a hard time:

***
http://www.nabble.com/PHP-MySQL-connection-for-particular-module-tp17915108p17915108.html
Sent from the Php - Database mailing list archive at Nabble.com.


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



Re: [PHP-DB] php + mysql + copy file

2008-04-04 Thread tacio vilela
Hi,

try this,

$carpeta = $_SERVER['DOCUMENT_ROOT']."/subidos"; // nombre de la carpeta ya
creada. chmool 777 (todos los permisos)
copy($_FILES['file']['tmp_name'] , $carpeta . $_FILE['file']['name']);

Regards,
Tacio Vilela


2008/4/2 Chris <[EMAIL PROTECTED]>:

>
>  $carpeta = "subidos"; // nombre de la carpeta ya creada. chmool
> > 777
> > (todos los permisos)
> >
> > copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE
> > ['file']['name']);
> >
>
> It's $_FILES not $_FILE (an 's' on the end).
>
> It's always worth using error_reporting(E_ALL) and
> ini_set('display_errors', true) when doing development, this would have
> triggered a notice or warning (can't remember which).
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
/***
*** ***
*** Tácio Vilela ***
*** MSN: [EMAIL PROTECTED] ***
*** SKYPE: taciovilela ***
*** ***
***/


Re: [PHP-DB] php + mysql + copy file

2008-04-02 Thread Chris



 $carpeta = "subidos"; // nombre de la carpeta ya creada. chmool 777
(todos los permisos)

 copy($_FILES['file']['tmp_name'] , $carpeta . '/' . $_FILE
['file']['name']);


It's $_FILES not $_FILE (an 's' on the end).

It's always worth using error_reporting(E_ALL) and 
ini_set('display_errors', true) when doing development, this would have 
triggered a notice or warning (can't remember which).


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP-DB] php + mysql + copy file

2008-04-02 Thread Emiliano Boragina
Hello

I have the next code:

 

-- archive_a_subir.php --



 

 



 

In archive_subir.php:

 



 

You can see this in http://www.portbora.com.ar/foro/archivo_a_subir.php,
when I run these appears the next warning

 

Warning: copy(subidos/) [ 
function.copy]: failed to open stream: Is a directory in
/home/pu000561/public_html/foro/archivo_subir.php on line 3

 

Why this? How can I run correctly?

Thanks.

 

+  _
   // Emiliano Boragina _

   // Diseño & Comunicación //
+  _

   // [EMAIL PROTECTED]  /
   // 15 40 58 60 02 ///
+  _

 



Re: [PHP-DB] PHP, MySQL and Lookups

2008-02-27 Thread Daniel Brown
On Wed, Feb 27, 2008 at 9:52 AM, Tobias Franzén <[EMAIL PROTECTED]> wrote:
>  Consider this, if you have not already:
>  What if two users happen to have the same password?
>
>  It is wrong to assume that no two users will never have the same
>  password. Doing an update like that, just based on the password column,
>  is an accident waiting to happen.
>
>  You should have a uniquely distinguished name or designation for each
>  user, and validate the user and password combination. Also, such a
>  designation should be unique, and keeping entries in a column unique can
>  be enforced with MySQL.

It's also safe to presume, however, that - since the OP said,
"Basically, what I'm trying to do is give a load of users an
individual password" - by "individual password" he means that the
password *will* be the unique key.

Just a thought.  ;-P

For all other intents and purposes, however, you're 100% correct.
Using a unique auto_increment key would be your best bet.

-- 


Daniel P. Brown
Senior Unix Geek


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



Re: [PHP-DB] PHP, MySQL and Lookups

2008-02-27 Thread Tobias Franzén

Daniel Brown wrote:

On Tue, Feb 26, 2008 at 8:55 AM, Henry Felton <[EMAIL PROTECTED]> wrote:
  

Hi everyone,

 I'm just getting into PHP at the moment and was wondering; what code would I
 need to look at a field value entered in a form, then if that value is found
 in my table, enter all the other information entered in the form, to the
 other fields on that record.
 Basically, what I'm trying to do is give a load of users an individual
 password that they enter, with various other pieces of information such as
 year of birth, single/married or whatever, into a form. In MySQL I have a
 table with three fields, but only the password one has any data in them. A
 script will then took in the table to find the password entered in the form,
 and then append all the other information (i.e. data for the other two
 fields) to the particular record that holds the password value entered.



Henry (AKA: "Max"),

Try this:



Password: 
Date of birth (mm/dd/): 
Status: Married
Single
Widowed
Divorced
Wishing I Was Single


  


Consider this, if you have not already:
What if two users happen to have the same password?

It is wrong to assume that no two users will never have the same 
password. Doing an update like that, just based on the password column, 
is an accident waiting to happen.


You should have a uniquely distinguished name or designation for each 
user, and validate the user and password combination. Also, such a 
designation should be unique, and keeping entries in a column unique can 
be enforced with MySQL.


/Tobias

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



Re: [PHP-DB] PHP, MySQL and Lookups

2008-02-26 Thread Daniel Brown
On Tue, Feb 26, 2008 at 8:55 AM, Henry Felton <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
>  I'm just getting into PHP at the moment and was wondering; what code would I
>  need to look at a field value entered in a form, then if that value is found
>  in my table, enter all the other information entered in the form, to the
>  other fields on that record.
>  Basically, what I'm trying to do is give a load of users an individual
>  password that they enter, with various other pieces of information such as
>  year of birth, single/married or whatever, into a form. In MySQL I have a
>  table with three fields, but only the password one has any data in them. A
>  script will then took in the table to find the password entered in the form,
>  and then append all the other information (i.e. data for the other two
>  fields) to the particular record that holds the password value entered.

Henry (AKA: "Max"),

Try this:



Password: 
Date of birth (mm/dd/): 
Status: Married
Single
Widowed
Divorced
Wishing I Was Single


-- 


Daniel P. Brown
Senior Unix Geek


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



RES: [PHP-DB] PHP, MySQL and Lookups

2008-02-26 Thread Thiago Pojda
Lemme see if I get this right:

You could just do this:

UPDATE userPW SET field1=$satinized_post_field1,
field2=$sanitized_post_field2 WHERE userid=$userId and password=$userPw


if (mysql_affected_rows($conn) > 0){
echo "updated"
}else{
echo "error: ".mysql_error($conn);
}

http://docs.php.net/manual/function.mysql-query.php

I suppose you have a relationship between pw and user (as stated in
userid=$userid).


Hope this helps!

-Mensagem original-
De: Henry Felton [mailto:[EMAIL PROTECTED] 
Enviada em: terça-feira, 26 de fevereiro de 2008 10:55
Para: php-db@lists.php.net
Assunto: [PHP-DB] PHP, MySQL and Lookups

Hi everyone,

I'm just getting into PHP at the moment and was wondering; what code would I
need to look at a field value entered in a form, then if that value is found
in my table, enter all the other information entered in the form, to the
other fields on that record.
Basically, what I'm trying to do is give a load of users an individual
password that they enter, with various other pieces of information such as
year of birth, single/married or whatever, into a form. In MySQL I have a
table with three fields, but only the password one has any data in them. A
script will then took in the table to find the password entered in the form,
and then append all the other information (i.e. data for the other two
fields) to the particular record that holds the password value entered.

Hope that made sense, but I'd be so grateful if someone could help me with
this

Thanks,
Max

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



Re: [PHP-DB] PHP, MySQL and Lookups

2008-02-26 Thread Jason Pruim


On Feb 26, 2008, at 8:55 AM, Henry Felton wrote:


Hi everyone,

I'm just getting into PHP at the moment and was wondering; what code  
would I
need to look at a field value entered in a form, then if that value  
is found
in my table, enter all the other information entered in the form, to  
the

other fields on that record.
Basically, what I'm trying to do is give a load of users an individual
password that they enter, with various other pieces of information  
such as
year of birth, single/married or whatever, into a form. In MySQL I  
have a
table with three fields, but only the password one has any data in  
them. A
script will then took in the table to find the password entered in  
the form,

and then append all the other information (i.e. data for the other two
fields) to the particular record that holds the password value  
entered.


Hope that made sense, but I'd be so grateful if someone could help  
me with

this


What you're looking for to me sounds like using the UPDATE syntax in  
MySQL... something along the lines of:


$sql = "UPDATE tablename field1="$MySuperData1" field2="$MySuperData2"  
where password="$MySuperHardPassword";


Of course, this is untested check the mysql site for specifics on  
using update. Also... always be sure to escape your data or you are  
asking for trouble...


That should be enough to get you started!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424-9337
www.raoset.com
[EMAIL PROTECTED]

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



[PHP-DB] PHP, MySQL and Lookups

2008-02-26 Thread Henry Felton
Hi everyone,

I'm just getting into PHP at the moment and was wondering; what code would I
need to look at a field value entered in a form, then if that value is found
in my table, enter all the other information entered in the form, to the
other fields on that record.
Basically, what I'm trying to do is give a load of users an individual
password that they enter, with various other pieces of information such as
year of birth, single/married or whatever, into a form. In MySQL I have a
table with three fields, but only the password one has any data in them. A
script will then took in the table to find the password entered in the form,
and then append all the other information (i.e. data for the other two
fields) to the particular record that holds the password value entered.

Hope that made sense, but I'd be so grateful if someone could help me with
this

Thanks,
Max


Re: [PHP-DB] PHP/MySQL - Matrix

2007-11-01 Thread Chris

Eduardo Vizcarra wrote:

Hi Chris

How do I save the matrix in the session ?

Actually, my first question is, what do you mean by a session ?


http://www.php.net/session

Look under the examples.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PHP/MySQL - Matrix

2007-11-01 Thread Eduardo Vizcarra
Hi Chris

How do I save the matrix in the session ?

Actually, my first question is, what do you mean by a session ?

Regards
Eduardo

"Chris" <[EMAIL PROTECTED]> escribió en el mensaje 
news:[EMAIL PROTECTED]
>
>> When I get all the records from the photos table, I am using a web page 
>> to display only the first record, then, if the user hits a next link then 
>> the user should be able to see the next record (next picture) and so on, 
>> I do not want to do a select every time the user hits next or back to get 
>> the picture name and then display it
>
> Why? You're selecting one record - it will be quick as long as you're db 
> is indexed correctly.
>
>> Is there anyway to do a one SELECT statement, save them in a matrix and 
>> then just go thru it. I am using the same web page to display all 
>> pictures, e.g. the next link points to the same web page where the first 
>> picture was displayed, is it possible to pass a matrix variable ?
>
> Sure. Stuff it all in an array and then save it in the session.
>
> -- 
> Postgresql & php tutorials
> http://www.designmagick.com/ 

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



Re: [PHP-DB] PHP/MySQL - Matrix

2007-11-01 Thread Chris


When I get all the records from the photos table, I am using a web page to 
display only the first record, then, if the user hits a next link then the 
user should be able to see the next record (next picture) and so on, I do 
not want to do a select every time the user hits next or back to get the 
picture name and then display it


Why? You're selecting one record - it will be quick as long as you're db 
is indexed correctly.


Is there anyway to do a one SELECT statement, save them in a matrix and then 
just go thru it. I am using the same web page to display all pictures, e.g. 
the next link points to the same web page where the first picture was 
displayed, is it possible to pass a matrix variable ?


Sure. Stuff it all in an array and then save it in the session.

--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP-DB] PHP/MySQL - Matrix

2007-11-01 Thread Eduardo Vizcarra
Hi,

I am developing a web site where I have a photos table, several records from 
the photos table can be linked to a different table referentially. When I do 
a SELECT to all photos records I can get multiple records, I do not have any 
problems doing this, the problem is all the procedure after this.

When I get all the records from the photos table, I am using a web page to 
display only the first record, then, if the user hits a next link then the 
user should be able to see the next record (next picture) and so on, I do 
not want to do a select every time the user hits next or back to get the 
picture name and then display it

Is there anyway to do a one SELECT statement, save them in a matrix and then 
just go thru it. I am using the same web page to display all pictures, e.g. 
the next link points to the same web page where the first picture was 
displayed, is it possible to pass a matrix variable ?

Regards,
Eduardo 

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



Re: [PHP-DB] PHP + MySQL

2007-07-18 Thread Dimiter Ivanov

On 7/18/07, Dan Maret <[EMAIL PROTECTED]> wrote:

I just can't figure it out and Google yielded no help. I have a table named
'settings' which contains two fields, 'item' and 'content'.  What I would
like to do is grab that data and use the 'item' field as the name, and use
the respective 'content' as the value in an array.  For Example:

Array (
copyright => Copyright 2007 yada yada
version = > 2.15.1
)

That way I can do 

Can you help point me in the right direction?  Any help would be greatly
appreciated!! :-D

--
-Dan



You need mysql_fetch_assoc()  / mysql_fetch_array() functions
http://www.php.net/mysql_fetch_assoc
http://www.php.net/manual/en/function.mysql-fetch-array.php

They come with a good examples in the manual pages.

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



[PHP-DB] PHP + MySQL

2007-07-18 Thread Dan Maret

I just can't figure it out and Google yielded no help. I have a table named
'settings' which contains two fields, 'item' and 'content'.  What I would
like to do is grab that data and use the 'item' field as the name, and use
the respective 'content' as the value in an array.  For Example:

Array (
copyright => Copyright 2007 yada yada
version = > 2.15.1
)

That way I can do 

Can you help point me in the right direction?  Any help would be greatly
appreciated!! :-D

--
-Dan


Re: [PHP-DB] PHP & MySQL Issue!

2007-07-13 Thread Dwight Altman


On Jul 12, 2007, at 9:50 PM, Austin C wrote:

Hello, I dont get any errors. Just a blank page. But, I go to the  
database,

and it did what I told it to with the header table, but not with the
circulation table.


After you built the SQL for the circulation table, you did not  
execute it [with a $query = mysqli_query($cxn,$sql);].  Instead, you  
selected the db again.  Your code did what you told it to do.  Hence,  
no error messages.



Regards,
Dwight




Re: [PHP-DB] PHP & MySQL Issue!

2007-07-13 Thread Dwight Altman


On Jul 12, 2007, at 9:50 PM, Austin C wrote:

Hello, I dont get any errors. Just a blank page. But, I go to the  
database,

and it did what I told it to with the header table, but not with the
circulation table.


Check your error log or add this as the first line in your script.
ini_set('display_errors', '1');

Maybe you are testing this on a production server with errors not  
displayed.


Remove the line before you deploy the code.

Hopefully you will see a meaningful message now.

Regards,
Dwight




Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-13 Thread OKi98

Charles Sheinin napsal(a):
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I 
have a php page which has "content="application/xhtml+xml; charset=utf-8" />" at the top of the 
html section and "mysql_set_charset("utf8");" after my connection 
(it's php 2.2.3, so that's more or less the same as "mysql_query("SET 
NAMES 'utf8'");/("SET SESSION character_set_client = "utf8");, though 
I tried all that too, anyway).  I have all my php.ini mbstring stuff 
configured for utf-8:


mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.encoding_translation = On
mbstring.detect_order = auto

and for what it's worth, echo mb_internal_encoding(); reports "UTF-8".

when I run a query that pulls out (in this case, Japanese, but say 
any) UTF8 data, it displays properly in MySQL Query Browser.  With php 
in the above context however, it does not.  Instead, it prints a ? 
corresponding to each character.  When I use mb_detect_encoding(); on 
each such string, it tells me they are encoded as ASCII.  The nearest 
I can tell is that somewhere between using mysql_query() and 
mysql_fetch_row(), things got messed up.  Is this a bug?  Is there 
something I'm missing?  Any clues? Help!



do you have

**

header in your script?

OKi98

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



Re: [PHP-DB] PHP & MySQL Issue!

2007-07-12 Thread Austin C

Hello, I dont get any errors. Just a blank page. But, I go to the database,
and it did what I told it to with the header table, but not with the
circulation table.

On 7/12/07, Niel <[EMAIL PROTECTED]> wrote:


Hi

Give us a clue? What's the error(s) you get returned?
--
Niel Archer

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





--
Thanks, the webmaster of Galacticneo


Re: [PHP-DB] PHP & MySQL Issue!

2007-07-12 Thread Chris

Austin C wrote:

Hello everyone, im trying to use PHP to create 2 tables in a database and
populate them with tables, however, it just wont work. 


Where does it stop working? Looks fine from what you've shown us but you 
need to track down the problem a bit further.


--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PHP & MySQL Issue!

2007-07-12 Thread Niel
Hi

Give us a clue? What's the error(s) you get returned?
--
Niel Archer

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



Re: [PHP-DB] PHP & MySQL Issue!

2007-07-12 Thread bedul

- Original Message - 
From: "Austin C" <[EMAIL PROTECTED]>
To: 
Sent: Friday, July 13, 2007 8:41 AM
Subject: [PHP-DB] PHP & MySQL Issue!


> Hello everyone, im trying to use PHP to create 2 tables in a database and
> populate them with tables, however, it just wont work. Here is my full code:
> 
> 
>  $hostname = $_GET['hostname'];
> $dbname = $_GET['dbname'];
> $dbusername = $_GET['dbusername'];
> $dbpassword = $_GET['dbpassword'];
> $dbprefix = $_GET['dbprefix'];
> 
> echo "Install- Processing Database Info . . . . .
> 
> ";
> 
> $cxn = mysqli_connect($hostname,$dbusername,$dbpassword,$dbname)
>or die ("Basic Library System could not connect to the database you
> specified. Please go back and make sure the information you submitted is
> correct.");
> 
> $file = '../config.php';
> 
> $fh = fopen($file, 'w') or die('Failed to open config.php file');
> 
> fwrite($fh, ' $dbname="'.$dbname.'";
> $dbusername="'.$dbusername.'";
> $dbpassword="'.$dbpassword.'";
> $dbprefix="'.$dbprefix.'"; ?>') or die('Could not write to config.php');
> 
> fclose($fh);
> 
> mysqli_select_db($cxn,$dbname)

are this should be
mysqli_select_db($dbname, $cxn) ???
and the rest seem miss place in the function


>   or die ("Could not connect to the database you specified. Please go
> back and make sure you entered the correct database.");
> 
> mysqli_select_db($cxn,$dbname);
> $sql = "CREATE TABLE ".$dbprefix."_circulation
> (
> title varchar(100),
> author varchar(100),
> pubdate varchar(100),
> genre varchar(100),
> medium varchar(100),
> price varchar(100),
> id int(20) NOT NULL AUTO_INCREMENT,
> PRIMARY KEY(id)
> )";
> 
> mysqli_select_db($cxn,$dbname);
> $sql = "CREATE TABLE ".$dbprefix."_holder
> (
> space varchar(100)
> )";
> 
> $query = mysqli_query($cxn,$sql);
> if(!$query){
> echo "Basic Library System was unable to submit the information to the
> database. Please make sure you specified correct information.";
> }else{
> echo "Successfully created table. Do something here";
> }
> 
> mysqli_close($cxn);
> ?>
> 
> 
> 
> --
> 
> Visit galacticwebdesigns.com for tutorials and more!
> 


[PHP-DB] PHP & MySQL Issue!

2007-07-12 Thread Austin C

Hello everyone, im trying to use PHP to create 2 tables in a database and
populate them with tables, however, it just wont work. Here is my full code:


Install- Processing Database Info . . . . .

";

$cxn = mysqli_connect($hostname,$dbusername,$dbpassword,$dbname)
  or die ("Basic Library System could not connect to the database you
specified. Please go back and make sure the information you submitted is
correct.");

$file = '../config.php';

$fh = fopen($file, 'w') or die('Failed to open config.php file');

fwrite($fh, '') or die('Could not write to config.php');

fclose($fh);

mysqli_select_db($cxn,$dbname)
 or die ("Could not connect to the database you specified. Please go
back and make sure you entered the correct database.");

mysqli_select_db($cxn,$dbname);
$sql = "CREATE TABLE ".$dbprefix."_circulation
(
title varchar(100),
author varchar(100),
pubdate varchar(100),
genre varchar(100),
medium varchar(100),
price varchar(100),
id int(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id)
)";

mysqli_select_db($cxn,$dbname);
$sql = "CREATE TABLE ".$dbprefix."_holder
(
space varchar(100)
)";

$query = mysqli_query($cxn,$sql);
if(!$query){
echo "Basic Library System was unable to submit the information to the
database. Please make sure you specified correct information.";
}else{
echo "Successfully created table. Do something here";
}

mysqli_close($cxn);
?>



--

Visit galacticwebdesigns.com for tutorials and more!


Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-12 Thread Niel
Hi

What functions are you using?  Many of PHP's functions are not multibyte
aware and default to ASCII.  I had this problems myself end of last year.
--
Niel Archer

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



[PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-12 Thread Charles Sheinin
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I have 
a php page which has "content="application/xhtml+xml; charset=utf-8" />" at the top of the html 
section and "mysql_set_charset("utf8");" after my connection (it's php 
2.2.3, so that's more or less the same as "mysql_query("SET NAMES 
'utf8'");/("SET SESSION character_set_client = "utf8");, though I tried all 
that too, anyway).  I have all my php.ini mbstring stuff configured for 
utf-8:


mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.encoding_translation = On
mbstring.detect_order = auto

and for what it's worth, echo mb_internal_encoding(); reports "UTF-8".

when I run a query that pulls out (in this case, Japanese, but say any) UTF8 
data, it displays properly in MySQL Query Browser.  With php in the above 
context however, it does not.  Instead, it prints a ? corresponding to each 
character.  When I use mb_detect_encoding(); on each such string, it tells 
me they are encoded as ASCII.  The nearest I can tell is that somewhere 
between using mysql_query() and mysql_fetch_row(), things got messed up.  Is 
this a bug?  Is there something I'm missing?  Any clues? Help!


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



[PHP-DB] PHP - MySQL webhosting

2006-10-04 Thread Bradley Stahl

If anyone is interested in some VERY good webhosting that has support for
PHP and MySQL, please take a look at the following link:

http://www.sturdyhosting.com/idevaffiliate/idevaffiliate.php?id=100

They offer domain names for $8.95 and also webhositng solutions for as low
as $2.95 per month.


I hope that some of you are interested and can join the greatest webhosting
company in the world!


[PHP-DB] PHP - MySQL webhosting

2006-10-04 Thread Bradley Stahl

If anyone is interested in some VERY good webhosting that has support for
PHP and MySQL, please take a look at the following link:

http://www.sturdyhosting.com/idevaffiliate/idevaffiliate.php?id=100

They offer domain names for $8.95 and also webhositng solutions for as low
as $2.95 per month.


I hope that some of you are interested and can join the greatest webhosting
company in the world!


[PHP-DB] PHP-MySQL CMS Generator

2006-10-03 Thread Ted Weatherly
Does anyone know of a program that can generate a good Content Management
System?  For example, it would ask which fields to add to a database table,
the types of the fields, etc and create the database in MySQL and php's to
manage the data.  I did find a few such programs already (AppGini,
PHPRunner) but they don't allow custom templates.I'd like to control how the
pages look.

 

Thanks.

 

-t



RE: [PHP-DB] PHP/Mysql search

2006-05-22 Thread Eustace
Thanks, I have somewhere to start!

Eustace 

-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 22, 2006 4:10 PM
To: [EMAIL PROTECTED]; php-db@lists.php.net
Subject: RE: [PHP-DB] PHP/Mysql search

http://www.weberdev.com/get_example-4236.html is an example that I wrote
that does this

bastien


>From: "Eustace" <[EMAIL PROTECTED]>
>Reply-To: <[EMAIL PROTECTED]>
>To: 
>Subject: [PHP-DB] PHP/Mysql search
>Date: Mon, 22 May 2006 14:58:59 +0200
>
>Hello,
>
>Please be patient and assist meI am building a web application 
>where a search function is required. I have a number of drop down lists 
>from which a user has to select what they are searching for..they may 
>choose to do a multi-fields search or search only one.
>Are there any resources you can point me to which implements something 
>like this?
>
>Eustace
>

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



-- 
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.6/336 - Release Date: 5/10/2006

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



Re: [PHP-DB] PHP/Mysql search

2006-05-22 Thread John Hicks

Miguel Guirao wrote:


CREATIVITY is what you are looking for.


What do you mean by CREATIVITY?

-J


-Original Message-
From: Eustace [mailto:[EMAIL PROTECTED]
Sent: Lunes, 22 de Mayo de 2006 07:59 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] PHP/Mysql search


Hello,

Please be patient and assist meI am building a web application where a
search function is required. I have a number of drop down lists from which a
user has to select what they are searching for..they may choose to do a
multi-fields search or search only one.
Are there any resources you can point me to which implements something like
this?

Eustace



Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.



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



RE: [PHP-DB] PHP/Mysql search

2006-05-22 Thread Bastien Koert
http://www.weberdev.com/get_example-4236.html is an example that I wrote 
that does this


bastien



From: "Eustace" <[EMAIL PROTECTED]>
Reply-To: <[EMAIL PROTECTED]>
To: 
Subject: [PHP-DB] PHP/Mysql search
Date: Mon, 22 May 2006 14:58:59 +0200

Hello,

Please be patient and assist meI am building a web application where a
search function is required. I have a number of drop down lists from which 
a

user has to select what they are searching for..they may choose to do a
multi-fields search or search only one.
Are there any resources you can point me to which implements something like
this?

Eustace



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



RE: [PHP-DB] PHP/Mysql search

2006-05-22 Thread Miguel Guirao


CREATIVITY is what you are looking for.

-Original Message-
From: Eustace [mailto:[EMAIL PROTECTED]
Sent: Lunes, 22 de Mayo de 2006 07:59 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] PHP/Mysql search


Hello,

Please be patient and assist meI am building a web application where a
search function is required. I have a number of drop down lists from which a
user has to select what they are searching for..they may choose to do a
multi-fields search or search only one.
Are there any resources you can point me to which implements something like
this?

Eustace



Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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



[PHP-DB] PHP/Mysql search

2006-05-22 Thread Eustace
Hello,
 
Please be patient and assist meI am building a web application where a
search function is required. I have a number of drop down lists from which a
user has to select what they are searching for..they may choose to do a
multi-fields search or search only one.
Are there any resources you can point me to which implements something like
this?
 
Eustace
 


[PHP-DB] PHP/MySQL/Linux developer needed in Long Beach, CA

2006-03-15 Thread Christian Fea

Hello,

We're looking for a PHP developer to work on-site in Long Beach to  
start immediately.  Job description is below.


Thanks,

Christian


Internet Transaction Services, Inc. - An Internet Paymenet Processing  
company located in Long Beach, CA is looking to hire a contract PHP  
developer to work in our office for a 6 month project. This project  
will be helping us to expand on our risk management system. Possible  
travel to Holland may be required for training. We're looking for  
someone with 2 to 3 years PHP/MySQL/Linux experience. Please email  
your resume to [EMAIL PROTECTED] No third party or agency  
responses please. Looking to fill this position ASAP. This position  
pays $40 to $45 an hour to start with an increase in 60 days.


--
Christian Fea
CTO
Internet Transaction Services, Inc.
[EMAIL PROTECTED]

110 Pine Ave
Suite 1080
Long Beach, CA 90802

Office - 562-951-1122
Skype - christianfea
Yahoo - christianfea





Re: [PHP-DB] PHP, MySQL and Apache

2006-02-27 Thread Luis Morales
Hi kinfe,

To connect to myql from php you only need build your php with mysql
support.

Now, for render vxml documents you are using apache o IIS ? 

I recommend LAMP (Linux+Apache+Myql+Php)

Regards,

Luis Morales 



On Mon, 2006-02-27 at 16:07 +0100, Kinfe Tadesse wrote:
> Hi all,
> 
> I intend to create a database to be accessed from a voice application. I 
> plan to use MySQL as a database engine and PHP as a scripting language to 
> generate dynamic VoiceXML documents. However, I have two questions I could 
> not get answers to:
>  1. Do I need to install Apache to work with MySQL and PHP? In other words, 
> can MySQL and PHP work together without Apache. Note: The database and the 
> application are on the same machine for the timebeing.
> 2. What database API should be used? I recently read about MyODBC. But many 
> standard books skip this part as if PHP and MySQL have something natural to 
> talk to eachother without requiring anything like ODBC, etc.
> 
> Your answers to these questions are highly appreciated!
> 
> Best regards,
> 
> Kinfe T. 
> 
-- 
-
Luis Morales 
Consultor de Tecnologia
Cel: +(58)416-4242091
-
"Empieza por hacer lo necesario, luego lo que es posible... y de pronto
estarás haciendo lo imposible"
-

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



RE: [PHP-DB] PHP, MySQL and Apache

2006-02-27 Thread Miguel Guirao


Answer 1. No, you do not need Apache. You could be using IIS along with PHP
and MySQL if that is what you need! But talking about natural relationships,
there is nothing better that the great combitation formed by XAMP.

Answer 2. There is a MySQL API specially done for PHP, so there is no need
to use another different API. Search for functions like mysql_pconnect(),
mysql_select_db(), mysql_query() and related functions on the php web site.

Chicolinux!!

-Original Message-
From: Kinfe Tadesse [mailto:[EMAIL PROTECTED]
Sent: Lunes, 27 de Febrero de 2006 09:07 a.m.
To: php-db@lists.php.net
Subject: [PHP-DB] PHP, MySQL and Apache


Hi all,

I intend to create a database to be accessed from a voice application. I
plan to use MySQL as a database engine and PHP as a scripting language to
generate dynamic VoiceXML documents. However, I have two questions I could
not get answers to:
 1. Do I need to install Apache to work with MySQL and PHP? In other words,
can MySQL and PHP work together without Apache. Note: The database and the
application are on the same machine for the timebeing.
2. What database API should be used? I recently read about MyODBC. But many
standard books skip this part as if PHP and MySQL have something natural to
talk to eachother without requiring anything like ODBC, etc.

Your answers to these questions are highly appreciated!

Best regards,

Kinfe T.

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


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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



[PHP-DB] PHP, MySQL and Apache

2006-02-27 Thread Kinfe Tadesse

Hi all,

I intend to create a database to be accessed from a voice application. I 
plan to use MySQL as a database engine and PHP as a scripting language to 
generate dynamic VoiceXML documents. However, I have two questions I could 
not get answers to:
1. Do I need to install Apache to work with MySQL and PHP? In other words, 
can MySQL and PHP work together without Apache. Note: The database and the 
application are on the same machine for the timebeing.
2. What database API should be used? I recently read about MyODBC. But many 
standard books skip this part as if PHP and MySQL have something natural to 
talk to eachother without requiring anything like ODBC, etc.


Your answers to these questions are highly appreciated!

Best regards,

Kinfe T. 


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



[PHP-DB] PHP, MySQL, XML books recommendation

2005-07-29 Thread Ng Hwee Hwee
hi guys,

any recommendation on good books or resources for me? I'm totally clueless 
about XML but would love to pick it up now. Any one can give me titles of good 
books?

thanks!!

look forward to hear from you,
hwee

RE: [PHP-DB] Php-MySQL general function for insert, update,delete, count query

2005-06-25 Thread Bastien Koert

I wrote this one and use it in a lot of places

//echo "server is : ".$_SERVER['SERVER_NAME'];	 //use this the first time to 
get the host name...then comment it out or delete to complete the security 
check


//if (($_SERVER['SERVER_NAME']!="www.fishinweather.com")){
if (($_SERVER['SERVER_NAME']!="localhost")){
 echo "piss off, hackers!";
die();
}
function connect($sql)
{

$username   = "*";
$pwd= "";
$host   = "localhost";
$dbname = "test";
/*
$username   = "fishinwe_alton";
$pwd= "cooperaz";
$host   = "localhost";
$dbname = "fishinwe_fishinweather";
*/
if (!($conn=mysql_connect($host, $username, $pwd)))  {
  printf("error connecting to DB. ");
  exit;
}
	$db=mysql_select_db($dbname,$conn) or die("Unable to connect to 
database1".mysql_error());


$result = mysql_query($sql, $conn);
if (!$result){
echo "database query failed: ". mysql_error();
}else{
return $result;
    }//end if
}//end function
?>


bastien


From: "Rasim ÞEN" <[EMAIL PROTECTED]>
Reply-To: "Rasim ÞEN" <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] Php-MySQL  general function for insert, update,delete, 
count query

Date: Sat, 25 Jun 2005 17:52:31 +0300

Hi friends,

I am using one perfect function for my queries for PHP+Oracle pages, this 
is

below

==
function sorgu($sql)
{
global $baglanti;
$stmt=ociparse($baglanti,$sql);
$sonuc=ociexecute($stmt,OCI_DEFAULT);

$erra=OCIError();
$e=$erra['message'];

$sorgutipi=ocistatementtype($stmt);
$kayit_dizi=array();
$kayit_sayisi=-1;
if($sonuc)
{
if($sorgutipi=="SELECT")
{
$kayit_sayisi =
OCIFetchStatement($stmt,$kayit_dizi,0,-1,OCI_FETCHSTATEMENT_BY_ROW);
}
else
{
$kayit_sayisi = ocirowcount($stmt);
}
}
return array($sonuc,$kayit_sayisi,$kayit_dizi);
}

==


I am using it for every kind of oracle db query. So my all queries under my
control.


Now I am looking for one function with PHP+MySQL

Anybody know like short function as above php+oracle function? I am using
some function sets they are using much database queries. I want to use min.
query and connection.


Thanks alot.

Rasim
[EMAIL PROTECTED]

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



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



[PHP-DB] Php-MySQL general function for insert, update,delete, count query

2005-06-25 Thread Rasim �EN
Hi friends,

I am using one perfect function for my queries for PHP+Oracle pages, this is
below

==
function sorgu($sql)
{
global $baglanti;
$stmt=ociparse($baglanti,$sql);
$sonuc=ociexecute($stmt,OCI_DEFAULT);

$erra=OCIError();
$e=$erra['message'];

$sorgutipi=ocistatementtype($stmt);
$kayit_dizi=array();
$kayit_sayisi=-1;
if($sonuc)
{
if($sorgutipi=="SELECT")
{
$kayit_sayisi =
OCIFetchStatement($stmt,$kayit_dizi,0,-1,OCI_FETCHSTATEMENT_BY_ROW);
}
else
{
$kayit_sayisi = ocirowcount($stmt);
}
}
return array($sonuc,$kayit_sayisi,$kayit_dizi);
}

==


I am using it for every kind of oracle db query. So my all queries under my
control.


Now I am looking for one function with PHP+MySQL

Anybody know like short function as above php+oracle function? I am using
some function sets they are using much database queries. I want to use min.
query and connection.


Thanks alot.

Rasim
[EMAIL PROTECTED]

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



RE: [PHP-DB] PHP/MySQL with Javascript

2005-06-15 Thread Bastien Koert

you can supply the value to js as a hidden variable in the form

bastien



From: "Chris Payne" <[EMAIL PROTECTED]>
To: 
Subject: [PHP-DB] PHP/MySQL with Javascript
Date: Wed, 15 Jun 2005 16:55:32 -0400

Hi there everyone,



Just a quick question, I have a login system that stores whether you are
logged in or not with a PHP Session.  However, I need it so when people
submit a form to add an item to their cart that Javascript can pickup the
PHP Value of whether people are logged in or not.  I don't really need code
as I don't want to take anyones time up, but if someone could point me in
the right direction of how I can use PHP Values in Javascript I would 
REALLY

appreciate it.



Chris



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



Re: [PHP-DB] PHP/MySQL with Javascript

2005-06-15 Thread Frank M. Kromann
You can have PHP generate a small javascript section where you define the
variables or you can use cookies.

- Frank

> Hi there everyone,
> 
>  
> 
> Just a quick question, I have a login system that stores whether you
are
> logged in or not with a PHP Session.  However, I need it so when people
> submit a form to add an item to their cart that Javascript can pickup
the
> PHP Value of whether people are logged in or not.  I don't really need
code
> as I don't want to take anyones time up, but if someone could point me
in
> the right direction of how I can use PHP Values in Javascript I would
REALLY
> appreciate it.
> 
>  
> 
> Chris
> 
> 

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



[PHP-DB] PHP/MySQL with Javascript

2005-06-15 Thread Chris Payne
Hi there everyone,

 

Just a quick question, I have a login system that stores whether you are
logged in or not with a PHP Session.  However, I need it so when people
submit a form to add an item to their cart that Javascript can pickup the
PHP Value of whether people are logged in or not.  I don't really need code
as I don't want to take anyones time up, but if someone could point me in
the right direction of how I can use PHP Values in Javascript I would REALLY
appreciate it.

 

Chris



[PHP-DB] PHP/MySQL Access Denied

2005-06-08 Thread Tod B. Schmidt

Everybody's favorite problem but this one is strange. I can connect to my mysql 
4.1.7 database fine from the command line, but php won't connect no matter what 
I try, I always get the same error.

Here is the script

close();
?>

This is what I get, doesn't matter what username/password I use, or whether I 
use a socket or TCP/IP to connect.

Access denied for user 'root'@'localhost' (using password: NO)


I find it annoying that it insists I am trying to connect as root with no 
password, when that is not the case. I know about the 4.1 password issues and 
that should not have anything to do with this error. It also does this if I set 
the passwords to NULL in the script and database.

Anyone have any help for me?

Tod Schmidt
System Administrator
The Nature Conservancy
[EMAIL PROTECTED]
(703) 841-2028 (Phone)
(703) 276-0713 (Fax)
 

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



RE: [PHP-DB] PHP&MySQL left/substring etc problem

2005-04-18 Thread Juffermans, Jos
If you do "SELECT LEFT(loc1,3) FROM openart_table" the column name in $row
(Bis probably not "loc1". Try this: "SELECT LEFT(loc1,3) AS loc1 FROM
(Bopenart_table". Also, after the fetch you can do some debuggin thru this:
(B
(B"; print_r($row); print "";
(B?>
(B
(BThat prints out a list of all the keys and values of $row and tells you what
(Bcolumns you're receiving (and their names).
(B
(BJos
(B
(B-Original Message-
(BFrom: Sugimoto [mailto:[EMAIL PROTECTED]
(BSent: 19 April 2005 07:58
(BTo: php-db@lists.php.net
(BSubject: [PHP-DB] PHP&MySQL left/substring etc problem
(B
(B
(BHello,
(BI need your help about PHP (ver 4.3.1) and MySQL (ver 3.23) database.
(BI am struggling to customise a database (using left command etc), and am
(Bstuck now.
(BPlease have a brief look at my scripts below.
(B
(BWhat I do like to do is to get first 3 letters from "loc1" column from
(Bopenart_table (MySQL).
(BAnd show the data in the follwoing part...
(B  
(B
(Bbut also I would like to make hyperlinks to jpg files to images/"the first 3
(Bletters from loc1".jpg
(BSo it will be something like this...
(B  
(B  .jpg">
(B  
(B
(BBut when I tried, "select left (loc1,3) from openart_table where.."
(Bdoesnt work properly.
(BI do not want to destroy anything for the rest of the table.
(BI need all data from "tit1", "pub1", "id1", and "ref1" in each column.
(B
(BCould you help me, please?
(B
(B-PHP script from here
(B
(B
(B
(B
(BID No
(BBook Title
(BPublisher
(BID
(BReference
(BLocation
(B
(B
(B";
(B while($row = mysql_fetch_array($result)){
(B  ?>
(B  
(B  ">
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B
(B
(B
(B
(Bend of script
(B
(B-- 
(BPHP Database Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php
(B
(B-- 
(BPHP Database Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] PHP&MySQL left/substring etc problem

2005-04-18 Thread Andrés G . Montañez
> But when I tried, "select left (loc1,3) from openart_table where.."

Try without the space between 'left' and '(',
I mean... LEFT(loc1, 3)
where loc1 is the name of the column,
and 3 the characters you want to show.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

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



[PHP-DB] PHP&MySQL left/substring etc problem

2005-04-18 Thread Sugimoto
Hello,
(BI need your help about PHP (ver 4.3.1) and MySQL (ver 3.23) database.
(BI am struggling to customise a database (using left command etc), and am
(Bstuck now.
(BPlease have a brief look at my scripts below.
(B
(BWhat I do like to do is to get first 3 letters from "loc1" column from
(Bopenart_table (MySQL).
(BAnd show the data in the follwoing part...
(B  
(B
(Bbut also I would like to make hyperlinks to jpg files to images/"the first 3
(Bletters from loc1".jpg
(BSo it will be something like this...
(B  
(B  .jpg">
(B  
(B
(BBut when I tried, "select left (loc1,3) from openart_table where.."
(Bdoesnt work properly.
(BI do not want to destroy anything for the rest of the table.
(BI need all data from "tit1", "pub1", "id1", and "ref1" in each column.
(B
(BCould you help me, please?
(B
(B-PHP script from here
(B
(B
(B
(B
(BID No
(BBook Title
(BPublisher
(BID
(BReference
(BLocation
(B
(B
(B";
(B while($row = mysql_fetch_array($result)){
(B  ?>
(B  
(B  ">
(B  
(B  
(B  
(B  
(B  
(B  
(B  
(B
(B
(B
(B
(Bend of script
(B
(B-- 
(BPHP Database Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] PHP, MySQL and phpMyAdmin versions...

2004-12-17 Thread Norland, Martin
> -Original Message-
> From: Bastien Koert [mailto:[EMAIL PROTECTED]
>
> huh? you can and should be able to upgrade to 4.0.x without too many 
> problems. PHP 4.3.9 has no problems with that, nor will PHPMyAdmin.
Moving 
> to mySQL 4.1 will involve more pain as the protocols are vastly
different 
> and uses a different php library (mysqli).

Which will, however, be almost completely pointless as the functionality
he wants is only in 4.1.

Also, it's not painful moving to mysql 4.1 at all - you can still use
the mysql_* functions just fine.  Mysqli_* functions are an option, not
a requirement.  Still, surely it can't be that hard to find mysql 4.1
for NT...

http://dev.mysql.com/downloads/mysql/4.1.html#Windows

Definitely read up on those upgrade/release notes!

Windows binaries for php 4.10 / php 5 - these should be new enough to
work with however the libraries bit works, so you'd just need to find
the php mysql[i] windows library, driver, etc. whatever they call it.
http://www.php.net/downloads.php


Installing phpmyadmin is nothing, you just drop it in place essentially
- works fine with php5 and mysql4.1 here.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


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



RE: [PHP-DB] PHP, MySQL and phpMyAdmin versions...

2004-12-17 Thread Bastien Koert
huh? you can and should be able to upgrade to 4.0.x without too many 
problems. PHP 4.3.9 has no problems with that, nor will PHPMyAdmin. Moving 
to mySQL 4.1 will involve more pain as the protocols are vastly different 
and uses a different php library (mysqli).

For upgrade info see here (http://dev.mysql.com/doc/mysql/en/Upgrade.html)
What you might want to do, is back up your v3 db. then install 4.0.x (they 
can co-exist on the same machine). Configure PHP and PHPMyAdmin to handle 
the new server as well, then migrate the data to the new server (in the case 
of MyISAM tables, just copy the folders from the v3 db to the data folder in 
the v4 db)

hth
bastien
From: Mark Benson <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP, MySQL and phpMyAdmin versions...
Date: Fri, 17 Dec 2004 15:58:08 +
I am running MySQL 3.23.49 under Windows NT (XP Home). I also run PHP 4.3.9 
on the same server, and use phpMyAdmin 2.6.0-pl2 for admin to my databases. 
I cannot upgrade to MySQL 4.x becuase apparently the MySQL API included 
with my PHP distro is not up to date enough to work with the revised 
security system in MySQL 4. I can't find a newer or better binary distro of 
PHP4 with a more suitable API, nor do i have the time, facilities or 
knowledge to bake my own from the source.

Any suggestions, as I really need some of the facilities in MySQL 4.1.x?
P.S. for Matrin Nowland - thanks for the help on the 'ON DUPLICATE KEY 
UPDATE' thing, I didn't realise it was a new thing in MySQL 4.1.0! 

--
Mark Benson
http://homepage.mac.com/markbenson
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] PHP, MySQL and phpMyAdmin versions...

2004-12-17 Thread Mark Benson
I am running MySQL 3.23.49 under Windows NT (XP Home). I also run PHP 4.3.9 on 
the same server, and use phpMyAdmin 2.6.0-pl2 for admin to my databases. I 
cannot upgrade to MySQL 4.x becuase apparently the MySQL API included with my 
PHP distro is not up to date enough to work with the revised security system in 
MySQL 4. I can't find a newer or better binary distro of PHP4 with a more 
suitable API, nor do i have the time, facilities or knowledge to bake my own 
from the source.

Any suggestions, as I really need some of the facilities in MySQL 4.1.x?

P.S. for Matrin Nowland - thanks for the help on the 'ON DUPLICATE KEY UPDATE' 
thing, I didn't realise it was a new thing in MySQL 4.1.0! 

-- 
Mark Benson

http://homepage.mac.com/markbenson

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



Re: [PHP-DB] php mysql dates

2004-07-28 Thread zareef ahmed
Dear Irm Jr,

Here are two functions::

http::/www.php.net/strtotime
http::/www.php.net/mktime

using these functions togethor you can do the need
full.

BTW why not store just unix time stamp in mysql
database. Most People use a string field in mysql
database to store timestamp, it simply work without
any problem.

zareef ahmed


--- Irm Jr <[EMAIL PROTECTED]> wrote:

>  
> Hi all, currently I have a form which prompts for
> the user to choose a
> date.  The dropdown lists are stored into variables:
>  
> $month//e.g. January, February, ...
> $day   //e.g 1 - 31
> $year  //e.g. 2004 (four digits)
>  
> then combined into 
>  
> $articleDate
>  
> How can I manipulate this variable to be in such a
> format that I can
> insert the information into a DATE column in a mySQL
> database.
>  
> Dates are a bit of a mystery to me as PHP and MySQL
> handle them
> differently.  Your help is appreciated. 
>  
> Thanks
> 


=
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com



__
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

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



RE: [PHP-DB] php mysql dates

2004-07-28 Thread Irm Jr
 
Thanks for the replies.  I believe I have two solutions now!  
Take care.  Much apprecitated.


-Original Message-
From: Swan, Nicole [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 28, 2004 2:48 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] php mysql dates

I would suggest creating the select dropdown so that the value is
actually the numeric value of the month. i.e:


January
February
.
.
.


Then you can do a simple concat before adding to the database.

--Nicole



---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310


-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 28, 2004 3:44 PM
To: Irm Jr
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] php mysql dates


On Wed, 28 Jul 2004 14:39:01 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> Sure I understand Y-m-d.  But won't the database cry because the Month

> is in text format? (January, february)?  Thanks again.
> 

Whoops, I should read *all* the text of the question...

Easiest way to deal with that, IMHO, is strtotime and date.

$mysqlDate = date('Y-m-d', strtotime($month.' '.$day.', '.$year));

If you're using dates far in the past or future, though, this won't
work. Better to use a date handling class, such as:

http://pear.php.net/package/Date

> Subject: Re: [PHP-DB] php mysql dates
> 
> 
> 
> On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> >
> > Hi all, currently I have a form which prompts for the user to choose

> > a
> 
> > date.  The dropdown lists are stored into variables:
> >
> > $month//e.g. January, February, ...
> > $day   //e.g 1 - 31
> > $year  //e.g. 2004 (four digits)
> >
> > then combined into
> >
> > $articleDate
> >
> > How can I manipulate this variable to be in such a format that I can

> > insert the information into a DATE column in a mySQL database.
> >
> > Dates are a bit of a mystery to me as PHP and MySQL handle them 
> > differently.  Your help is appreciated.
> >
> 
> Y-m-d
> 
> --
> DB_DataObject_FormBuilder - The database at your fingertips 
> http://pear.php.net/package/DB_DataObject_FormBuilder
> 
> paperCrane --Justin Patrin--
> 

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

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

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



RE: [PHP-DB] php mysql dates

2004-07-28 Thread Swan, Nicole
I would suggest creating the select dropdown so that the value is actually the numeric 
value of the month. i.e:


January
February
.
.
.


Then you can do a simple concat before adding to the database.

--Nicole

---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310


-Original Message-
From: Justin Patrin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 28, 2004 3:44 PM
To: Irm Jr
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] php mysql dates


On Wed, 28 Jul 2004 14:39:01 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> Sure I understand Y-m-d.  But won't the database cry because the Month
> is in text format? (January, february)?  Thanks again.
> 

Whoops, I should read *all* the text of the question...

Easiest way to deal with that, IMHO, is strtotime and date.

$mysqlDate = date('Y-m-d', strtotime($month.' '.$day.', '.$year));

If you're using dates far in the past or future, though, this won't
work. Better to use a date handling class, such as:

http://pear.php.net/package/Date

> Subject: Re: [PHP-DB] php mysql dates
> 
> 
> 
> On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> >
> > Hi all, currently I have a form which prompts for the user to choose a
> 
> > date.  The dropdown lists are stored into variables:
> >
> > $month//e.g. January, February, ...
> > $day   //e.g 1 - 31
> > $year  //e.g. 2004 (four digits)
> >
> > then combined into
> >
> > $articleDate
> >
> > How can I manipulate this variable to be in such a format that I can
> > insert the information into a DATE column in a mySQL database.
> >
> > Dates are a bit of a mystery to me as PHP and MySQL handle them
> > differently.  Your help is appreciated.
> >
> 
> Y-m-d
> 
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
> 
> paperCrane --Justin Patrin--
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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

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



Re: [PHP-DB] php mysql dates

2004-07-28 Thread Justin Patrin
On Wed, 28 Jul 2004 14:39:01 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> Sure I understand Y-m-d.  But won't the database cry because the Month
> is in text format? (January, february)?  Thanks again.
> 

Whoops, I should read *all* the text of the question...

Easiest way to deal with that, IMHO, is strtotime and date.

$mysqlDate = date('Y-m-d', strtotime($month.' '.$day.', '.$year));

If you're using dates far in the past or future, though, this won't
work. Better to use a date handling class, such as:

http://pear.php.net/package/Date

> Subject: Re: [PHP-DB] php mysql dates
> 
> 
> 
> On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> >
> > Hi all, currently I have a form which prompts for the user to choose a
> 
> > date.  The dropdown lists are stored into variables:
> >
> > $month//e.g. January, February, ...
> > $day   //e.g 1 - 31
> > $year  //e.g. 2004 (four digits)
> >
> > then combined into
> >
> > $articleDate
> >
> > How can I manipulate this variable to be in such a format that I can
> > insert the information into a DATE column in a mySQL database.
> >
> > Dates are a bit of a mystery to me as PHP and MySQL handle them
> > differently.  Your help is appreciated.
> >
> 
> Y-m-d
> 
> --
> DB_DataObject_FormBuilder - The database at your fingertips
> http://pear.php.net/package/DB_DataObject_FormBuilder
> 
> paperCrane --Justin Patrin--
> 

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



RE: [PHP-DB] php mysql dates

2004-07-28 Thread Irm Jr
Sure I understand Y-m-d.  But won't the database cry because the Month
is in text format? (January, february)?  Thanks again.  



Subject: Re: [PHP-DB] php mysql dates

On Wed, 28 Jul 2004 14:30:24 -0700, Irm Jr <[EMAIL PROTECTED]> wrote:
> 
> Hi all, currently I have a form which prompts for the user to choose a

> date.  The dropdown lists are stored into variables:
> 
> $month//e.g. January, February, ...
> $day   //e.g 1 - 31
> $year  //e.g. 2004 (four digits)
> 
> then combined into
> 
> $articleDate
> 
> How can I manipulate this variable to be in such a format that I can 
> insert the information into a DATE column in a mySQL database.
> 
> Dates are a bit of a mystery to me as PHP and MySQL handle them 
> differently.  Your help is appreciated.
> 

Y-m-d

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



[PHP-DB] php mysql dates

2004-07-28 Thread Irm Jr
 
Hi all, currently I have a form which prompts for the user to choose a
date.  The dropdown lists are stored into variables:
 
$month//e.g. January, February, ...
$day   //e.g 1 - 31
$year  //e.g. 2004 (four digits)
 
then combined into 
 
$articleDate
 
How can I manipulate this variable to be in such a format that I can
insert the information into a DATE column in a mySQL database.
 
Dates are a bit of a mystery to me as PHP and MySQL handle them
differently.  Your help is appreciated. 
 
Thanks


[PHP-DB] php/mysql error

2004-07-27 Thread redhat
I am getting a weird error on one of my servers that says something
about "query requires full tablescan".  I was not getting this error
until today that I noticed.  I Googled for a minute and saw where a ton
of other sites had the same problem but no "reason" why.  I did find one
board that said to turn off "mysql.trace_mode" in the php.ini file.  I
did this and it fixed the problem.  Is there something different that I
should be doing when I write code?  Have I just "band aided" the problem
or solved the problem?
thanks,
Doug

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



[PHP-DB] Php-Mysql, select and update trouble

2004-06-27 Thread Alessandro Folghera
Dear Phpers,

I have the following part of a script that retrieve an URL site. I'd like
to count the clicks for every URL. I have added to mysql table a column
"hit". May anybody tell me how to insert into an sql selection also an
update, referring to the HIT variable (i.e. to realize a select and update
together) ?

This is the select I'm using:



This should be (I suppose) the sql update I must include ... UPDATE
table.sites SET hit = hit + 1 WHERE id=$s 

Thanks for all, Alessandro

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



[PHP-DB] PHP/MySQL learning project

2004-06-10 Thread news.php.net
Hi everyone!

In trying to learn PHP and MySQL, I'm trying to create a web-based database
application that will keep track of my movies.  I have five tables (shown in
the graphic).  I'm trying to be able to display the results of the tables
with one movie title, all of the actors associated with it, and all of the
genre's associated with it.

Of course I can do the query:
  Select *
  From MovieMain, MovieActor, MovieGenre, Genre, Actors
  Where MovieMain.MovieID=MovieGenre.MovieID
  And MovieMain.MovieID=MovieActor.MovieID
  And MovieActor.ActorID=Actors.ActorID
  And MovieGenre.GenreID=Genre.GenreID

But that displays the movie title for every genre and actor there is.  Is
there another way to perform the query that will display the title once, and
all of the associated genres and all of the associated actors for that
movie?  Or should I try to code it using PHP to find the movie title first?

Thanks in advance, everyone!


begin 666 Drawing1.jpg
M_]C_X `02D9)[EMAIL PROTECTED] [EMAIL PROTECTED]@&!@<&!0@'!P<)"[EMAIL PROTECTED] L+
M#!D2$P\4'1H?'AT:'!P@)"XG("(L(QP<*#7J#A(6&AXB)BI*3E)66EYB9FJ*CI*6FIZBIJK*SM+6VM[BYNL+#Q,7&
MQ\C)RM+3U-76U]C9VN'BX^3EYN?HZ>KQ\O/T]?;W^/GZ_\0`'P$``P$!`0$!
M`0$!`0$"`P0%!@<("[EMAIL PROTECTED]"! 0#! <%! 0``0)W``$"
M`Q$$!2$Q!A)!40=A<1,B,H$(%$*1H;'!"2,S4O 58G+1"A8D-.$E\1<8&1HF
M)[EMAIL PROTECTED]@Y.D-$149'2$E*4U155E=865IC9&5F9VAI:G-T=79W>'[EMAIL PROTECTED]
MA8:'B(F*DI.4E9:7F)F:HJ.DI::GJ*FJLK.TM;:WN+FZPL/$Q<;'R,G*TM/4
MU=;7V-G:XN/DY>;GZ.GJ\O/T]?;W^/GZ_]H`# ,!``(1`Q$`/P#H=)T^._T]
M;JYN;]YI))"S?;YAGYV[!\5=_L.T_P">M_\`^#"?_P"+IOAW_D"0_P"_)_Z&
MU:E &;_8=I_SUO\`_P`&$_\`\71_8=I_SUO_`/P83_\`Q=:5% &;_8=I_P`]
M;_\`\&$__P`71_8=I_SUO_\`P83_`/Q=.UV[FL- U"[MQF:&W>1.,\A20<5A
MW%K::,]EM_\`^#"?
M_P"+H_L.T_YZW_\`X,)__BZR(_$UY-J4BQ6KO;I>FT,:6<[EMAIL PROTECTED]:3S0-G!R=
MOH.N>*=I.N:I>?V=<7*68MKVYFMPD:L'38)"&[EMAIL PROTECTED]&.,[EMAIL PROTECTED]">
MM_\`^#"?_P"+H_L.T_YZW_\`X,)__BZY^+Q1JIT_2I)TMEFU-3)'Y-M+-Y2*
MN3E%.YCRO3 &3Z<]%HU]-J.G+-<6[PS!V1E:-H]V#C<`P! (P>>F<=J &_V'
M:?\`/6__`/!A/_\`%T?V':?\];__`,&$_P#\76E10!F_V':?\];_`/\`!A/_
M`/%T?V':?\];_P#\&$__`,76E10!M^ I))/!MH999)666= [EMAIL PROTECTED] 
M`'X5TE&S221?"2)XI9(I!IT6'C8JPX7H1TH`Z'^P[3_G
[EMAIL PROTECTED]/[#M/\`GK?_`/@PG_\`BZY2[U*]N-+TRS%S(MU8W*"^D1R"
MQCF6( G_`&]V_P!PM;;:W?A9+[R[;[ E]]C,6&,I'F^5OW9P/FYVXZ=Z`-#^
MP[3_`)ZW_P#X,)__`([EMAIL PROTECTED];"XMS!$;N!+LW:@L
MH1(E.TC!R-VZ(CGH3Z5$?%-ZIE2VM&D%I#"6B6UGF:=FC5R!(N0G# #=G)ZX
M'- &_P#V':?\];__`,&$_P#\71_8=I_SUO\`_P`&$_\`\760\,>JW^KS7B7=
MR+.9(H+."4QD+Y:MOQN7))<\GH%XJ"+Q%)!;V5C:FZ:1C<;Y;NUDN9$$3[-K
M+$22M_P#^#"?_`.+K(M]<
MUG4+RTM;>VM[266SDN)/M44F0RR;,![EMAIL PROTECTED]/^>M_P#^#"?_`.+K3\'1?8_%U];13W+0
M&PCDV37$DHW>8PR-Q..*Y[1-:O;Z[2&ZMV*20>;YJV.E=+X8_P"1XO/^P;'_`.C&H [EMAIL PROTECTED]  /,M5M1J'C+71<7%X5
MAEA2-8[N6-5!A0D`*P'4D_C4?]AVG_/6_P#_``83_P#Q=6Y_^1R\1_\`7>#_
M`-$1U/0!F_V':?\`/6__`/!A/_\`%T?V':?\];__`,&$_P#\76E7%#4Y=-\>
M:I/=7,G]G$+"R,YV1L(1("!VR%D''4D4`='_`&':?\];_P#\&$__`,71_8=I
M_P`];_\`\&$__P`77/:/?:G;)+:NP:_O=2Q_I)9EM]UNDS+C.2%^8!01]16A
M'XAN()@M^END4-W):7,R9"AO+$B.`2<[EMAIL PROTECTED](.>2.:`-'^P[3_`)ZW_P#X,)__
M`([EMAIL PROTECTED])?%%U;R+6UWB20 X5^01WP2,$>M '2_V':?\`
M/6__`/!A/_\`%T?V':?\];__`,&$_P#\77-OK%SJUWH,L@#5_L
M.T_YZW__`(,)[EMAIL PROTECTED])M/A%DEI&D6DQ7K>?
MYDA).\; 2V^>.LM9_M5G!<;=OFQJ^W.<9&<4`4_[#M/^>M__`.#"
[EMAIL PROTECTED]/BZTJ* -GP"[EMAIL PROTECTED]<748:5R[;5N)%4$D
MDG `'/I735S'P_\`^10B_P"OR\_]*I:Z>@```.0\>2W &B6T%Y_P!2O+/QY;)Y[?V;Q1'&ZWLD4BVJ0WDBE901(D+(
M-V,=^<<\#USPMGXRM9%NC<_9E%O:M=LUM<>&V&HDP.K
ME$*Y>,[EMAIL PROTECTED]P>P(Y//'(!M
M?V;+_P!!G6__``93?_%4?V;+_P!!G6__``93?_%5FW'[EMAIL PROTECTED]<
M2^>0^[Y=Q1=OS!=WSCAMH9Y8$<3[FFPK--&DVHQQR>3*T99=KG&5(.,@?E76UR7C[_CQ
MTC_L*1?^@/0!S?\`8=I_SUO_`/P83_\`Q=']AVG_`#UO_P#P83__`!=:5% &
M;_8=I_SUO_\`P83_`/Q=']AVG_/6_P#_``83_P#Q=:5%`&;_`&':?\];_P#\
M&$__`,71_8=I_P`];_\`\&$__P`77,P:_GQ2M[Y]R;6>Z:P$6Q_*"8 20-C9
MDR!AUSAQZ5MVNH:I?$W,'V%+1IY8$24-O&[EMAIL PROTECTED]/RX'!ZT 6_P"P[3_G
[EMAIL PROTECTED]/[#M/\`GK?_`/@PG_\`BZP=!U76+S3M,LXYK5KMM/6[FN+A
M&8,"2%7 8')PC?^ 4O_QV@"S15;^P_%7_`$$]
M&_\``*7_`..T?V'XJ_Z">C?^`4O_`,=H`L,H92K %2,$'H:R(O"[EMAIL PROTECTED],
M<+!XH&N)&BC8'(*QEMHP>G'&.*O_`-A^*O\`H)Z-_P" 4O\`\=H_L/Q5_P!!
M/1O_``"E_P#CM %9M!TY[T71A;?YHGV"5Q&9!TO/#MU]:?_8?BK_H)Z-_X!2__':/[#\5?]!/1O\`P"E_
M^.T`5WT/3VL;:S$3QQ6H`@,!CAP=W3CKSWJU9V=O86RV]M'LB4DXR6)
M).223R3S3?[#\5?]!/1O_ *7_P".T?V'XJ_Z">C?^ 4O_P`=H LT56_L
M/Q5_T$]&_P# *7_X[1_8?BK_`*">[EMAIL PROTECTED]/':`+-%5O[#\5?]!/1O_ *7
M_P".T?V'XJ_Z">C?^ 4O_P`=H Z+X?\`_(FVO_7>Y_\`1\E=-7,?#U)(_!=H
MDS(TJSW(=D! )\^3. 2<"NGH` "[EMAIL PROTECTED]'0;.WU#P-IEI=1^9!)91!T
MR1D;1W'->O5Y#X7T?Q)+X4TF2WU'24A:TC*+)9R,P7:,`D2 [EMAIL PROTECTED]
M[J8VP\R[>-YVW'YS'@H>O&,#I3#H6G&]^U>2V_S1-L$K",R?W]F=N[WQUYZU
M9_L/Q5_T$]&_\ I?_CM'[EMAIL PROTECTED]@%+_\=H B?1]/DGO9VME,M]$(;ALG
M,B $8Z\<'M[>@J"[EMAIL PROTECTED]'^UGTZ5<_L/Q5_P!!
M/1O_``"E_P#CM'[EMAIL PROTECTED]@%+_P#': *]YH=A>W1NI$ECN"H1I;>=X690
MC?^ 4O_QV@".UTBPLI8I+:W6-X83 A!/"$[B.O))&23R?
[EMAIL PROTECTED]"BV2TVL2P,29VJ03S]X^YSS4G]A^*O\`H)Z-_P" 4O\

[PHP-DB] PHP / MySQL Developer

2004-05-19 Thread Kenny
Hi All,
 
This is just a request to all you programmers out there,
 
I have been programming using PHP/MySql for approx 5 years now.
I was involved in a motor car accident last year October and I broke my
back in 3 places, this has left me paralyzed from the waist down but
luckily my I can still code.
 
What I am looking for is any freelance work that you may be able to
throw my way
 
I am prepared to do anything 
 
Please mail me
 
Regards
 
Kenny
[EMAIL PROTECTED]
 


Re: [PHP-DB] php-mysql problem

2004-05-13 Thread Stefan Dengscherz
hello,

did you load the mysql module in your php.ini configuration file?
i.e. is the following line there:
extension=mysql.so

regards

On Thu, 13 May 2004 11:47:41 -0400
Jianping Zhu <[EMAIL PROTECTED]> wrote:

>  have redhat 9.0 and Server version: Apache/2.0.40.
>   i have installed rpms php-4.2.2-17.2.i386.rpm
>php-mysql-4.2.2-17.2.i386.rpm
> 
> 
>After i create a database called mydb and serveral tables in mysql,
>I tried to run following testdb.php script
> 
> 
>--
>
>
>$db = mysql_connect("localhost", "root","xx");
>mysql_select_db("mydb",$db);
>$result = mysql_query("SELECT * FROM employees",$db);
>printf("First Name: %s\n", mysql_result($result,0,"first"));
>printf("Last Name: %s\n", mysql_result($result,0,"last"));
>printf("Address: %s\n", mysql_result($result,0,"address"));
>printf("Position: %s\n", mysql_result($result,0,"position"));
>?>
>
>
>---
> 
>but i got error message with:
>http://coopunit.forestry.uga.edu:8080/testdb.php
>the error is:
>Fatal error: Call to undefined function:
>mysql_connect() in /var/www/html/testdb.php on line 13
> 
>How can Fix this problem? Thanks
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



[PHP-DB] php-mysql problem

2004-05-13 Thread Jianping Zhu
 have redhat 9.0 and Server version: Apache/2.0.40.
  i have installed rpms php-4.2.2-17.2.i386.rpm
   php-mysql-4.2.2-17.2.i386.rpm


   After i create a database called mydb and serveral tables in mysql,
   I tried to run following testdb.php script


   --
   
   
   \n", mysql_result($result,0,"first"));
   printf("Last Name: %s\n", mysql_result($result,0,"last"));
   printf("Address: %s\n", mysql_result($result,0,"address"));
   printf("Position: %s\n", mysql_result($result,0,"position"));
   ?>
   
   
   ---

   but i got error message with:
   http://coopunit.forestry.uga.edu:8080/testdb.php
   the error is:
   Fatal error: Call to undefined function:
   mysql_connect() in /var/www/html/testdb.php on line 13

   How can Fix this problem? Thanks

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



  1   2   3   4   >