Re: PHP

Paul Lemmons <[email protected]>
Newsgroups gmane.comp.kde.devel.quanta.user
Message-ID <[email protected]>
Scott wrote:
> There are a number of visual options that
>> assist in code development. It won't make a php programmer out of you 
>> but will make the php programmer you are more efficient and effective.
>>     
> 	True, I don't expect Quanta to write the code for me :).  Which visual 
> options are you referring too?
>
>   
I am retentive about indentation. After coding for 30+ years I have come 
to believe that it is as important as the logic itself. The 
"Settings->Configure Editor->Show Indentation Lines" visual aid is one 
of my favorite.
>> There is also a debugger that comes with Quanta: I have been threatening 
>> to set it up but as of yet have not done some. Other say that it works 
>> well.
>>     
> 	Where is the debugger?  I noticed an older one called Gubed, but it 
> does not seem to be maintained anymore, not for three years based on 
> their web page.  Is Gubed still useful?
>
>   
I have been told that gubed is still very useful. There have also been 
discussions on this group about xdebug and a number of people have 
configured it to work with Quanta. Some time back, I asked this group 
which was the better choice and gubed was the one recommended. As I 
noted, though, I have not actually used either of them. I am still a 
"echo "*** Debug: ... " guy :)
>> I noticed in another post, that you are not wanting to make your PC a 
>> web server. I would suggest you re-think that. It it more than just a 
>> little convenient to be able to test completely on your PC before moving 
>> code up into "production". I am assuming you are using kubuntu so 
>> setting this up would be really easy.
>>     
> 	I have setup both Apache and PHP without any problems on my Kubuntu 
> machine and my little 386 Debian server.  One of the two main problems I 
> have is with the MySQL.  It is a pain and a considerable amount of work 
> to set it up and to make sure all the databases and user names are the 
> same as my website.  If I was writing a PHP/html site without MySQL I 
> would use a local test machine for sure.  Unless you know an easy way to 
> get all my tables and users over to my local machine.
>
>   
Let me share a few little scripts with you that may help with keeping 
your databases in sync. I think you will see a pattern and from the 
examples and be able to mix and match functional parts to create your 
own recipes.

First: refresh_local_from_remote.sh

mysqldump -hremote.mysqlhost.com \
          -uMyUserid \
          -pMyPasswd \
          --single-transaction \
          --add-drop-table \
          MyDatabaseName \
| \
mysql -hlocalhost \
      -uMyUserid \
      -pMyPasswd \
       MyDatabaseName

Second: backup_remote_to_file.sh

#!/bin/bash
now=`date +%m%d%y%H%M`

mysqldump -hremote.mysqlhost.com \
          -uMyUserid \
          -pMyPasswd \
          --single-transaction \
          --add-drop-table \
          MyDatabaseName \
 > \
          MyDatabaseName.$now

Lastly: refresh_remote_from_file.sh

#!/bin/bash
cat $1              |
sed -e "/^LOCK/ d"   |
sed -e "/^UNLOCK/ d" |
mysql -hremote.mysqlhost.com \
          -uMyUserid \
          -pMyPasswd \
          MyDatabaseName \

The host that I use will not let me lock tables so I have to remove the 
locks from the backup file using sed. Your host may not have this 
restriction so you may not need the sed lines.

In my PHP program I also have an included file that connects me to the 
database. It looks like:

<?php
if ($_SERVER['SERVER_NAME'] == 'localhost')
   $host     = "localhost";
else
   $host     = "remote.mysqlhost.com";

$user     = "MyUserid";
$password = "MyPasswd";
$database = "MyDatabaseName";

$db = mysql_connect($host,$user,$password) or die ("Unable to connect to 
database!");
mysql_select_db($database)                 or die ("Unable to select 
datbase!");

$_SESSION['db'] = $db;
?>

The opening "if" will connect me to the correct database depending on 
whether it is local or remote without me having to fix things to work in 
a specific environment.

> 	The second problem I have is that even if something worked on my local 
> test machine that does not necessarily mean that it will work on the web 
> server.
>   
I am not sure why this would be true.
> 	When my site goes "in service" I will seriously think about using your 
> advice because at that point it would be nice to make sure something 
> works before putting it online.  At the moment I am just developing the 
> game and it is not in use, so I can play with it as much as possible 
> without bugging anyone :).
>   
If you get it setup early in the process, it will be setup. If you wait 
until later, it will be a pain to setup. Sooner is almost always better 
than later.

> 	You can take a look at my site if you like at 
> http://engarde.elementfx.com.  It looks very bland at the moment because 
> I decided to do the html and css at the end.
>
>

_______________________________________________
Quanta mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/quanta
smime.p7s (application/x-pkcs7-signature, 3.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.