-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zane
-
@fenway, he's using three queries to get data from the same table. I suggested a query to encapsulate all three and the OP tells me he was expecting way more results. I.E, he only get 16 as opposed to 96. My query suggestion involved the use of GROUP BY with two parameters... When I told him to shorten it to one parameter he claims he gets less results.. Completely confused, I figured I'd move it to this board.
-
Well if you can't edit the getToken function, you'll just have to create a custom token for when it is unavailable... and code around that custom value throughout your script. Example @require_once('include/utils.php'); if(!function_exists('getToken')) $token = "NOTOKEN"; else $token = getToken(); if($token == "NOTOKEN") { // Do or don't do something. }
-
yes, but are you positive that this file exists? Currently your code looks in the same directory for that filename. The only way fopen would return false is if it didn't exist.
-
This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=344772.0
-
Ugh, so off to the mysql boards this goes.
-
So are you saying that the filename you see displayed is ALSO in the same directory as your php file?
-
Also, you still have javascript inside a PHP while loop. Not to mention, the javascript isn't even within script tags, so I don't understand how you're NOT getting an error. Put the following at the very beginning of your script error_reporting(E_ALL); ini_set('display_errors', true); ?>
-
if you use ?pr=$pr, then the variable will not show up in the $_POST array. Instead it will be in the $_GET array.
-
what does this structure in PHP mean "$variable[$variable2]"?
Zane replied to dmirsch's topic in PHP Coding Help
Indeed. -
Yep, now the only way that could fail is if the file does not exist.. or doesn't have read permissions, which I doubt. The most likely cause is that $_POST['filename'] has no value. The best way to check this is to echo $filename after you create it.
-
Group by only field3 and see what you get.
-
fgetcsv() expects parameter 1 to be resource, boolean given Q : Now if $handle is the resource, why would it be a boolean? A : It would be boolean if the $handle is false.. In other words, the error isn't on line 12, but it is on the line where you create $handle.
-
The reason is only shows the bottom most input field.. is because they are all named the same. You need to make arrays out of your new fields. So in other words, in your form and addRow() function.. quantity needs to be quantity[] description needs to be description[] and etcetera. The shipping and such do not need to be in an array.
-
Not sure what you mean by skip the first line, but if you want to skip the first entry.. then you'd do this Also, you should never put a mysql_query inside a loop. Create your query first and then query it.. It will run so so much smoother. To fix this, I have used a counter to skip the first loop. $handle = fopen("$filename", "r"); $x = 0; while(($data = fgetcsv($handle, 1000, ",")) !== FALSE) { if(!$x) continue; $import .= "INSERT into goaliestats(id,name,gp,w,so,gaa,date) values(NULL,'$data[0]','$data[2]','$data[8]','$data[26]','$data[18]','$data[28]')" . "\n"; $x++; } mysql_query($import) or die(mysql_error()); fclose($handle);
-
This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=344780.0
-
Ok, I'm lost. Reading the first page I had initially figured the problem was because of the intermittent javascript ... without now that jcbones has spoke up about it.. I'm lost on the status of your problem. Show us what is and is not coming through.. just as you did earlier. If you're just looking for a quick fix and want to send $pr real quick like, then change your form action to book.php?pr=$pr But I don't recommend that solution.
-
You should not need to create multiple tables. Mainly because the information within those s is relevant to one another. You wouldn't buy a new box of Kleenex every time you wanted to blow your nose would you? But you would buy a trashcan if you needed to throw one or whatever else away... get me? Regardless, you provided the table structure and a detailed description, so it's much easier to see what you're doing wrong.. or need help with. ------------------------------------------ The most typical goal in using SQL is to use as less queries as possible. Even though you only have three queries, you still have to loop through each one.. breaking in an out to get your structure right.... and you don't need to field3 over and over unless you just want to SELECT * FROM slssum2 WHERE company = '$companyname' AND (month BETWEEN '$startmonth' AND '$endmonth') AND (year BETWEEN '$startyear' AND '$endyear') AND field4 != 0 GROUP BY field3, field4 That query should give you everything you need... notice the GROUP BY as opposed to ORDER BY. This should make the DISTINCT part you use in your first query... uneeded... But still, I'm no SQL expert. I could move this to the MySQL if need be, but you also have problems with your table layout, so unless another mod sees a good reason not to, I'll leave your topic here. Run that query in phpmyadmin and show us what you get.
-
Ok, I see what you did now. I supposed that's a good approach... it would keep you from setting sessions and/or GET variables... and best of all, no JS. I'm settled, I guess I shouldn't have used the word rude, as you weren't. I was only trying to point out that an OP needs to post his/her solution before leaving. Mainly because others out there might have the same problem, come to this thread and leave disappointed. Glad you got it solved and working.
-
It looks like you need to Group by... someting. I can't tell what that something is because you gave your field name numbers and I'm not up for guessing which is what. You should definitely change your naming structure for one, but seeing as that isn't the problem (I'm assuming) ... I doubt you'll do that. It would help tremendously if you also provided a screenshot of what you see in phpmyadmin. ... either that or a db schema... telling us which fields are which.. which one you want to group by in particular. EDIT: Although, one problem that I DO spot out immediately is that you are creating a new table inside a loop. Unless you really want as many tables as you have rows, then this is a big no-no.
-
I don't see anywhere in your provided code where you are actually starting the session with session_start On another note, It is so valid. What gave you the idea that it wasn't And if there are zero rows, well then 0 is the same a false. If this were a mysql issue, I'd imagine the OP would have posted a mysql error.
-
Why not explain just exactly how you did that? You have been given plenty of answers of how to do this, with jQuery/Javascript.. mixed with some CSS. Now how on earth did you fix it using PHP? Everyone gave you a decent solution as well.. and to flat out say "Even though I ignored your advice, I still managed to fix it using a completely different method" is pretty ignorant and rude, in my opinion. Why even start a topic?
-
This effect can only be done in Javascript.. and a better way would be to use the Javascript framework jQuery Then you could make this effect in one line... or two Keep in mind that you'll need to have a CSS class for these clicked buttons. $("a.menulinks").click(function() { $(this).addClass("clicked"); });
-
This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=344421.0
-
There's your cure-all solution.. listen to fenway.