troubleshooting Question

PHP SQL Add words to field in database table

Avatar of error2013
error2013 asked on
4 Comments1 Solution380 ViewsLast Modified:

I have a mysql table with the following fields:

id, name, story, rank

I also have 2 authors:

Peter and Paul

I need some code in php what will do the following altogether:

Select  * from table where rank = 1
From the output list I need to add the author names into the story fields.

So for example, is the result of the query above is 10 records

Then the name Peter is added to 5 records inside the story field and the name Paul is added to 5 records.

so Peter is added to 50% and Paul is added to 50%

Can anyone help please?
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros