-
Posts
15,290 -
Joined
-
Last visited
-
Days Won
436
Everything posted by requinix
-
$total_rows. Or create a new variable just for the folder's rows. foreach($folders as $folder) { $search_mailbox = $link->prepare("SELECT * FROM $folder WHERE from_email LIKE ? OR subject LIKE ? OR message LIKE ? ORDER BY received_date DESC LIMIT $offset, $limit"); $search_mailbox->execute([$searchemail, $searchsubject, $searchmessage]); $folder_rows = 0; if ($search_mailbox->rowCount() > 0) { foreach($search_mailbox->fetchAll() as $k => $row) { $email_number = $row['id']; $search_from = $row['from_email']; $search_subject = $row['subject']; $total_rows++; $folder_rows++; echo $search_subject . '.........................' . $folder_rows . ' / ' . $total_rows; echo "<br>"; } } } You should see $folder_rows stay between 1-50.
-
Then your code must not be the same as what you originally posted. Because what you showed there very clearly did 50 per folder. You also had a couple echo statements in it. One included the value of $total_rows. Are you saying you get more than 50 because the value outputted goes beyond 50? Because you do not reset that value for each folder. Reset the value to 0 before each folder's query, then see what output you get.
-
First, I need some confirmation: are you getting more than 50 per folder? Or up to 50 per folder and more than 50 total per page?
-
Ooh, you almost had me there. I didn't realize you were being sarcastic until I nearly hit the Submit Reply button. Great joke. 👍
-
LIMIT most definitely does work. But it only applies to one single query. If you want to limit multiple queries then you "have" to do that yourself. But what I said is still the best way to go. It will take some work to change to now, but it makes a great number of things much easier.
-
I don't see that code attempting to do a redirect. Please post the version you tried to make do the redirect since that is, after all, the one that doesn't work. When you do post it, please use the Code <> button so it doesn't end up as that blob.
-
Then post the code for it so we can tell you what the problem was.
-
There is in what you posted. But obviously it's just in the post, otherwise your script wouldn't run at all. The way you set up folders by using additional database tables is not good. There is no reason why anything should ever be done dynamically like that. Instead, you should have a list of folders, all messages should be in the same database table, and each should be marked with the folder it's in. ...Are you saying you currently get 50 per folder and you don't want it to be per folder? Because that is what the code does. The deal with using a list of folders and holding all the messages together would make this all very much easier. taquitosensei already replied, but you'll have more luck researching the concept on your own if you use the term pagination.
-
Except for the fact that you hardcoded $page to 1 (and except for the syntax error), it looks right. Well, also except for the folder thing, that's really not good. I see you have some debugging output there. What do you see?
-
Make a normal link to invoice.php and have the script do the redirect.
-
How to change seconds into Days, Hours, Minutes, Seconds
requinix replied to Lux05's topic in PHP Coding Help
-
Use one <a>. If you want it to look like a button then make it look like a button. Then add a target attribute to it. If that's still not working then post your current code. Everything that might be relevant. Not just the line with the link/button on it.
-
Composer not autoloading classes from vendor dir in index.php
requinix replied to JacobSeated's topic in PHP Coding Help
It's easier when you contain all your mailing work in one single location instead of spreading calls to it throughout your application. It's perfectly acceptable to create your own mailing class that uses PHPMailer to do the work. Don't worry about those files. It should be mentioned somewhere, but otherwise it's mostly implied. -
Composer not autoloading classes from vendor dir in index.php
requinix replied to JacobSeated's topic in PHP Coding Help
You're reading from some old documentation. PHPMailer\PHPMailer\PHPMailer looks weird but it is correct: the first "PHPMailer" is the organization, the second is the project, and the third is the class itself. https://github.com/PHPMailer/PHPMailer/blob/master/UPGRADING.md -
Don't use relative paths like anything that starts with ../ Use absolute paths. If fill_sidebar.php is in folder1 then write /xxx/folder1/fill_sidebar.php. If it's somewhere else then write /xxx/somewhere-else/fill_sidebar.php.
-
Unable to redirect my page after submitting a form
requinix replied to joshgom's topic in PHP Coding Help
If you have problems with some code then you have to post that code. Not the working code. The working code works. Working code doesn't help your non-working code. -
Converting grayscale image to pure black and white
requinix replied to DianaSimona's topic in PHP Coding Help
And what's the problem? I see some PHP code there which looks like it's on the right path. In fact it already has something to grayscale an image, so I would think that what you need to do is simply modify that to use black and white instead. -
Detect codepage to use, read it from system? (for ZIP files)
requinix replied to Sonnich's topic in PHP Coding Help
Make sure PHP is being run with the correct locale, then retrieve it. Note that's not a complete answer. You'll need to investigate and test a little. -
The temp dir really ought to be writable by PHP. You and/or your client should complain to the "ISP" or whoever manages their PHP setup to allow for that. Worst case: write to someplace other than /tmp. Like a dedicated log directory for your application. Oh. And this is something that should be configurable.
-
How about you try describing what you want with a few more words? Maybe even an example or two?
-
Look at the documentation for session_destroy() to see how to destroy a session.
-
Extensions are not freebies. Most of them come with particular requirements that you must have installed. So you tell me, does it make sense to install Oracle database support on your server if your application has nothing to do with it? And all that software comes with additional risks of vulnerabilities and such. And some of them do come with some overhead even when not in use. And every time you want to update an extension you have to restart PHP. Installing and enabling extensions is easy. Don't be lazy. Get what you need, don't get what you don't need.