4
votes
1answer
279 views

Optimize MySQL double select inside for-loop

I want to get the number if items with state 4 and 1 from my database for each day between a certain date. Is there a smarter ...
3
votes
1answer
520 views

Nested while loop for getting db data. Timing out at random times because of the PHP. Any way to make this more efficient?

So today I jumbled together a script that would get data from a database, from different tables and such. I had wanted to just use simple ifs without the whiles, but I couldn't make it possible. The ...
2
votes
3answers
113 views

Trying to Find a Loop to use for a specific MySQL query

I'm trying to see if there is a loop I can use in order to pull off this code a little more elegantly. I was previously using a foreach($row as $cell) with ...
1
vote
1answer
90 views

Is there any better way to fetch two tables in one statement or query?

The 'Do' method is for prepared statements and returns (by fetchall()). I am also using two looping statements. Is there any better way to fetch two tables in one statement or query? If not, what ...
1
vote
1answer
244 views

Is there a better way to loop through records and call an api?

I have a CakePHP function here that gets info for a twitter screen_name from the twitter api and writes it to a mysql db. I'm just looking for feedback about other ways to accomplish this that might ...
0
votes
1answer
204 views

Using PDOs to import file data to database, what is wrong with this code? [closed]

More than likely, the query isn't built correctly as I am fairly green with SQL. ...