Re: mySQL query question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




okay I want to pull an integer from a database called confirm_number,
add 1 and repost it back to the database


here's the code I'm using.


$queryconfirm="SELECT confirm_number from contacts ORDER BY contact DESC
LIMIT 1";

I assume that you are already aware that if you set the variable $queryconfirm to this SQL query that the query is not necessarily executed and returns the result into the variable.
$confirmresult=$queryconfirm;

Now what you did is that $confirmresult is now:

"SELECT confirm_number from contacts ORDER BY contact DESC LIMIT 1"

as well as $queryconfirm. Why is that?
now here's the problem
I want to add 1 to confirm_number:

$confirm_number=$confirmresult;
$confirm_number+=1;

I will also assume that you don't think that $confirm_number will magically contain the result.
Now all this does is set the confirm_number record to 1 in the database.
So I assume that $queryconfirm somehow is not being passed to
confirm_number?  But, while we're here the confirm_number is supposed to
be 5 digits long and the +1 should make it 10001, 10002, 10003 etc

how would I set the original number to 1000 to begin with? Or should I
just set that in the database record its self when I'm ready to use the
website?

If what I assume is right (I don't want to disappoint you) but you should start reading some PHP basics on how you make database connection in PHP. Use google to find some tutorial for e.g.

If I am wrong post us the code to see if someone can help.

--
Thodoris


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux