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



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



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



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['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 Nabb

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


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



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



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



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



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



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!
> 


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



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



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



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



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



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



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


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



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



Re: [Fwd: Re: [PHP-DB] php, mysql security question]

2004-03-31 Thread JeRRy
Doug,

No worries, thanks for the link.

J

 --- Doug Thompson <[EMAIL PROTECTED]> wrote: >
Oops.  For some reason my filter concluded your
> email was spam and it modifies the subject line.  I
> missed  cleaning the subject line on the first
> reply.  Here is is again in case others filter on
> that keyword.  I apologize for the double post and
> possible confusion.
> \Doug
> 
> JeRRy wrote:
> >  
> > Hi,
> > 
> > I have a php, mysql security question.
> > 
> > You know how there is a way to enable/disable hot
> > linking to your images via CPanel to
> allow/disallow
> > people to link to your images from an external
> site? 
> > Well is there a way to allow/disable external
> sites
> > connecting to a mysql via PHP?
> > 
> > So is there a way to allow only localhost access
> to
> > the db's somehow?
> > 
> > I wonder this to add extra security to my db's and
> not
> > only that to educate others on this list if it is
> > possible or not.
> > 
> > Thanks for your time.
> > 
> > J
> 
> Even if your db server doesn't sit behind a
> firewall, you can always restrict what
> userid/password/address combinations can gain access
> to what DB / Tables / Columns and what functions
> they can perform (select, insert, update, etc.) in
> those areas using the MySQL administration features.
>  I have different PHPUsers for my scripts that have
> varying levels of authorization to coincide with
> what the scripts need to do -- Select (read only),
> Update (can only revise existing records), Insert
> (can add new new records), etc.  All the db_connect
> scripts are well_outside the public areas to
> minimize opportunities to compromise the userid/pw.
> 
> Start here: 
> http://www.mysql.com/doc/en/Security.html
> 
> All of which forces the conclusion that this isn't a
> PHP issue at all.
> 
> 
> DT
>  

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

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



[Fwd: Re: [PHP-DB] php, mysql security question]

2004-03-31 Thread Doug Thompson
Oops.  For some reason my filter concluded your email was spam and it modifies the 
subject line.  I missed  cleaning the subject line on the first reply.  Here is is 
again in case others filter on that keyword.  I apologize for the double post and 
possible confusion.
\Doug
JeRRy wrote:
 
Hi,

I have a php, mysql security question.

You know how there is a way to enable/disable hot
linking to your images via CPanel to allow/disallow
people to link to your images from an external site? 
Well is there a way to allow/disable external sites
connecting to a mysql via PHP?

So is there a way to allow only localhost access to
the db's somehow?
I wonder this to add extra security to my db's and not
only that to educate others on this list if it is
possible or not.
Thanks for your time.

J
Even if your db server doesn't sit behind a firewall, you can always restrict what userid/password/address combinations can gain access to what DB / Tables / Columns and what functions they can perform (select, insert, update, etc.) in those areas using the MySQL administration features.  I have different PHPUsers for my scripts that have varying levels of authorization to coincide with what the scripts need to do -- Select (read only), Update (can only revise existing records), Insert (can add new new records), etc.  All the db_connect scripts are well_outside the public areas to minimize opportunities to compromise the userid/pw.

Start here:  http://www.mysql.com/doc/en/Security.html

All of which forces the conclusion that this isn't a PHP issue at all.

DT

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


Re: [PHP-DB] php, mysql security question

2004-03-31 Thread John Holmes
JeRRy wrote:

You know how there is a way to enable/disable hot
linking to your images via CPanel to allow/disallow
people to link to your images from an external site? 
Well is there a way to allow/disable external sites
connecting to a mysql via PHP?

So is there a way to allow only localhost access to
the db's somehow?
I wonder this to add extra security to my db's and not
only that to educate others on this list if it is
possible or not.
Yes, it's possible and recommended. This would be better asked on a 
MySQL forum or email list, though. You give permission for each user to 
connect from a specific host when you GRANT them permissions. Read the 
MySQL manual about the GRANT command.

---John Holmes...

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


Re: [PHP-DB] PHP-Mysql speed

2003-10-12 Thread Lester Caine
As I know PostNuke use ADO connection. Are the normal Mysql php function
faster than the ADO variant? How big is the difference?
ADO just wraps the base functions.

Zend PHP Optimizer can help for me?
Probably a bit

How is it possible to handle 40-50,000 visitors?
A second machine with Firebird database on ( Linux ), and
keep Apache/PHP on the first machine. It will be 5-6 times
faster, so you may still need to speed up on or other
machine depending on where the bottleneck is.
--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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

2003-09-03 Thread j.zanen
I use apache 2.0.47 withMysql 4.1 (beta) and php 4.3.2

All that I want to do seems to work fine (no issues yet)

Installation was a breeze


Jack
> 
> from: David Haines <[EMAIL PROTECTED]>
> date: 2003/09/02 Tue PM 09:11:54 CEST
> to: <[EMAIL PROTECTED]>
> subject: [PHP-DB] PHP, MySQL and Apache 2 ?
> 
> This is maybe a bit Off-topic, and yet I could think of no better place to
> ask:
> 
> How many of you are using PHP with MySQL and Apache 2 ?
> 
> I know there _were_ some problems, but do the current (stable) PHP and MySQL
> work fine with Apache 2 ?
> 
> Have a client machine with Redhat 9, and Apache 2 gets installed... There is
> a lot on there I'd really rather not have to do again from scratch (as in:
> wipe and start over and manually install Apache 1.3)
> 
> -- 
> 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 and Apache 2 ?

2003-09-03 Thread Balaji H. Kasal
> 
> How many of you are using PHP with MySQL and Apache 2 ?
> 

  I am using. PHP:4.2.2, MySQL: 3.23 Apache 2.


> I know there _were_ some problems, but do the current (stable) PHP and MySQL
> work fine with Apache 2 ?
> 

 They work fine together. Only I faced problem during installation. But 
that can be easily sort out.
 
With Best Wishes,
--Balaji

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



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

2003-09-02 Thread Martin Marques
El Mar 02 Sep 2003 16:11, David Haines escribió:
> This is maybe a bit Off-topic, and yet I could think of no better place to
> ask:
>
> How many of you are using PHP with MySQL and Apache 2 ?
>
> I know there _were_ some problems, but do the current (stable) PHP and
> MySQL work fine with Apache 2 ?
>
> Have a client machine with Redhat 9, and Apache 2 gets installed... There
> is a lot on there I'd really rather not have to do again from scratch (as
> in: wipe and start over and manually install Apache 1.3)

It's not my production server, just my home machine, but I sometimes give it a 
bit of a load :-) and I have RH9 with the httpd that comes with it, but using 
PostgreSQL. No problems so far.

-- 
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-
Martín Marqués  |[EMAIL PROTECTED]
Programador, Administrador, DBA |   Centro de Telematica
   Universidad Nacional
del Litoral
-

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



Re: [PHP-DB] php mysql arrays and totals

2003-07-18 Thread Dirk Kredler
Am Freitag, 18. Juli 2003 12:33 schrieb Wendell Frohwein:
> i didnt even know that function existed, could you maybe give me a little
> more detail on it, then im sure i can figure it out, thanks allot,

SUM() is a standard function from (my)SQL.

just use it and be happy,
if you need in depth details consult the mysql manual or
any good sql manual, you will find a lot in the internet.

anyway, you can also perform the summation in php,
but this makes not sense, as the database is much more faster
in this topic.

best wishes,
dirk



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



Re: [PHP-DB] php mysql arrays and totals

2003-07-18 Thread Wendell Frohwein
i didnt even know that function existed, could you maybe give me a little
more detail on it, then im sure i can figure it out, thanks allot,


-wendell


"Dirk Kredler" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Am Freitag, 18. Juli 2003 12:18 schrieb Wendell Frohwein:
> > called amount. I use mysql_query("SELECT amount FROM items"); to get the
> > amounts into the script.
> > I would then like all the values to be added up for a grand total. I
have
> > tried this and the
>
> why dont you use :
>
> SELECT SUM(amount) FROM items
>
> ?
>
> best wishes,
> Dirk
>
>



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



Re: [PHP-DB] php mysql arrays and totals

2003-07-18 Thread Dirk Kredler
Am Freitag, 18. Juli 2003 12:18 schrieb Wendell Frohwein:
> called amount. I use mysql_query("SELECT amount FROM items"); to get the
> amounts into the script.
> I would then like all the values to be added up for a grand total. I have
> tried this and the

why dont you use :

SELECT SUM(amount) FROM items

?

best wishes,
Dirk



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



Re: [PHP-DB] PHP MySQL news display probs

2003-07-15 Thread jeffrey_n_Dyke

you'll need to use $_GET['id'] or you'll need to set register_globals = On.

I would use the first method, and replace

$query = "SELECT slug, content, contact, timestamp FROM news WHERE id
= '$id'";
with -->
$query = "SELECT slug, content, contact, timestamp FROM news WHERE id = '".
$_GET['id']."'";

i bet it will work straight away.

hth
Jeff


   
 
  [EMAIL PROTECTED]
 
  on.co.uk To:   [EMAIL PROTECTED] 
  
   cc: 
 
  07/15/2003 10:44 Subject:  [PHP-DB] PHP MySQL news 
display probs  
  AM   
 
   
 
   
 




Dear All,

I have created a simple news system and am having a problem in that all the
code compiles so I think it is correct and the news headlines display but
when you point to the link to read the article (for example
http://localhost/news/user/story.php?id=2) nothing displays, it returns
that there is nothing in the database and prints out the arm of the else
statement, no records.

I am convinced that I need to enable something somewhere in the php.ini
file but may be wrong. Any help would be really really appreciated.

This is the code which displays the news headlines which displays them OK:









 



 


 Reuters Inc : Press
Releases





 0)
{
 // iterate through resultset
 // print article titles
 while($row = mysql_fetch_object($result))
 {
 ?>
  slug; ?>
  
  timestamp); ?>
  
 
 No press releases currently available







 Everything here is copyright ©








This is the code to Display the corresponding article, its driving me nuts!

/ story.php - display contents of selected press release
?>








 



 


 Reuters Inc : Press
Releases





 
 slug; ?>
 
 content); ?>
 
 This press release was published on timestamp); ?>. For more information, please contact contact; ?>

 
 That press release could not be located in our
 database.






 Everything here is copyright ©







Thanks Again
PHPUSER


--
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 news display probs

2003-07-15 Thread CPT John W. Holmes
> I have created a simple news system and am having a
> problem in that all the code compiles so I think it is
> correct and the news headlines display but when you
> point to the link to read the article (for example
> http://localhost/news/user/story.php?id=2) nothing
> displays, it returns that there is nothing in the database
> and prints out the arm of the else statement, no records.

So what's the value of $id on the story.php page? What's the value of
$_GET['id']? Print out your query before you execute it to make sure it
looks right. Do some debugging and read about register globals (if my
assumption is correct).

---John Holmes...



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



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

2003-07-09 Thread Stan Lemon
One hesitation regarding Flash...

If you want to use the old and, respectively dead, libswf cool beans, 
but if you steer the way of Ming beware, it is ridiculously buggy.  I 
personally have had quite a pickle with it.  If I was asked to do Flash 
work I'd be tempted to go out and buy the prog, ming isn't to the point 
it needs to be to win me over.

- Stan

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


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

2003-07-09 Thread Rich Hutchins
Randy,

There ARE javascript solutions for this and a few can be found here:
http://www.webreference.com/programming/javascript/dragdropie/
http://www.walterzorn.com/dragdrop/dragdrop_e.htm
http://www.webreference.com/dhtml/column7/ (particularly good)

What you'll find is that JS does not natively support the drag and drop
feature and that either some type of wrapper needs to be built to make it
possible or a bunch of functions. Furthermore, there may be cross-browser
compatability issues depending on the WAY you want your drag and drop to
work. And you always have the possibility that some genius might turn off
the JS support in his or her browser thereby completely killing your nice
script. But it sounds like you might have some control over this with your
client(?).

If you were to pick a JS solution, I think the third link has the most
potential, but that's just my opinion and it's going to take some keen work
to figure out a way to pass the car positions from the objects back into
form elements that can be passed to PHP. I've done that kind of work before
and it's rather "clunky". If I knew Flash better, I'd actually lean towards
avoiding the JS route.

With that in mind, I did a little searching on Google using "drag and drop"
+flash and the search yielded a whole bunch of results which varied from how
to drag and drop on the Flash stage to actually designing the client-side
functionality you want. I'd suggest performing the same search yourself and
finding the information that best suits your needs.

If you get a solution working with JS, please post it or let me know. I'd be
interested in looking at one that actually works with PHP to move data back
and forth rather than just do jigsaw puzzles or whatever.

Hope this helps,
Rich

-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 8:37 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP, MySQL and Flash


Does anyone know of any articles on integrating PHP, MySQL and Flash to
perform a drag and drop routine for updating a db?

Specifically, I have a client who is _INSISTING_ that I integrate a drag and
drop feature into his railcar storage application. He wants to be able to
view two railcar storage tracks, Track A and Track B, then drag and drop
cars from Track A to Track B ( or Track B to Track A ). Once he positions (
orders ) all the cars properly on each track, I need to update a MySQL db to
reflect the changes.

I have already developed the above feature so that he can do this
'textually', but he is _determined_ that he must have the graphic 'drag and
drop' feature.

There may be another method ( Javascript ? ) to accomplish the same effect.
I am certainly open to any advice and/or opinions. Any pointers would be
_greatly_ appreciated.

Thanks,

Randy Rankin



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



RE: [PHP-DB] php /mysql / viewing offline question

2003-06-14 Thread Mike
You'll want a webserver running and PHP configured for that server. You can
easily use IIS or Apache for this purpose. Which one you want to use is
something that many people will argue over, but the simple fact is that
you're doing some offline development and you should use what's easiest for
you.

Once you get your webserver up and running and PHP configured, just create a
site that points to your document root and then open a browser to
http://localhost/ - assuming everything's configured properly and you've
moved over all the data that you need, you'll then have a viable offline
staging server to developed on.

I have an XP box with PHP, mySQL and IIS and I've not run into any problems
at all. When I've completed my changes I just FTP everything to my live site
with no hassles.

-M

-Original Message-
From: JeRRy [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2003 10:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] php /mysql / viewing offline question


Hi,

I have a linux webserver that I have that has php
webpages I have created and mysql databases.  I would
like to do some work on them while being offline at
times.  I have the following programs which enable me
to do this:

- DzSoft PHP Editor (windows version)
- mysql (windows version)
- php-4.3.2-Win32 (windows version)

With the DzSoft PHP Editor it has an in-built php
viewer to view pages/scripts which I have got reading
to and from my mysql.  But I guess it can't handle
cookies so means I can't run my pages offline like I
want to to make sure they work.  I run cookies to
login to my site/database and they work fine online
but offline it wont work simply because the php viewer
does not handle cookies just views pages as is.

So I need a program that I can view my php pages like
I would if being on a webserver but while being
offline.  I have all the pages, database on my PC
now.  I have everything working just can't view my php
work as I need to.

So I need a program that will view my php pages and
handle cookies etc as it would if being online.  Is
there a program I can use for this?

I know I could download Apache WebServer but I don't
need it to be online at all, only offline viewing.  So
I thought there mught be another program I could use
for this.  If so, please let me know.  If Apache is
the only option I guess I'll have to use that.

Thankyou for your suggestions / help in advance.

Kind Regards,
Jerry

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.

--
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 Script help.

2003-06-06 Thread Fulco of Scarborough
Thanks for all you wonderful help.  With a little tweaking, and a new
debugging program, I have been able to get the results I want.  Now I'm
going to begin adding some security features.  Again, thanks for you help.

Yours in Service,
Jason Britton
Scar's Legion
http://st.fulco.net
[EMAIL PROTECTED]
 
Vincit imitationem veritas.

> -Original Message-
> From: Becoming Digital [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 05, 2003 4:59 AM
> To: 'PHP-DB'
> Subject: Re: [PHP-DB] PHP/Mysql Script help.
> 
> I debugged the code and there were a slew of errors.  I've fixed all but
one,
> which I can't correct bcs I don't know the intention.  Most of the errors
came
> from improper syntax, a problem which could have been avoided by using
> consistent code formatting.  I chose to do that for you as well and have
> included the code below.
> 
> As for the error I could not correct, it involves the final elseif()
statement.
> The way your code was written, you had two 'else' statements, which is an
> obvious violation.  I corrected that by changing the first (before the
select
> statement) to an elseif(), but I do not know the condition.  Once you
enter it,
> the code should work smoothly.
> 
> 
>  
> require("racesetup.php");
> 
> $con = mysql_connect($host, $user, $pass) or die(mysql_error());
> 
> mysql_select_db($db, $con) or die(mysql_error());
> 
> // display individual record
> if ($id)
> {
> error_reporting(E_ALL);
> 
> $result = mysql_query("SELECT * FROM nuke_race WHERE id=$id",$con) or
> die(mysql_error());
> 
> $myrow = mysql_fetch_array($result) or die(mysql_error());
> 
> printf ("Race: %s\n", $myrow["race"]);
> 
> echo "";
> 
> printf("Description: %s\n", $myrow["racetxt"]);
> 
> echo "";
> echo "Back";
> }
> 
> elseif ($_Post['letter'])
> {
> if ($_Post['letter'])
> {
> $result = mysql_query("SELECT * FROM nuke_race WHERE race LIKE
> $_Post['letter']%",$con) or die(mysql_error());
> if ($myrow = mysql_fetch_array($result))
> {   // display list if there are records to display
> do {
> printf("%s\n", $PHP_SELF,
> $myrow["id"], $myrow["race"]);
> }
> while ($myrow = mysql_fetch_array($result));
> }
> }
> }
> 
> //NO CONDITION LISTED!!
> elseif ()
> {
> echo ""
> 
>   . "  Pick a letter to begin your search"
>   . "   "
>   . ""
>   . "  A"
>   . "  B"
>   . "  C"
>   . "  D"
>   . "  E"
>   . "  F"
>   . "  G"
>   . "  H"
>   . "  I"
>   . "  J"
>   . "  K"
>   . "  L"
>   . "  M"
>   . "  N"
>   . "  O"
>   . "  P"
>       . "  Q"
>   . "  R"
>   . "  S"
>   . "  T"
>   . "  U"
>   . "  V"
>   . "  W"
>   . "  X"
>   . "  Y"
>   . "  Z"
>   . ""
>   . "  "
>   . "   "
>   . " information\">"
>   . "  "
>   . ""
>   ."";
> }
> 
> else
> // no records to display
> echo "Sorry, no records were found!";
> 
> ?>
> 
> 
> Edward Dudlik
> Becoming Digital
> www.becomingdigital.com
> 
> 
> - Original Message -
> From: "Fulco of Scarborough" <[EMAIL PROTECTED]>
> To: "'PHP-DB'" <[EMAIL PROTECTED]>
> Sent: Thursday, 05 June, 2003 00:25
> Subject: Re: [PHP-DB] PHP/Mysql Script help.
> 
> 
> I have still been getting errors, so here goes again.
> 
> 
> 
> I am attempting to design a script that presents the user with a form with
> 26 letters to choose from.  When they pick a letter I want it to take them
> to a list of all the entries in my database that begin with the letter
they
> selected in link form.  When they click on the term, I want it to pull up
> the info for that entry.
> 
> 
> 
> I have made some changes and added some error checking:
&g

Re: [PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread Becoming Digital
I debugged the code and there were a slew of errors.  I've fixed all but one,
which I can't correct bcs I don't know the intention.  Most of the errors came
from improper syntax, a problem which could have been avoided by using
consistent code formatting.  I chose to do that for you as well and have
included the code below.

As for the error I could not correct, it involves the final elseif() statement.
The way your code was written, you had two 'else' statements, which is an
obvious violation.  I corrected that by changing the first (before the select
statement) to an elseif(), but I do not know the condition.  Once you enter it,
the code should work smoothly.


Race: %s\n", $myrow["race"]);

echo "";

printf("Description: %s\n", $myrow["racetxt"]);

echo "";
echo "Back";
}

elseif ($_Post['letter'])
{
if ($_Post['letter'])
{
$result = mysql_query("SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%",$con) or die(mysql_error());
if ($myrow = mysql_fetch_array($result))
{   // display list if there are records to display
do {
printf("%s\n", $PHP_SELF,
$myrow["id"], $myrow["race"]);
}
while ($myrow = mysql_fetch_array($result));
}
}
}

//NO CONDITION LISTED!!
elseif ()
{
echo ""

  . "  Pick a letter to begin your search"
  . "   "
  . ""
  . "  A"
  . "  B"
  . "  C"
  . "  D"
  . "  E"
  . "  F"
  . "  G"
  . "  H"
  . "  I"
  . "  J"
  . "  K"
  . "  L"
  . "  M"
  . "  N"
  . "  O"
  . "  P"
  . "  Q"
  . "  R"
  . "  S"
  . "  T"
  . "  U"
  . "  V"
  . "  W"
  . "      X"
      . "  Y"
  . "  Z"
  . ""
  . "  "
  . "   "
  . ""
  . "  "
  . ""
  ."";
}

else
// no records to display
echo "Sorry, no records were found!";

?>


Edward Dudlik
Becoming Digital
www.becomingdigital.com


- Original Message -
From: "Fulco of Scarborough" <[EMAIL PROTECTED]>
To: "'PHP-DB'" <[EMAIL PROTECTED]>
Sent: Thursday, 05 June, 2003 00:25
Subject: Re: [PHP-DB] PHP/Mysql Script help.


I have still been getting errors, so here goes again.



I am attempting to design a script that presents the user with a form with
26 letters to choose from.  When they pick a letter I want it to take them
to a list of all the entries in my database that begin with the letter they
selected in link form.  When they click on the term, I want it to pull up
the info for that entry.



I have made some changes and added some error checking:



Race: %s\n", $myrow["race"]);

  echo "";

   printf("Description: %s\n", $myrow["racetxt"]);

  echo "";

  echo "Back";




} elseif ($_Post['letter']) {

if ($_Post['letter']) {

$result = mysql_query("SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%",$con) or die(mysql_error());

if ($myrow = mysql_fetch_array($result)) {



  // display list if there are records to display



  do {



printf("%s\n", $PHP_SELF, $myrow["id"],
$myrow["race"]);



  } while ($myrow = mysql_fetch_array($result));



";

}

else  {

echo""

  . "  Pick a letter to begin your search"

  . "   "

  . ""

  . "  A"

  . "  B"

  . "  C"

  . "  D"

  . "  E"

  . "  F"

  . "  G"

  . "  H"

  . "  I"

  . "  J"

  . "  K"

  . "  L"

  . "  M"

  . "  N"

  . "  O"

  . "  P"

  . "  Q"

  . "  R"

  . "  S"

  . "  T"

  . "  U"

  . "  V"

  . "  W"

  . "  X"

  . "  Y"

  . "  Z"

  . ""

  . "  "

  . "   "

  . ""

  . "  "

  . ""

  . "

 ."";



}

 else {

  // no records to display



  echo "Sorry, no records were found!";

}



?>



I am still getting "Parse error: parse error, unexpected T_STRING in
/home/wwwfulc/public_html/st/races.php on line 38"



This is line 38



echo""





Thanks for your help!



Yours in Service,

Jason Britton

Scar's <http://st.fulco.net/>  Legion

[EMAIL PROTECTED]



Vincit imitationem veritas.






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



Re: [PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread Jason Wong
On Thursday 05 June 2003 12:25, Fulco of Scarborough wrote:
> I have still been getting errors, so here goes again.

[snip]

> I am still getting "Parse error: parse error, unexpected T_STRING in
> /home/wwwfulc/public_html/st/races.php on line 38"

Parse error means that you have written incorrectly formatted code that php 
doesn't even attempt to run. Check that each open ", ', [, (, { has a 
corresponding closing counterpart and each of your php statements (~lines) 
are terminated with a semi-colon (;).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Love means having to say you're sorry every five minutes.
*/


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



Re: [PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread Fulco of Scarborough
I have still been getting errors, so here goes again.

 

I am attempting to design a script that presents the user with a form with
26 letters to choose from.  When they pick a letter I want it to take them
to a list of all the entries in my database that begin with the letter they
selected in link form.  When they click on the term, I want it to pull up
the info for that entry.

 

I have made some changes and added some error checking:

 

Race: %s\n", $myrow["race"]);

  echo "";   

   printf("Description: %s\n", $myrow["racetxt"]);

  echo "";

  echo "Back";


 

} elseif ($_Post['letter']) {

if ($_Post['letter']) {

$result = mysql_query("SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%",$con) or die(mysql_error());

if ($myrow = mysql_fetch_array($result)) {

 

  // display list if there are records to display

 

  do {

 

printf("%s\n", $PHP_SELF, $myrow["id"],
$myrow["race"]);

 

  } while ($myrow = mysql_fetch_array($result));

   

";  

}

else  {

echo""

  . "  Pick a letter to begin your search"

  . "   "

  . ""

  . "  A"

  . "  B"

  . "  C"

  . "  D"

  . "  E"

  . "  F"

  . "  G"

  . "  H"

  . "  I"

  . "  J"

  . "  K"

  . "  L"

  . "  M"

  . "  N"

  . "  O"

  . "  P"

  . "  Q"

  . "  R"

  . "  S"

  . "  T"

  . "  U"

  . "  V"

  . "  W"

  . "  X"

  . "  Y"

  . "  Z"

  . ""

  . "  "

  . "   "

  . ""

  . "  "

  . ""

  . "

 ."";

 

}

 else {

  // no records to display

 

  echo "Sorry, no records were found!";

}

  

?>

 

I am still getting "Parse error: parse error, unexpected T_STRING in
/home/wwwfulc/public_html/st/races.php on line 38"

 

This is line 38

 

echo""

 

 

Thanks for your help!

 

Yours in Service,

Jason Britton

Scar's   Legion

[EMAIL PROTECTED]

 

Vincit imitationem veritas.

 



Re: [PHP-DB] PHP/Mysql Script help.

2003-06-05 Thread heilo
hi!

wow - cool code! it is very well structured i think (i like it ;-)! i just
would change 2 little details (thats only what i'd do):

if($id) is not enough for me - first of all i want that it can only be
transportet by GET. secondly i do not want people trying to hack my
mysql-server with some ugly url-hacking. so i test if it is a numeric input.
third it is possible that people may bookmark some ids to access them
directly so i would include a test if the requested id exists or not:

if(isset($_GET['id']) && is_numeric($_GET['id'])
{
$qry = 'SELECT `id` FROM `nuke_race` WHERE `id`='.$id;
$res = mysql_query($qry, $con);
if(mysql_num_rows($res)==0)
echo 'Sorry, this entry has been deleted or was never
created!'."\n";
else
// show entry
}

next - but this is really a small thing - i'd not make a long list of
options i'd create a for-loop like this:

echo ''."\n";
for($i = 65; $i <= 90; $i++)
echo ''.chr($i).''."\n";
echo ''."\n";

oh! i just saw that you use POST anyways. ;) also a possibility (but this
avoids the entries from being bookmarked).

keep phping!

.ma

Fulco of Scarborough <[EMAIL PROTECTED]> [EMAIL PROTECTED] 0:04 Uhr:

> Greeting everyone, my name is Jason and I am sorry for bugging you since you
> probably get a ton of these emails, but I was hoping you all might be able
> to help me.  I am attempting to design a script that presents the user with
> a form with 26 letters to choose from.  When they pick a letter I want it to
> take them to a list of all the entries in my database that begin with the
> letter they selected in link form.  When they click on the term, I want it
> to pull up the info for that entry.
> 
> I am only wanting to get some tips or a sample somewhere you may know of to
> get me going in the right direction.
> 
> 
> 
> Here is my current code so far:
> 
> 
> 
>  
> require("racesetup.php");
> 
> $con = mysql_connect($host, $user, $pass);
> 
> 
> 
> mysql_select_db($db, $con);
> 
> 
> 
> // display individual record
> 
> 
> 
> if ($id) {
> 
> 
> 
>  $result = mysql_query("SELECT * FROM nuke_race WHERE id=$id",$con);
> 
> 
> 
>  $myrow = mysql_fetch_array($result);
> 
> 
> 
>  printf("Race: %s\n", $myrow["race"]);
> 
> echo ""; 
> 
>  printf("Description: %s\n", $myrow["racetxt"]);
> 
> echo "";
> 
> echo "Back";
> 
> 
> 
> 
> } else {
> 
> echo " action=\"http://st.fulco.net/races.php\";>
> 
> Pick a letter to begin your search
> 
>  
> 
>   
> 
> A
> 
> B
> 
> C
> 
> D
> 
> E
> 
> F
> 
> G
> 
> H
> 
> I
> 
> J
> 
> K
> 
> L
> 
> M
> 
> N
> 
> O
> 
> P
> 
> Q
> 
> R
> 
> S
> 
> T
> 
> U
> 
> V
> 
> W
> 
> X
> 
> Y
> 
> Z
> 
>   
> 
> 
> 
> 
> 
>   
> 
> 
> 
> 
> 
> ";  
> 
> } else {
> 
> 
> 
> $result = mysql_query("SELECT * FROM nuke_race WHERE race LIKE
> '$letter%'",$con);
> 
>   if ($myrow = mysql_fetch_array($result)) {
> 
> 
> 
> // display list if there are records to display
> 
> 
> 
> do {
> 
> 
> 
>   printf("%s\n", $PHP_SELF, $myrow["id"],
> $myrow["race"]);
> 
> 
> 
> } while ($myrow = mysql_fetch_array($result));
> 
> 
> 
>   } else {
> 
> 
> 
> // no records to display
> 
> 
> 
> echo "Sorry, no records were found!";
> 
>   }
> 
> 
> 
> }
> 
> ?>
> 
> 
> 
> Thanks for your help in advance.
> 
> 
> 
> Yours in Service,
> 
> Jason Britton
> 
> Scar's   Legion
> 
> http://st.fulco.net 
> 
> [EMAIL PROTECTED]
> 
> 
> 
> Vincit imitationem veritas.
> 
> 
> 
>


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



RE: [PHP-DB] php/mysql query

2003-02-20 Thread Kelly Protsko
Well if the zip codes have something in common just do a pattern match
for them or are you just picking random zip codes?  This way you only
need one one sql statement to bring everything back.

Kelly

-Original Message-
From: Julie Keywell [mailto:[EMAIL PROTECTED]] 
Sent: February 20, 2003 10:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] php/mysql query

Hi there!

I am querying our database for 11,000 different zip codes and it seems
to be overloading MySQL.  However, common sense says it shouldn't.

My question is:
When needing to query 11,000 things, is it best to make 1 SQL statement
that has 11,000 ors, or run through individual querys 11,000 times?  Any
help would be wonderful!  I am making PHP do the counting rather than
MySQL.

Thanks!
Julie

--


-- 
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: temporary table problem

2003-01-24 Thread Damir Dezeljin
Hi.

> I would like to know, if there is any change to export/import data from
> SQL/EXCEL/SQL with php??? It?s very important. So if someone knows a way
> please help me.
HeHe ... I don't know how this is related to my question, but.

To import directly in Excel from MySQL, you can use MyODBC (I sugest you
to use development version).

If you want just to export from Excel and iport into MySQL, just do an
DOS (I think that .csv) export of data and try using LOAD DATA INFILE
(check mysql options how to set a field separator ... you will easly set
this in excel export),...


If anyone want to check my question, see below ;)

> I got a task to program a search engine for a site which is all around
> based on sessions and persistent connections to MySQL.
>
> The problem is that I first have to select a subset of those data
> and then I have to join them all around and output results.
>
> I'm using temporary tables for this but there is a problem.
> Temporary tables are visible trough the entire connection. So in future
> one browser window can interact (can display) with results from another
> browser window. Does anyone have a sugestion how to solve this?
>
> I was thinking to close a persistent connection (I don't know how???) on
> each result page at the begining and then reopen it at the end ... for my
> code I was thinking on using normal connections.
>
> Any better idea?
>
> I thik I just can't live without temporary tables till I will not have
> subqueryes.


Regards,
Dezo


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




RE: [PHP-DB] PHP && MySQL: temporary table problem

2003-01-24 Thread Bruno Pereira
I would like to know, if there is any change to export/import data from
SQL/EXCEL/SQL with php??? It?s very important. So if someone knows a way
please help me.
Thanks.

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Damir Dezeljin [mailto:[EMAIL PROTECTED]]
Sent: sexta-feira, 24 de Janeiro de 2003 8:18
To: PHP-db list
Subject: [PHP-DB] PHP && MySQL: temporary table problem


Hi.

I got a task to program a search engine for a site which is all around
based on sessions and persistent connections to MySQL.

The problem is that I first have to select a subset of those data
and then I have to join them all around and output results.

I'm using temporary tables for this but there is a problem.
Temporary tables are visible trough the entire connection. So in future
one browser window can interact (can display) with results from another
browser window. Does anyone have a sugestion how to solve this?

I was thinking to close a persistent connection (I don't know how???) on
each result page at the begining and then reopen it at the end ... for my
code I was thinking on using normal connections.

Any better idea?

I thik I just can't live without temporary tables till I will not have
subqueryes.

Regards,
Dezo


--
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 via Apache

2003-01-13 Thread Jason Wong
On Monday 13 January 2003 19:00, Vic Sutton wrote:
> Folks,
> I have PHP 4.2.2, Apache 1.3.6 & MySQL 3.22.53 installed. The access to
> MySQL is fine from the command line, but fails from Apache with "Fatal
> error: Call to undefined function: mysql_connect() in .." when running
> same script via a page. Has anyone seen this behavier before ?

Yes. 

I've seen it before. 

Loads of times. 

It means your version of php was not compiled with mysql support, or the mysql 
module was not found.

Try searching in the archives for an answer.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
Where you stand depends on where you sit.
-- Rufus Miles, HEW
*/


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




Re: [PHP-DB] php-mysql connect

2003-01-12 Thread Larry E. Ullman
I've setup a form to submit data into my MySQL database and it appears 
to
connect properly and whatnot but when I check to see that the data has 
been
inserted properly using phpMyAdmin, the table refelcts a new row entry 
but
the fields are empty. ???

I suspect this is a register_globals problem (the values from the form 
which are to be inserted into the database aren't being passed to the 
script as you'd expected). I'd echo the generated SQL to the browser to 
see what PHP thinks the query is. Then, if necessary, change which 
variables you use accordingly.

Larry


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



Re: [PHP-DB] php-mysql connect

2003-01-12 Thread Jeffrey_N_Dyke

does this have anything to do with register_globals being off.  are you
using $_POST['var_name']?  or $_GET['var_name']?

can you send some code?

jeff


   
 
"Jared Price"  
 
cc:   
 
 Subject: [PHP-DB] php-mysql connect   
 
01/12/2003 
 
04:47 PM   
 
   
 
   
 




I've setup a form to submit data into my MySQL database and it appears to
connect properly and whatnot but when I check to see that the data has been
inserted properly using phpMyAdmin, the table refelcts a new row entry but
the fields are empty. ??? Anyone have this problem before?? Any help is
greatly appreciated.



--
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

2003-01-04 Thread Micah Stevens
The script is generating a filename based on the id and then copies the
file from somewhere to the new location. It's doing just what it's
supposed to. IF you don't want it to do it, just use the following
instead: 

//
// Insert the photo details into the database
//

$result = mysql_query("INSERT INTO photo

(id,galleryid,title,size_in_MB,person,filename,description) 
VALUES

('','$galleryid','$title','$size_in_MB','$person','$photo', 
'$description')
");

That should do it. You should be using the $photo variable as the
filename and not moving anything. Of course this doesn't address the
thumbnail issue, but you get the idea. 

-Micah


On Sat, 2003-01-04 at 13:55, Mike C wrote:

> Hi,
> 
> I hope someone can help me with this.
> 
> I am trying to modify this portion of a script so that I can upload 
> photos (MacOSX 10.2.3) but keep the file names intact. At the moment 
> everything works fine except that when I upload photos, the script 
> changes the name of the file I just uploaded to a new filename 
> (sequentially) based on the database 'id' number to 1.gif, 2.gif, 
> 3.gif and so on.
> 
> I need to be able to keep the filename as it is (05-01.gif, 23-02.gif 
> etc) when I upload it!
> 
> //
>   // Insert the photo details into the database
>   //
> 
>   $result = mysql_query("INSERT INTO photo
>  
>   (id,galleryid,title,size_in_MB,person,filename,description) 
> VALUES
>  
>   ('','$galleryid','$title','$size_in_MB','$person','$filename', 
>   '$description')
>   ");
> 
>   //
>   // Retrieve the ID of the photo
>   //
> 
>   $result = mysql_query("SELECT * FROM photo
>   WHERE galleryid = '$galleryid'
>   AND title = '$title'
>   AND description = '$description'");
>   $id = mysql_result($result,0,"id");
> 
>   //
>   // Generate a filename for the file
>   //
> 
>   $filename = "$id.$format";
> 
>   //
>   // Alter the database record to point to the correct
>   // filename.
>   //
> 
>   $result = mysql_query("UPDATE photo SET filename = '$filename'
>   WHERE id = '$id'");
> 
>   //
>   // Move the thumbnail and full-sized photo to the 
> correct filesystem
>   // location.
>   //
> 
>   copy ($photo,"$filepath/$galleryid/photos/$id.$format");
>   copy 
> ($thumbnail,"$filepath/$galleryid/thumbnails/$id.$format");
> 
>   //
>   // Print out a Success message to the user.
>   //
> 
> Regards
> Mike
> -- 
> --
> Mike C
> Macintosh Support Specialist
> University of Otago (ITS)
> Dunedin
> NEW ZEALAND
> http://www.otago.ac.nz
> --

-- 
Raincross Technologies
Development and Consulting Services
http://www.raincross-tech.com




Re: [PHP-DB] php/mysql

2002-12-26 Thread 1LT John W. Holmes
> >> I don't know where the error lays, in php, mysql or red hat 8.
> >> But, I can't get my databased php-apps to work.
> >> I am trying to run:
> >>
> >> apache_1.3.27
> >> php-4.2.3
> >> mysql-3.23.53
> >> redhat 8.0
> >>
> >> What happens is that apache and php work nicely, but my apps cannot
> > connect
> >> to mysql. In IRM I get can not connect to database, and in phpgroupware
I
> >> get the the thing up and running, but can't add anything to the tables.
> >> E.g. I can't add a to-do even if the routine runs normally, nothing is
> > added
> >> in the db table.
> >>
> >> I saw a suggestion on a mysql mail list suggesting symlinking
mysql.sock
> > to
> >> /tmp but that does no difference.
> >
> > Can you connect to MySQL from the command line? With what user?
>
> mysql -u ADMIN -pADMINPW irm
> mysql -u ADMIN -pADMINPW phpgroupware
>
> both work (command line access). Setting the user in IRM as ADMIN and the
> password to ADMINPW I get "Cannot connect to database".
> I once desperately thought I had forgotten to configure php --with-mysql
so
> I recompiled. No improvement.

What is IRM? What's the line with mysql_connect() look like? Make sure there
is no @ in the line, as in @mysql_connect, which will suppress any normal
error messages.

---John Holmes...


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




Re: [PHP-DB] php/mysql

2002-12-26 Thread 1LT John W. Holmes
> > I don't use RedHat, but I've heard (possibly here) that the RH PHP
> > RPM does not properly install MySQL support by default and that
> > there's something like php_mysql.rpm (or something similar) that
> > needs to be installed as well? Does any of that sound familiar to
> > anyone?
> >
> I've heard something like that as well, which is why I've compiled php and
> apache from source. Would compiling mysql from source as well help I
> wonder...

It seems like you'd get an "unknown function" error if PHP wasn't compiled
correctly with MySQL support, though.

Are you sure you're programs are connecting with the host you think they
are? Maybe they are trying to connect with user@computer_name and you've got
it set up as user@localhost in the mysql.user table??

Grasping at straws...

---John Holmes...


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




Re: [PHP-DB] php/mysql

2002-12-26 Thread Martin S
Mark wrote:

> I don't use RedHat, but I've heard (possibly here) that the RH PHP
> RPM does not properly install MySQL support by default and that
> there's something like php_mysql.rpm (or something similar) that
> needs to be installed as well? Does any of that sound familiar to
> anyone?
> 
I've heard something like that as well, which is why I've compiled php and
apache from source. Would compiling mysql from source as well help I 
wonder...

/Martin S.

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




Re: [PHP-DB] php/mysql

2002-12-26 Thread Martin S
1lt John W. Holmes wrote:

>> I don't know where the error lays, in php, mysql or red hat 8.
>> But, I can't get my databased php-apps to work.
>> I am trying to run:
>>
>> apache_1.3.27
>> php-4.2.3
>> mysql-3.23.53
>> redhat 8.0
>>
>> What happens is that apache and php work nicely, but my apps cannot
> connect
>> to mysql. In IRM I get can not connect to database, and in phpgroupware I
>> get the the thing up and running, but can't add anything to the tables.
>> E.g. I can't add a to-do even if the routine runs normally, nothing is
> added
>> in the db table.
>>
>> I saw a suggestion on a mysql mail list suggesting symlinking mysql.sock
> to
>> /tmp but that does no difference.
> 
> Can you connect to MySQL from the command line? With what user? 

mysql -u ADMIN -pADMINPW irm
mysql -u ADMIN -pADMINPW phpgroupware

both work (command line access). Setting the user in IRM as ADMIN and the 
password to ADMINPW I get "Cannot connect to database".
I once desperately thought I had forgotten to configure php --with-mysql so 
I recompiled. No improvement.

>Are you
> sure you are using a valid login and password in your programs?

Yes. I'll recheck though.

/Martin S.



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




Re: [PHP-DB] php/mysql

2002-12-26 Thread Mark
I don't use RedHat, but I've heard (possibly here) that the RH PHP
RPM does not *properly* install MySQL support by default and that
there's something like php_mysql.rpm (or something similar) that
needs to be installed as well? Does any of that sound familiar to
anyone?

Have I qualified that enough? ;-)

M



--- "1LT John W. Holmes" <[EMAIL PROTECTED]> wrote:
> > I don't know where the error lays, in php, mysql or red hat 8.
> > But, I can't get my databased php-apps to work.
> > I am trying to run:
> >
> > apache_1.3.27
> > php-4.2.3
> > mysql-3.23.53
> > redhat 8.0
> >
> > What happens is that apache and php work nicely, but my apps
> cannot
> connect
> > to mysql. In IRM I get can not connect to database, and in
> phpgroupware I
> > get the the thing up and running, but can't add anything to the
> tables.
> > E.g. I can't add a to-do even if the routine runs normally,
> nothing is
> added
> > in the db table.
> >
> > I saw a suggestion on a mysql mail list suggesting symlinking
> mysql.sock
> to
> > /tmp but that does no difference.
> 
> Can you connect to MySQL from the command line? With what user? Are
> you sure
> you are using a valid login and password in your programs?
> 
> ---John Holmes...
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

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

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




  1   2   >