whats the col type of the bible-verse_ref field? If its not a numeric field
(ie autonumber key) then perhaps consider adding one, and updating on that
key...
Bastien
From: "Ron Piggott" <ron.php@xxxxxxxxxxxxxxxxxx>
Reply-To: "Ron Piggott" <ron.php@xxxxxxxxxxxxxxxxxx>
To: "PHP DB" <php-db@xxxxxxxxxxxxx>
CC: "Bastien Koert" <bastien_k@xxxxxxxxxxx>
Subject: mySQL UPDATE Date: Thu, 9 Jun 2005 15:00:14 -0400
I created a PHP based mailing list that sends out a Bible verse and a
quotation each day. Today's verses were:
Bible verse of the day:
Matthew 17:19-21 Then the disciples came to Jesus privately and said, "Why
could we not cast it out?" And He said to them, "Because of the littleness
of your faith; for truly I say to you, if you have faith as a mustard seed,
you shall say to this mountain, 'Move from here to there,' and it shall
move; and nothing shall be impossible to you. But this kind does not go
out
except by prayer and fasting." ( NASB )
Quiet Time Quotation And Reflection Topic of the day:
If you hold the gospel up and you become it's shadow do you fit?
In both the Bible verse table and the quotation table is a "current verse
of
the day" column that the UPDATE command is suppose to change from a 0 to a
1
so the associated web page will be able to display and a few other
functions
will know the current verse of the day. The verses are selected randomly.
Both the UPDATE for the Bible verse and the UPDATE for the quotation
failed.
I know the code works over all. From my estimate the use of " or ' is the
reason why the UPDATE didn't work.
Let me show you some code:
It selects a Bible verse:
SELECT * FROM bible ORDER BY RAND() LIMIT 1
Then it puts the text into variables:
$bible_verse_ref=mysql_result($result,$i,"bible_verse_ref");
$bible_verse_text=mysql_result($result,$i,"bible_verse_text");
$bible_verse_translation=mysql_result($result,$i,"bible_verse_translation");
Then immediately following this is the UPDATE that didn't work:
UPDATE `bible` SET `current_verse_of_the_day` = '1' WHERE `bible_verse_ref`
LIKE '$bible_verse_ref' AND `bible_verse_text` LIKE '$bible_verse_text' AND
`bible_verse_translation` LIKE '$bible_verse_translation' AND
`current_verse_of_the_day` LIKE '0' LIMIT 1
Where there are no ' or " this piece of code works just fine. I am
essentially retrieving a Bible verse from the table and then immediately
searching for it to change the 'current_verse_of_the_day' to change from 0
to 1. I have manually made the change for today and the
current_verse_of_the_day value was 0. Similar code is used for the
quotation --- but there is no need for me to repeat it here.
Any ideas how I am able to get the use of ' or " to work on this page?
Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php