Jump to content

gladiator83x

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by gladiator83x

  1. Hi All, I have been having a ton of trouble trying to graph w/o the gd library. I was looking for a class that will let me graph one array against another array. Or pretty much--one sql column vs another. Anyone know of any links or information on how to do this. I have been downloading different scripts with their classes, and I got nothing  :-[
  2. How will I do that? I know that when I try to echo out $line, it just outputs 'Array' numerous times
  3. Hi All, I created a new table called Defects, which has 4 columns. I am trying to save the entire column as an array...is that possible. This is what I have tried. ------------------------------------------------------ $array= "SELECT Review_Defects.Defects FROM Review_Defects"; $array_result= mysql_query($array) or die('Query failed: ' .mysql_error()); while ($line = mysql_fetch_array($array_result, MYSQL_ASSOC)) { foreach ($line as $col_value){ // echo $col_value; } echo  $col_value; //--echoes everything in column } //echo  $col_value; --just echoes the last thing in column --------------------------------------------------------- If I echo within the loop, I receive everything inside the column--which is what I want within my array. Is there some sort of function that I will have to use?
  4. baachart.php is the class-- the actual file has the following code: include('baaChart.php'); $mygraph = new baaChart(600); $mygraph->setTitle('Regional Sales','Jan - Jun 2002'); $mygraph->setXLabels("Jan,Feb,Mar,Apr,May,Jun"); $mygraph->addDataSeries('L',LINE_MARK_X,"25,30,35,40,30,35","South"); $mygraph->addDataSeries('L',LINE_MARK_CIRCLE,"65,70,80,90,75,48","North"); $mygraph->addDataSeries('L',LINE_MARK_SQUARE,"12,18,25,20,22,30","West"); $mygraph->addDataSeries('L',LINE_MARK_DIAMOND,"50,60,75,80,60,75","East"); $mygraph->addDataSeries('L',LINE_MARK_NONE,"30,45,50,55,52,60","Europe"); $mygraph->setBgColor(255,255,255,1); //Transparent $mygraph->setXAxis("Month",1); $mygraph->setYAxis("Sales (£000)",0,100,10,0); $mygraph->drawGraph();
  5. I downloaded this graphing class and tried the sample code located here: http://members.aol.com/barryaandrew/baaChart/baachartguide.html#samples However, my graphs dont show up-- I get the following errors: ------------------------------------------------------------------- Warning: main(baaChart.php) [function.main]: failed to open stream: No such file or directory in /export/home2/webpages/baa.php on line 2 Warning: main() [function.include]: Failed opening 'baaChart.php' for inclusion (include_path='.:/usr/local/php/lib/php') in /export/home2/webpages/baa.php on line 2 Fatal error: Class 'baaChart' not found in /export/home2/webpages/baa.php on line 3 ----------------------------------------------------------------- I believe I have the gd library installed-- Is anyone familiar w/ graphing? Also, is there anyway to put a column of dates in order in mysql?--I was looking to see if there was maybe some kind of function.
  6. no i'm really just returning the last cell in my column--which doesn't come close to what the avg should really be-- i'm just confused. is there any other way to do this?
  7. Okay--I switched to mysql_fetch_assoc but it only return the last number in the column. I wrote the code 2 ways and I received the same result. Any suggestions? 1: $query = mysql_query("SELECT avg(More_Metrics.Days) AS columnaverage FROM More_Metrics WHERE More_Metrics.Topic_Title='$title'"); $array = mysql_fetch_assoc($query); $totalaverage = $array[columnaverage]; echo "$totalaverage"; 2: $sql= "SELECT AVG(More_Metrics.Days) FROM More_Metrics WHERE More_Metrics.Topic_Title='$title'"; $result = mysql_query($sql) or die('Query failed: ' . mysql_error()); $line = mysql_fetch_array($result, MYSQL_ASSOC); foreach ($line as $col_value) {     echo "\t\t<td>$col_value</td>\n"; }
  8. I thought that I had it...but I didn't. $query = mysql_query("SELECT avg(Days) AS columnaverage FROM More_Metrics WHERE More_Metrics.Topic_Title='$title'"); $array = mysql_fetch_result($query); $totalaverage = $array[columnaverage]; echo "$totalaverage"; I received the message: Fatal error: Call to undefined function mysql_fetch_result() in /export/home2/webpages/more_metrics.php on line 422 The error before that didnt recognize the AVG() fucntion. What am I doing wrong? It seems correct to me.
  9. Hi All, I was just wondering if someone could assist me in adding up a column full of numbers in my mysql table? I am trying to compute the average. This is what I started off with--but it doesnt return the sum. My table's name is More_Metrics. The column within my table is named Days. $query= "SELECT More_Metrics.Days FROM More_Metrics WHERE More_Metrics.Topic_Title='$title'"; $result1 = mysql_query($query) or die('Query failed: ' . mysql_error()); $i=0; while ($line = mysql_fetch_array($result1, MYSQL_ASSOC)) { echo "<tr>\n";   foreach ($line as $col_value1) { //   echo "\t\t<td>$col_value1</td>\n"; $i=$col_value1 +$i; $j=$i;///then i want to try to return $j--but i get nothing } } I guess I am a little confused.
  10. Hi All, I was just wondering if someone could assist me in outputting one of my Mysql tables as an Html table. I believe that I have to use one of the SHOW TABLE commands that mysql offers. I was thinking: $query="SHOW TABLE_NAME"; $result="mysql_query($query)"; Any suggestions?
  11. I tried using the session start function and I received these errors. I received this error when I put the session_start in the middle of the file; when I put it at the beginning of the file and try to echo out the variable that was passed, I received nothing. Anyone know what I am doing wrong? Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /export/home2/webpages/more_metrics.php:6) in /export/home2/webpages/more_metrics.php on line 21 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /export/home2/webpages/more_metrics.php:6) in /export/home2/webpages/more_metrics.php on line 21 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /export/home2/webpages/more_metrics.php:6) in /export/home2/webpages/more_metrics.php on line 21
  12. Hi All, Is there anyway that I can pass a variable to another file besides using a hyperlink or some sort of form? This is the way that I have been doing it below: (string 11 is what was passed) file 1: echo '<form method="post" action=" confirm.php?string11=' . $hlink . ' "><br><br><br /><input type="submit" name="submit" value="Review Closure" /> </form>'; echo '</CENTER>'; file 2: $title=$_GET['string11'];
  13. Thanks so much all of you that replied!!! It works like a charm now  8)
  14. My output doesnt return an error, so thats good. It just doesn't return anything. I tried the strtotime() function as well as the substr() function. Any idea what I am doing wrong? $col_val and $creation time return the time when I echo them out--It just seems like I cannot convert them into another form. $date1=strtotime("d-m-y",$col_val); $date2=strtotime("d-m-y",$creation_ts); echo $date1; $date_result=$date1-$date2; echo $date_result;
  15. I have 2 timestamps of the following format: 2004-10-20 15:33:12 & 2006-07-19 10:06:28 . Is there a way that I can find out the difference in days between these 2 timestamps?
  16. Hi All, Does Anyone know where I can get information or download scripts to make a line graph from the data in one of my mysql tables? I have been looking online and I kept comming across GD and it's libraries. I don't think that my server has GD on it. I found one for a bar graph, and it worked...without using the GD stuff.
  17. Hi All, I tried to copy a table by using this line below but the duplicate table did not create--any suggestions? $query ="CREATE TABLE commentstate2 SELECT * FROM commentstate";
  18. Hi All, I tried to copy a table by using this line below but the duplicate table did not create--any suggestions? $query ="CREATE TABLE commentstate2 SELECT * FROM commentstate";
  19. Hi all, I was looking online to see if there was a way that I could somehow copy one of the tables in my database, but I was unsuccessful. I know how to alter a table and re-name a table. I usually create my tables like so: [color=red]<?php // Create a MySQL table in the selected database mysql_query("CREATE TABLE End_Review( id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id),topic_title VARCHAR(50),date DATETIME)") or die(mysql_error());  echo "Table Created!"; ?> [/color] I just don't know how to copy a table; any suggestions?
  20. Hi All, I am querying 4 specific things at the same time that all relate to one another and I need at least 5 tables in order to gather the correct material. I was successful at doing this; however, most of the the time the query that I am using brings back the same thing multiple times. For example: This is my query: [color=red]$query = "SELECT topicfile.filename,commentstate.fileline, commentdata.commentfield, commentstatehistory.metric_value    FROM commentstate, commentdata, topic, topicfile, commentstatehistory  WHERE commentstate.id=commentdata.commentstateid AND commentstate.topicid = '$topic_id' AND topic.id = '$topic_id' AND commentstate.filenumber=topicfile.sequence AND commentstate.topicid=topicfile.topicid AND commentstatehistory.id=commentstate.id";[/color] And this is my output: (I am only trying to see this once, not four times) [color=red]Filename                                                                                      Line #      Description    Defect Type 6.x-nightly/vobs/checkmc/cmc_api/system/checkmc/include/checkmc.h  61  Review  Complete    Submitted 6.x-nightly/vobs/checkmc/cmc_api/system/checkmc/include/checkmc.h  61  Review  Complete    Submitted 6.x-nightly/vobs/checkmc/cmc_api/system/checkmc/include/checkmc.h  61  Review  Complete    Submitted 6.x-nightly/vobs/checkmc/cmc_api/system/checkmc/include/checkmc.h  61  Review  Complete    Submitted [/color] I just don't know why it does that. Anyone ever run into this problem before? Or know how to fix it? My only guess is the way that I matched the variables after the WHERE in my query.
  21. Hi All, I was wondering if someone could help me out taking the difference of timestamps in mysql or php. According to this website: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html There is a DATEDIFF function that should return expr1-expr2. When I try to use it I get an error that states: Parse error: parse error, unexpected T_STRING. The tidbit of code that I am using for this can be used for this is: $t=SELECT DATEDIFF ($col_value,$creation_ts); echo $t; I tried putting quotes around everything, but that still didn't work--any suggestions? The format of the 2 dates is 2006-07-20 09:30:38.
  22. [quote author=chrisprse link=topic=101096.msg399777#msg399777 date=1153314709] My first thought would be to delete what you have posted and try: [code=php:0] while($row = mysql_fetch_array($res)) { if($row['topic_title'] != $title) { echo $test_date; mysql_query("insert into `End_Review` (`id`,`topic_title`,`date`) values ('','$title','$test_date')"); } } [/code] [/quote] I tried that and my table seemed to grow even more. Any other suggestions? I think that I would have to exit the loop somehow.
×
×
  • 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.