Jump to content

thepip3r

Members
  • Posts

    289
  • Joined

  • Last visited

    Never

Everything posted by thepip3r

  1. right and i understood that... i'm trying to rotate the x-axis headers say 45 degrees so they're not vertical but slightly angled. all of the examples i can find are just creating a rotated image on the fly but not one that is created within the context of an existing "graph" image. do i ahve to create that x axis value as a separate image or something and then merge it into the graph body in order to get the x-axis headers rotated correctly?
  2. Warning: imagerotate() expects parameter 1 to be resource, boolean given in public_html/trigeo/graph_line.php on line 157 when i change the above code to: $temp = imagestringup($img,0,$x1-2,$img_height-5, date("m/d/y D", $key),$bar_color); # x-axis heading values imagerotate($temp, 90, 0);
  3. 5 | 4 | . 3 | . 2 | . . . 1 | . ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ a b c d e f g in my graph, the x axis heading values are actual date strings and they are vertically oriented using imagestringup(). i've tried assigning the value of imagestringup to a variable and then use that for the imagerotate() but i get an error when i do that. can anyone point me in the right direction pls? for($i=0;$i< $total_points; $i++){ # ------ Extract key and value pair from the current pointer position list($key,$value)=each($array); $x1 = $margins + $gap + $i * ($gap+$bar_width); $x2 = $x1 + $bar_width; $y1 = $margins + $graph_height - intval($value * $ratio) ; $y2 = $img_height-$margins; imagestring($img,0,intval(($bar_width-(strlen(trim($value)) * 6.5)) / 2) + $x1,$y1-10,$value,$bar_color); # numeric values written to screen $temp = imagestringup($img,0,$x1-2,$img_height-5, date("m/d/y D", $key),$bar_color); # x-axis heading values imagerotate($img, 90, 0); imagefilledellipse($img,$x1,$y1,5,5,$bar_color); if ($i > 0) { imageline($img, $x0, $y0, $x1, $y1, $bar_color); } $x0 = $x1; $y0 = $y1; } header("Content-type:image/png"); imagepng($img);
  4. have you enabled the mysqli extension in your PHP config file?
  5. in your most recent example, can you explain how you're getting 3*3? for the array you referenced, i see 3, 5, 3, 1, 7. do the numbers need to be the same? meaning they are the same vertical length which would equal a rectangle? ...that's what i assumed from my previous post. for the array you mentioned, 3, 5, 3, 1, 7, each of those numbers represent a vertical line correct? and if so... do they in themselves constitute a rectangle or does only a line of equal length adjacent to it constitute a rectangle? i guess what i'm ultimately missing is what constitutes a rectangle? I can't see how a vertical line with 3 boxes and a vertical line with 5 boxes would constitute a rectangle. but i'm sure i'm interpreting that wrong. please clarify and i'll see if i can't actually help you out instead of just cause confusion. =P
  6. i would imagine u would use the same sql query with code examples from the manual for: http://us2.php.net/manual/en/mysqli-result.fetch-assoc.php
  7. lol ok.. well then ur not explaining it well. but that should be easy as well. if you want to find the largest pair of numbers (assuming that's your criteria for defining a rectangle), then simply add each number in it's occurring order into an array. Then loop through the array until u find pairs of equal numbers. when u find a pair, add those values to another array or a variable. with each loop, if the next set of numbers is "larger" than the first, replace it... your resulting values would be the "largest possible rectangle" then calc the area off of that: $array = array(3, 1, 5, 4, 4, 3, 2, 2, 1, 6, 5, 7, 3, 2, 6, 6, 2, 1, 1, 9); $biggestNum = 0; for ($i = 0; $size = sizeof($array); $i < $size; $i++) { if ($array[$i] == $array[$i + 1]) { $biggestNum = $array[$i]; } } $area = ($biggestNum * 2) * (L*W);
  8. no. the "view source" on that page would simply show you the raw HTML output, not the PHP. however, this MIGHT be able to help you.... open up your live page, view source on that, then open up the cached google page, view source on that... compare the two and then it might help illuminate where the error in code was made that you can easily rectify.
  9. simple i believe... if all of the squares are the same dimensions... we'll say 2x2, then your calc would be: x * (L * H) where x is the number of squares... so in ur example where you have a total of 13 squares, then the calc would be 13 * (2 x 2) = 52 Edit: so in your last example, using my L and W calcs, your equation would simply be: 8 * (2 * 2) however, if, like you say, the square is a 1 x 1 square.. that's even easier... your area would be 8 * (1 * 1) = which is obviously 8
  10. yes and there is... but it is not so static as it is based off of a calculation of the number of points to be placed on the graph... maybe i should include some "minimum distance" or something along that order. ty for the very simplistic logic on how to orient the texts. greatly appreciated.
  11. my apologies... i've been actively troubleshooting since the post so i'm echoing out values as well... try it now.
  12. so i'm writing a wrote a page that displays a graph: http://www.zigsdigs.com/trigeo/graphDisplay.php all you'll see is the default values, not actual data because no form was submitted. BUT, here you can kind of see my problem. i'm writing the actual number values on top of the graph points. but sometimes, the lines overwrite the word or the points are too close on the chart that they overlap each other. i'm not asking for code... just an idea on how to go about fixing this issue? i was thinking about possibly trying to figure out a calculation for overlap using point-to-point slope with some calc to see if a point would lie on a line, x,y coord with strlen to see the total space taken up by a text image, etc. can anyone describe a better way ?? TIA!
  13. i want to echo the equation in a different place than i'm assigning.
  14. $thc = round(((($_GET['h'] / 25.4) * ($_GET['w'] * .01) * 2) + $_GET['d']), 2); so... $thc ends up being the result of an equation. my question is: Is there some function that will show the EQUATION itself using the variable $thc or do I have duplicate rewrite the equation preformatted to show the equation? so... for example: echo $thc; //gives something like 28.80 //and print_pre($thc); //gives "round(((($_GET['h'] / 25.4) * ($_GET['w'] * .01) * 2) + $_GET['d']), 2)"
  15. right and i understand this allows me to apply a user defined function to an array but that doesn't answer my question. my question is about manipulating my array order once it's been sorted. specifically, how do i go about manipulating the array. can you reorder the array by an element in a sub array OR is there a way that i can simply rename an array's key.
  16. kk so i'm going to figure this out on my own but need some guidance. i'm going to pull out the elements of the array that i want to sort on and put them into a temp array, i'll apply some kind of array sort on that temp array and then reorder the parent array based off of my temp array's sort. my question is, if the array looks like the sample above: 1. ...can i reorder that array somehow? (i've looked through the array functions and can't see any that fill my needs) or 2. if i write the new output to like 'submittersTemp', if i wipe the 'submitters' current key, can I then rename submittersTemp back to submitters? (i couldn't find any array_key_rename() function).
  17. to give you a hint desoto.. the thing that makes PHP absolutely beautiful for me is it's array abilities. of all the languages, i've worked with (batch, vbscript, perl, kix, autoit, etc), all array handling was horribly painful (with the exception of perl) but PHP just eclipses them (IMO). so guessing your resultset now looks somethign like: Array ( [0] => Array ( [id] => 2 [catid] => 3 [title] => images test [author] => author name [desc] => description here. [articleid] => 2 [filename] => Array ( [0] => image0001.jpg [1] => image0002.jpg [2] => image0003.jpg ) ) [1] => Array ( [id] => 3 [catid] => 3 [title] => images test [author] => author name [desc] => description here. [articleid] => 2 [filename] => Array ( [0] => image5434.jpg [1] => image5435.jpg [2] => image5436.jpg ) ) the nested loop to see and use that data is as simple as: foreach ($array[$id]['filename'] as $val) { echo "$val"; # $val will be the filename echo'd to the screen } ..or you can do it iteratively: foreach ($array as $key => $val) { if ($key == "filenames") { foreach ($key as $file) { echo "$file"; } } }
  18. ok... so i think i get it looking back at your #6, it's the $c variable that's throwing both of us off (I think)... change your array building loop to: while ($a_row = sqlFetchArray($res)) { $records[$a_row["id"]] = $a_row["id"]; $records[$a_row["id"]]["catid"] = $a_row["catid"]; $records[$a_row["id"]]["title"] = $a_row["title"]; $records[$a_row["id"]]["author"] = $a_row["author"]; $records[$a_row["id"]]["desc"] = $a_row["desc"]; $records[$a_row["id"]]["articleid"] = $a_row["articleid"]; $records[$a_row["id"]]["filename"][] = $a_row["filename"]; } that way... duplicate record information (catid, title, author, desc) will just get overwritten and any new filenames will be appended into the filename array. if this doesn't work, i still don't see the problem then because according to your temp resultset, your "id" field is unique so they *SHOULD* be different records w/different filenames.
  19. kk so right... what that is telling you is that on yoru initial query "select * from player where id='$id'", your code is seeing that person as being a "mod" or having a variable set as mod, which is why it's throwing the error. unfrotunately, i don't know how that gets set because it's generated from a SQL query so i really don't know what else to tell you other than, according to your coded-logic, you are getting the appropriate error.
  20. so again, change: $query=mysql_query("select * from player where id='$id'"); $row=mysql_fetch_array($query); $atype=$row["Status"]; $eshow=$row["show"]; to $query=mysql_query("select * from player where id='$id'"); $row=mysql_fetch_array($query); $atype=$row["Status"]; $eshow=$row["show"]; echo "Atype = $atype <br> Eshow= $eshow"; if eshow is equal to if atype is 0 or eshow is diamond or mod before the page is ever posted, you'll never be able to submit anything because the page's logic is set up to fail your code on those conditions.
  21. between your two tables.. where is table1 associated to table2? what is the data relationship? table1.id is a 1->Many with table2.articleid?? if so, try this query: SELECT * FROM table1 t1 JOIN table2 t2 ON (t2.articleid=t1.id) WHERE t1.id='$articleid' EDIT: the reason your code is displaying in different numeric-index'd 0th arrays is because of your $c variable. i'm not sure what that is or what number it's derived from but that's the reason, your data is showing up in different blocks at that lvl, $c is changing with each iteration of your while loop. also, if you have PHPmyadmin... run the raw SQL query through it and give us a sample result set in the SQL itself, not the PHP-washed data.
  22. yes but at least you're getting somewhere as your submit button wasn't functioning previously. lol and for your problem with it saying you created three rows already, u need to examine the code that is building and making conditions on the "show" creation: $query=mysql_query("select * from player where id='$id'"); $row=mysql_fetch_array($query); $atype=$row["Status"]; $eshow=$row["show"]; if($_POST[create]){ $date= date(l, strtotime("$_POST[rundate]")); if($date == "Sunday"){ print "You can't create shows on Sundays! "; exit;} if($eshow == "0" && $atype == "normal"){ print "<BR><BR><font size='4pt' face='comic sans ms'>You've already created 1 show today!</font><BR><BR><a href='shows.php'>Go back to Show Page</a><BR><BR><BR>";include "footer.php"; exit;} if($eshow == "0" || $atype == "diamond" || $atype == "Diamond" || $atype == "mod" || $atype == "Mod"){ print "<BR><BR><font size='4pt' face='comic sans ms'>You've already created 3 shows today!</font><BR><BR><a href='shows.php'>Go back to Show Page</a><BR><BR><BR>";include "footer.php"; exit;} so echo $eshow and $atype after it's being set at the very top of the page and see what the values are being set to before the page is ever submitted, if atype is set to diamond before before the page is ever submitted then they've already failed before they filled out your form. also, is the message, "You've already created 3 shows today!</font><BR><BR><a href='shows.php'>Go back to Show Page</a><BR><BR><BR>";include "footer.php";" the one that is being thrown?
  23. well the "repeatedness" depends on a lot of factors: your table structure, your sql query, etc, etc. i can tell you how to bandaid your problem but i'm still a little lost as to your exact issue since i don't know ur table struct or your resultset. bandaid: you can always use an if (!isset($records[$c]["articleid"])) { -- that way if it's already set, it won't again but i again, that would be a bandaid to *what sounds like* a poor query. u can either play with the bandaid or give us a sample resultset of your query so we can examine it and get a better grasp at what data relationships look like.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.