akphidelt2007
Members-
Posts
174 -
Joined
-
Last visited
-
Days Won
2
Everything posted by akphidelt2007
-
PHP GD Image Graphing problem with color running out
akphidelt2007 replied to akphidelt2007's topic in PHP Coding Help
Here's an example with a LIMIT set to 200... if you look very closely you can see the line is still being drawn at the correct coordinates, it's just "running out of color"... not sure what the correctly terminology is. I created 2 lines here, where the 2nd line is just the first set of data - 10. If I switch it to 100, the whole graph shows up correctly. -
PHP GD Image Graphing problem with color running out
akphidelt2007 replied to akphidelt2007's topic in PHP Coding Help
Problem is, if I post the code it's my own graphing class so it doesn't make any sense. It basically stops "drawing" the graph at the last point. for instance... function DrawGraph() { $this->__IMG = imagecreate($this->img->width,$this->img->height) or die("No Library"); $this->DrawImgBG(); $this->DrawImgBorder(); $this->DrawTitle(); $this->DrawY1Axis(); $this->DrawGridlines(); $this->Plotter(); $this->DrawXAxisBorder(); $this->DrawXAxis(); $this->DrawLegend(); $this->DrawGraphBG(); $this->DrawGraphBorder(); } Not passing any data through a url. So the last items to be "drawn" are what disappear as I increase the limit size. So everything is proportional. When I don't have a limit the plotted line stops at the right coordinates... I've checked through the math of the plotter, and the data that is not showing up shows the right coordinates for where it should be. The color just doesn't show up. And if I reduce the limit to say 100, the entire graph shows perfectly. 200, I start to lose most of the x axis, although the ticks and labels are showing up in their right coordinates. If I move the limit to 300, the entire x-axis doesn't show up, and I start losing visibility at the end of the plotted line. I don't think it's a coding part in terms of drawing the graph. I think it might be something in terms of how I'm displaying it. I don't do anything fancy. Here is how I display the graph... Edit:: And by limit size, I'm simply talking about putting a LIMIT on the query. function Display() { //first step is to calculate the YAxis and figure out the dimensions $this->ScrubData(); $this->DrawGraph(); $path = $this->imgPath ? $this->imgPath : "image.png"; imagepng($this->__IMG,$path); imagedestroy($this->__IMG); return "<img src='$path?num=" . time() . "'>"; exit; } -
PHP GD Image Graphing problem with color running out
akphidelt2007 posted a topic in PHP Coding Help
Ok, I have a graphing class that I built to build simple bar/line graphs for work. I have a side project I'm working on that is a little bigger in terms of data. Usually I do months or weeks. But I have some arrays with about 1000 data sets. And when I create the image it stops at a certain point and doesn't even draw the X-Axis (One of the last procedures in my code). And I know there is an issue, because if I Limit the query to 100 results, the graph will come out fine. If I limit it to 200 results the plotted line will show but the X-Axis will be cut of. If I put it to 300 results the plotted line will stop towards 2/3rds the way through the graph. So I know the code is working when I reduce the results. I check the image info and it's only 3.25kb in size. Not sure what's going on here. I tried googling it but really didn't come up with any solid answers like most google searches. If anyone has a clue why this is happening, please let me know. Thanks a lot in advance. And what's weird is if I add Zebra gridlines to it, on the colored zebra background, I can see a white line that represents the data. It's almost like the ink runs out, lol. -
Well the submit button has to be pressed for the server to know what post values you have. Just redirect after you check to see if the form has been submitted if(!empty($_POST)) { $url = "http://" . $_POST['web'] . "/" . $_POST['cat']; header("Location:$url"); exit; } * Keep in mind, my code is not safe at all. Just an example
-
Say your array is stored in $array $primary_number = $array[0]['components']['primary_number'];
-
Try this $xaxis[]=$channel[0][0];
-
Form Submits but Doesn't Save Into Database
akphidelt2007 replied to ismoore's topic in PHP Coding Help
You shouldn't suppress your errors like that, they might tell you what is going wrong. -
Yes it is, but it's a pain dealing with the various browsers and requires some javascript. Your best bet would be to Google it to get started and if you have any specific problems come back and ask.
-
"5,2,1" is one string. And PHP reads it correctly. You are acting as if commas are some deliminator when you put a string in an array. Like I said the array will be Array([0]=>"5,2,1"). Which is correct and not a bug.
-
It's not a bug... $monsterdata['droparray'] = "5,2,1"; $item_id_loot = array($monsterdata['droparray']); //this would result in Array([0]=>"5,2,1")
-
How do you know it's getting the required data? Are you basing this off the fact it's not generating an error or have you actually checked what data it's returning?
-
There's no reason to return a boolean if you want a value. When I need to get 1s and 0s, I do... return $conn->affected_rows > 0 ? 1 : 0;
-
These statements are equivalent... return ($conn->affected_rows > 0) ? true : false; return $conn->affected_rows > 0;
-
That's not true. It will return true or false
-
False can be used as 0, but it does not return 0. It returns an empty string. You can use (int) false to get the zero.
-
Well I don't know the correct terminology but just from experience, false is no value. So if it returns false, it returns an empty value. Return true returns 1. So depending on how you are checking for this "return" you might not be using it the correct way.
-
Show you how? This would be a pretty complex project that would require quite a bit of time and energy. Especially depending on what you mean by "inside the store". If you mean like 3d imaging and being able to view and navigate around the store that would be expensive and complicated. It would be easiest just to take your own dimensions of the store get a drawing utility and draw a map. Then store the coordinates of the items in a database. Then you can run some algorithms to find the quickest route and locate items.
-
Update is inserting information into wrong id
akphidelt2007 replied to AshleighCo's topic in PHP Coding Help
It's obviously coming from your code that retrieves the id from the user table. Post your query that fetches this data. -
You are going to have to do this on the PHP end. Changing the query with group by won't give you that desired result.
- 2 replies
-
- concat
- mysql join
-
(and 3 more)
Tagged with:
-
formatting numbers in different colors
akphidelt2007 replied to blackholesun's topic in PHP Coding Help
Or if you want 0 to blue you can do the shortcut... $color = $row['result'] < 0 ? 'red' : 'blue'; echo "<span style='color:$color;'>{$row['result']}</span>"; -
formatting numbers in different colors
akphidelt2007 replied to blackholesun's topic in PHP Coding Help
I usually do this like this if($row['result'] > 0) $color = 'blue'; elseif($row['result'] < 0) $color = 'red'; else $color = 'black; echo "<span style='color:$color;'>{$row['result']}</span>"; -
Database is probably a reserved word that you can't use as a table name. Just a guess.
-
He probably wants to show the data also which is why he isn't using the SUM() in the query. He's basically trying to create a totals row at a bottom of a table. My guess is the way you are loop through the query. //this returns only the first result foreach (mysql_fetch_assoc($result_merge_stats) as $k=>$subArray) { foreach ($subArray as $id=>$value) { $sumArray[$id]+=$value; } } //this is what I'm guessing you want to do while($row = mysql_fetch_assoc($result_merge_stats)) { foreach($row as $id => $value) { $sumArray[$id]+=$value; } }
-
Well, this works perfectly fine... $dates = explode('|', "1368140499|1368140500|1368140501|1368140502"); $users = explode('|', "name|name2|name3|name4"); foreach(array_combine($dates, $users) as $date => $user) { echo date('d/m/Y', $date).' - '.$user.'<br>'; } //produces 09/05/2013 - name 09/05/2013 - name2 09/05/2013 - name3 09/05/2013 - name4 So either your query is not getting the desired results you want or the $getUser query is creating some kind of error halting the loop to continue.
-
The code works for me when substituting the strings in to $dates and $users. Where is $code coming from and are you sure those are actually the arrays you are getting? Try it with out $getUser... and see if it works.