Re: [PHP] My project requires creating office documents on PHP. Any recommendations on what to use?

2010-11-20 Thread Dan


On Nov 20, 2010, at 1:10 AM, chetan ahuja chetanahuj...@gmail.com wrote:

 My project requires creating office documents on PHP. Any recommendations on
 what to use?

When you say office documents do you mean you have to create them using 
Microsoft office? Or just need to replicate current paper documents?

If you need to replicate current paper documents into an electronic version 
that can automatically be filled in by using PHP, I would recommend FPDF.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] My project requires creating office documents on PHP. Any recommendations on what to use?

2010-11-19 Thread chetan ahuja
My project requires creating office documents on PHP. Any recommendations on
what to use?


RE: [PHP] My Project

2005-07-20 Thread Jay Blanchard
[snip]
  Hey, Look I made a new database just for this money testing stuff.
  This is the table:
 
  CREATE TABLE `money` (
`money` varchar(255) NOT NULL default ''
  ) TYPE=MyISAM;
 
  Now, I use this code
 
  $sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
  (`myMoney`-10) WHERE `myCharacter` = `characterName` ;
  $doUpdate = mysql_query($sqlUpdate, $myConnection);
 
  And it should work, And it gives no error but it is not writing 
  anything into the database.
[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

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



Re: [PHP] My Project

2005-07-20 Thread Joseph

Jay Blanchard wrote:


[snip]
 


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
 `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.
   


[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

 


lol, jay that was beautiful

Both the PHP and MySQL manuals are great tools and should be consulted 
first. Youe ambition is nice, but you will get nowhere if you do not 
learn how to do these things on your own.

--jzf

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



RE: [PHP] My Project

2005-07-20 Thread Jim Moseby
 Lots of extra characters in that one... try this:
  
  $q=mysql_query(update myTable set myMoney=(myMoney-10) where 
  myCharacter='characterName');
  if(!$q){echo mysql_error();}
 
 so wasteful :-)
 
 $q=mysql_query(update u set m=(m-10) where 
 c='$c');if(!$q)die(mysql_error());
 

Still wasteful.  How about 

$q=mysql_query(update u set m=(m-10) where c='$c') or die(mysql_error());

:) 

JM

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



Re: [PHP] My Project

2005-07-20 Thread John Nichel

Jay Blanchard wrote:
snip

been nice (because we usually get chided for our terseness).

/snip

I noticed that Jason appears to be back...the kid gloves will be off now. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] My Project

2005-07-20 Thread Matt Darby

It *is* a great book (I cut my teeth with it as well):
PHP and MySQL Development (Welling and Thomson)
http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glances=booksn=507846

Read it, learn it, live it.

Matt Darby

Jay Blanchard wrote:


[snip]
 


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
 `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.
   


[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

 



Re: [PHP] My Project

2005-07-20 Thread Edward Vermillion

Matt Darby wrote:

It *is* a great book (I cut my teeth with it as well):
PHP and MySQL Development (Welling and Thomson)
http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glances=booksn=507846 



Read it, learn it, live it.

Matt Darby

Jay Blanchard wrote:


[snip]
 


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
 `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.
  


[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

 





Honestly, the best book I read when I was starting out, and one I've 
been using ever since, is the manual. I actually spent $ on a very good 
php book but I think I've only cracked the cover on it once or twice in 
two years.


Way to go manual guys! :D

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



RE: [PHP] My Project

2005-07-20 Thread Shaw, Chris - Accenture

snip
Honestly, the best book I read when I was starting out, and one I've
been using ever since, is the manual. I actually spent $ on a very good
php book but I think I've only cracked the cover on it once or twice in
two years.

Way to go manual guys! :D
/snip

I totally agree, I have only used the .chm manual to learn php, but I have a
programming background, C/C++, VB, Java, OpenROAD, C#.
If you're new to this programming game, then probably a *decent* book will
give you a good start.

Thumbs up to the manual guys. :)

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



[PHP] My Project

2005-07-19 Thread George B
Hey guys! This is gona be one of my last questions (hopefully) But here 
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a 
store where you could buy weapons etc... The thing I want to ask you 
guys is this. Lets say There is a knife i want to buy. It costs 10 
points. And I have 100 points. How would I make it so when I click BUY!! 
My money automaticaly subtracts from 100 to 90. How do I do that?


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



RE: [PHP] My Project

2005-07-19 Thread Shaw, Chris - Accenture

Taxi for one..

-Original Message-
From: George B [mailto:[EMAIL PROTECTED]
Sent: 19 July 2005 17:39
To: php-general@lists.php.net
Subject: [PHP] My Project


Hey guys! This is gona be one of my last questions (hopefully) But here
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a
store where you could buy weapons etc... The thing I want to ask you
guys is this. Lets say There is a knife i want to buy. It costs 10
points. And I have 100 points. How would I make it so when I click BUY!!
My money automaticaly subtracts from 100 to 90. How do I do that?

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



RE: [PHP] My Project

2005-07-19 Thread Jay Blanchard
[snip]
Hey guys! This is gona be one of my last questions (hopefully) But here 
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a

store where you could buy weapons etc... The thing I want to ask you 
guys is this. Lets say There is a knife i want to buy. It costs 10 
points. And I have 100 points. How would I make it so when I click BUY!!

My money automaticaly subtracts from 100 to 90. How do I do that?
[/snip]


You use math.
















Now, actually what you do is keep a database where each player's stats
are tracked. One of the stats is points. When the purchase occurs you
update the data in the player's record. 

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



Re: [PHP] My Project

2005-07-19 Thread Paul Waring
On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:
 And I have 100 points. How would I make it so when I click BUY!! 
 My money automaticaly subtracts from 100 to 90. How do I do that?

Where is your money being stored? In a database? A text file? A cookie?
Do you want the buy link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

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



Re: [PHP] My Project

2005-07-19 Thread George B

Shaw, Chris - Accenture wrote:

Taxi for one..

-Original Message-
From: George B [mailto:[EMAIL PROTECTED]
Sent: 19 July 2005 17:39
To: php-general@lists.php.net
Subject: [PHP] My Project


Hey guys! This is gona be one of my last questions (hopefully) But here

I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a

store where you could buy weapons etc... The thing I want to ask you

guys is this. Lets say There is a knife i want to buy. It costs 10

points. And I have 100 points. How would I make it so when I click BUY!!

My money automaticaly subtracts from 100 to 90. How do I do that?

--

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

taxi? Whats that mean?

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



Re: [PHP] My Project

2005-07-19 Thread George B

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:

And I have 100 points. How would I make it so when I click BUY!! 
My money automaticaly subtracts from 100 to 90. How do I do that?



Where is your money being stored? In a database? A text file? A cookie?
Do you want the buy link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)


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



Re: [PHP] My Project

2005-07-19 Thread Mikey

George B wrote:


Paul Waring wrote:


On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:

And I have 100 points. How would I make it so when I click BUY!! My 
money automaticaly subtracts from 100 to 90. How do I do that?




Where is your money being stored? In a database? A text file? A cookie?
Do you want the buy link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a 
form. :)



$money = $money - 10;

I wish you the best of luck with your project :^)

Mikey

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



RE: [PHP] My Project

2005-07-19 Thread André Medeiros
On Tue, 2005-07-19 at 17:46 +0100, Shaw, Chris - Accenture wrote:
 Taxi for one..
 
 -Original Message-
 From: George B [mailto:[EMAIL PROTECTED]
 Sent: 19 July 2005 17:39
 To: php-general@lists.php.net
 Subject: [PHP] My Project
 
 
 Hey guys! This is gona be one of my last questions (hopefully) But here
 I will include all the info about my new project.
 It is going to be like a RPG Game written in PHP. There is going to be a
 store where you could buy weapons etc... The thing I want to ask you
 guys is this. Lets say There is a knife i want to buy. It costs 10
 points. And I have 100 points. How would I make it so when I click BUY!!
 My money automaticaly subtracts from 100 to 90. How do I do that?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 
 
 This message has been delivered to the Internet by the Revenue Internet 
 e-mail service
 
 *
 

You could read up on AJAX.

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



Re: [PHP] My Project

2005-07-19 Thread Paul Waring
On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:
 My money is being stored in a database. And I want everythign to be in 
 PHP, no java script. And the BUY!! Button is a input button from a form. :)

Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = UPDATE users SET money = money - 10 WHERE id =  .
$_SESSION['user_id'];

assuming of course that you have a table called users where the money
for each one is stored and you're keeping the user_id in the $_SESSION
superglobal.

It's a bit difficult to help further without a bit more information. :)

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

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



Re: [PHP] My Project

2005-07-19 Thread André Medeiros
On Tue, 2005-07-19 at 17:57 +0100, Mikey wrote:
 George B wrote:
 
  Paul Waring wrote:
 
  On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:
 
  And I have 100 points. How would I make it so when I click BUY!! My 
  money automaticaly subtracts from 100 to 90. How do I do that?
 
 
 
  Where is your money being stored? In a database? A text file? A cookie?
  Do you want the buy link to work on the client side using Javascript
  or AJAX or have it submit to a PHP script?
 
  Paul
 
  My money is being stored in a database. And I want everythign to be in 
  PHP, no java script. And the BUY!! Button is a input button from a 
  form. :)
 
 $money = $money - 10;
 

$money -= 10;

saves some chars ;)

 I wish you the best of luck with your project :^)
 
 Mikey
 

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



RE: [PHP] My Project

2005-07-19 Thread Jay Blanchard
[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)

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



Re: [PHP] My Project

2005-07-19 Thread George B

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)



Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = UPDATE users SET money = money - 10 WHERE id =  .
$_SESSION['user_id'];

assuming of course that you have a table called users where the money
for each one is stored and you're keeping the user_id in the $_SESSION
superglobal.

It's a bit difficult to help further without a bit more information. :)

Paul

well what kind more information do you want to know? I can provide you 
with all the info.

By the way. Here is my table.

CREATE TABLE `b_users` (
  `userID` bigint(21) NOT NULL auto_increment,
  `username` varchar(60) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `status` int(20) NOT NULL default '0',
  `posts` bigint(20) NOT NULL default '0',
  `email` varchar(255) NOT NULL default '',
  `validated` int(11) NOT NULL default '0',
  `keynode` bigint(21) NOT NULL default '0',
  `sig` tinytext NOT NULL,
  `banned` varchar(255) NOT NULL default 'no',
  `rank` varchar(255) NOT NULL default '0',
  `usepm` int(11) NOT NULL default '1',
  `AIM` varchar(50) NOT NULL default '',
  `ICQ` varchar(50) NOT NULL default '',
  `location` varchar(255) NOT NULL default '',
  `showprofile` smallint(6) NOT NULL default '1',
  `lastposttime` bigint(20) NOT NULL default '0',
  `tsgone` bigint(20) NOT NULL default '0',
  `oldtime` bigint(20) NOT NULL default '0',
  `avatar` varchar(255) NOT NULL default '',
  `photo` varchar(255) NOT NULL default '',
  `rating` bigint(255) NOT NULL default '0',
  `totalvotes` bigint(20) NOT NULL default '0',
  `votedfor` longtext NOT NULL,
  `rps` int(11) NOT NULL default '1',
  `rpsscore` bigint(20) NOT NULL default '0',
  `lasttime` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`userID`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;

:)

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



Re: [PHP] My Project

2005-07-19 Thread Greg Donald
On 7/19/05, Mikey [EMAIL PROTECTED] wrote:
 $money = $money - 10;

Make sure you protect it against multiple browser sessions.

-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] My Project

2005-07-19 Thread Marek Kilimajer

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)



Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = UPDATE users SET money = money - 10 WHERE id =  .
$_SESSION['user_id'];


this does not check if the user has enough money. This query does:

UPDATE users SET money = money - 10 WHERE id = $_SESSION['user_id'] and 
money = 10


Then check affected rows to see if the money was actually subtructed 
from the account.


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



Re: [PHP] My Project

2005-07-19 Thread George B

Jay Blanchard wrote:

[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)

Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing anything 
into the database.


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



Re: [PHP] My Project

2005-07-19 Thread Mikey

George B wrote:


Jay Blanchard wrote:


[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.


Maybe that is because your data type is wrong?  Numbers (whole ones) 
should be stored as the integer datatype, otherwise math operators will 
not work.  Also, is characterName a valid row in your database, or did 
you mean to do some kind of variable substitution here?


I am not being funny here George, but don't you think maybe you need to 
read some kind of programming tutorial or something?  Your questions 
seem to indicate that you have just decided to charge headlong into a 
project with very little knowledge of what it is you are undertaking.


So far you have encountered so very mild responses to your posts, but I 
am sure it is only a matter of time before more and more people will 
redirect your posts to /dev/null - and really, when you get to the 
extremely gnarly parts of your RPG game you will find that there is very 
little repsonse or no response to your questions.


Anyway, dont want to sound like I am having a go, but this list really 
is for technical problems with PHP, not a replacement for the manual.


regards,

Mikey

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



Re: [PHP] My Project

2005-07-19 Thread Matt Darby

George B wrote:


Jay Blanchard wrote:


[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.




Lots of extra characters in that one... try this:

$q=mysql_query(update myTable set myMoney=(myMoney-10) where 
myCharacter='characterName');

if(!$q){echo mysql_error();}

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



Re: [PHP] My Project

2005-07-19 Thread Jochem Maas

Matt Darby wrote:

George B wrote:


Jay Blanchard wrote:


[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)



Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ;
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.




Lots of extra characters in that one... try this:

$q=mysql_query(update myTable set myMoney=(myMoney-10) where 
myCharacter='characterName');

if(!$q){echo mysql_error();}


so wasteful :-)

$q=mysql_query(update u set m=(m-10) where c='$c');if(!$q)die(mysql_error());





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



Re: [PHP] My Project

2005-07-19 Thread Robert Cummings
On Tue, 2005-07-19 at 21:46, Jochem Maas wrote:
 Matt Darby wrote:
  George B wrote:
  
  Jay Blanchard wrote:
 
  [snip]
  $money -= 10;
 
  saves some chars ;)
  [/snip]
 
  This actually requires two trips to the database, once to get $money and
  once to update $money. Do it in the query instead...once.
 
  $sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
  (`myMoney`-10) WHERE `myCharacter` = `characterName` ;
  $doUpdate = mysql_query($sqlUpdate, $myConnection);
 
  saves lots of characters ;)
 
 
  Hey, Look I made a new database just for this money testing stuff.
  This is the table:
 
  CREATE TABLE `money` (
`money` varchar(255) NOT NULL default ''
  ) TYPE=MyISAM;
 
  Now, I use this code
 
  $sqlUpdate = UPDATE `myDatabase`.`myTable` SET `myMoney` =
  (`myMoney`-10) WHERE `myCharacter` = `characterName` ;
  $doUpdate = mysql_query($sqlUpdate, $myConnection);
 
  And it should work, And it gives no error but it is not writing 
  anything into the database.
 
  
  Lots of extra characters in that one... try this:
  
  $q=mysql_query(update myTable set myMoney=(myMoney-10) where 
  myCharacter='characterName');
  if(!$q){echo mysql_error();}
 
 so wasteful :-)
 
 $q=mysql_query(update u set m=(m-10) where 
 c='$c');if(!$q)die(mysql_error());

Ugh... ;)

if(!($q=mysql_query(update u set m=(m-10) where
c='$c'))die(mysql_error());

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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