Re: [PHP-DB] change coldfusion to mysql/php

2008-06-19 Thread landavia
i think all the problem were in database? You should try convert your DB 
to Mysql.


Gary Wardell wrote:

Hi,

I don't know of a tool, although there may be one.

If the pages are really simple I would think that it wouldn't be that hard to 
redo them by hand.

Gary

  

-Original Message-
From: Koller Michel [mailto:[EMAIL PROTECTED]
Sent: Thu, May 08, 2008 7:26 AM
To: php-db@lists.php.net
Subject: [PHP-DB] change coldfusion to mysql/php


Hello

I have 3 simple Homepages, all makes with coldfusion.

Now i must all tre Homepages change from coldfusion to PHP/MySQL.
My question is, sombody know a tool thats can help me this to 
realisize?

(sorry for my bad english)

Thanks
M.K.



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