-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
How do you know you don't have an error? Do you have php errors enabled? You aren't checking that the result of your query is valid either. You exit without showing any of your results, not even an acknowledgement that it MAY have worked. With that said - your query is bad.
-
FPDF is a php class. That means you write your same old php code to accomplish your solution (get the data!) but when it is time to output it you make calls to methods of this class instead of echo'ing it to the client. It will take a little practice to understand how the calls work and to get comfortable with the setting of x & y coordinates but if you're a programmer you'll catch on soon.
-
Like trq said - we need some direction so that we can give you direction. Please explain your problem better. Your original post was kind of squirrely. Can you write better English or at least elaborate more on your problem(s) with fpdf? I've used fpdf multiple times and think I know it pretty well.
-
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
Which is why I wanted to see your code. good luck - hth -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
No - all your code. Plus add a check of the number of rows you get from the query before continuing. -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
Can I see you new code now? -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
Why won't you use the line I gave you? Yours is flawed. Please? -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
my string works and is much simpler: $q = "select * FROM data WHERE DATE_FORMAT(date_time, '%Y-%m-%d') = '$todaysdata' "; Note: I changed the quotes as well as the month spec - %m will give you 01,02... as it should be. Note that by using dbl quotes outside you can avoid having to concatenate the variable at the end. -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
Change my double quotes around the format string to singles. -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
1 - why are you using sprint??????? 2 - you're thinking backwards. You want to get the table's date field in a format that you can compare your $todaysdata field to, no? If you applied your curiosity and work effort to a little research on MySQL you would find the list of MySQL functions that are available. Especially the ones that pertain to dates. $q = "select * FROM data WHERE DATE_FORMAT(date_time, "%Y-%c-%d") = '$todaysdata' "; -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
That's because you have no data. Agreed? Think about what you wrote in your first post. You know what the date_time (btw - bad field name) field holds in the table. You know what the value you wish to compare to the records looks like. Do they look alike? -
Trying to download data matching current date but unable to
ginerjm replied to lovephp's topic in PHP Coding Help
When you say "isn't working", whatever do you mean? I'm guessing that you get no results from your query. Yes? -
1 - you are only saving the cookie for one hour. 2 - Does your browser have cookies disabled? 3 - How do you know it is not being saved? PS - When you say it is not setting the cookie, is that a fact or are you simply saying that you are getting your error message instead?
-
Have you run this code? Do you get any errors? I would think you do since you don't seem to use quotes on your indices. And the use of an @ on the variable that you are trying to retrieve and include in your list is kind of odd since there s/b no errors. Run the code with php's error checking turned on, clean up any errors that occur then tell us what goes wrong.
-
You have to give the cookie a negative duration I believe. Also - per the Manual - you can't send a cookie once you have generated output, which the echo above is probably doing for you. Also - per the Manual - you are supposed to use all the same parameters (except expire) to delete a cookie. I do this all the time with my secured apps and simply respond to a client's request to log out with a set cookie with a time()-3600 as you tried in one of your examples. Note that the cookie will still exist in your session until the next script is called since they were loaded by the browser. At the end of your current script the brower will delete its cookie and the next start of your session will no reflect it. All this was found in the php manual - a wonderful resource!
-
You confuse yourself methinks. You said that you only care about the last digit, then you worry about some "foo" values which do not appear to be the last digit. This is simple string manipulation which I'm sure you have read about in the php manual. And if not, I suggest that be your next stop. (It should have been your first stop....)
-
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
I thought it was a permissions problem. Change the permissions and it will go away. OR use the advice given to you and skip the whole move and creating a permanent file and just let the system delete the temporary file. OH - and work on your English. Or stop typing on your cell phone. A little respect for yourself and those you wish to read and understand your writings can come in handy. -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
To sort a csv file is a bit of a bind but do-able. Read the file in using fgetcsv which will give you an array. Then grab the element of the array that you want to sort by and then assign that value as the key of a new array and the array you read the data into as the value of that key. while ($row = fgetcsv($handle)) { // use element #3 of the input as the sort key (starting with 0) $sortarray[{$row[3]}] = $row; Now just sort the var $sortarray and then process the sorted array using a foreach. Of course I haven't done this and I'm having a bad day on the forums, so there could be flaws in this. Cheers! foreach ($sortarray as $k=>$v) { (process $v as an array the same as you would have processed $row in the first block of code) } -
How to two submit button on one form with two different action
ginerjm replied to Ordinary_Shepp's topic in PHP Coding Help
If anyone is still reading this I have to correct my code above. In the PHP code one should be checking $_POST['btn'] and NOT $_POST['submit']. Don't know what I was thinking when I dashed off that response. Two major errors in one hour today. Must need a rest or something...... -
Warning: mysqli_num_rows() expects exactly 1 parameter
ginerjm replied to dojo's topic in PHP Coding Help
My bad - and my apology. I didn't read the initial error message completely and made an assumption. Glad someone else re-directed the OP. -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
error_reporting(E_ALL | E_STRICT | E_NOTICE); ini_set('display_errors', '1'); To repeat my previous put an echo IN FRONT and one AFTER the unlink. Showing the result of the unlink is not very helpful since it is Boolean most likely. echo "About to do unlink<br>"; unlink(....); echo "Did the unlink"; -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
Put an echo in front of the unlink and one after it to prove that it ran. Turn on php error checking too. -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
did you add an echo to debug the code? -
Warning: mysqli_num_rows() expects exactly 1 parameter
ginerjm replied to dojo's topic in PHP Coding Help
This is the link to this forum. http://forums.phpfreaks.com/forum/13-php-coding-help/ The first post is labeled "README: PHP Resources & FAQs -
little help please. need to make file get uploaded by form/
ginerjm replied to lovephp's topic in PHP Coding Help
I don't see why - ttry adding an echo after it to see if it gets there. Also - just noticed that you are losing the first row of you csv file due to an extra read before your loop