Jump to content

coool

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

coool's Achievements

Member

Member (2/5)

0

Reputation

  1. what do you think of this code? - it's not working what's wrong with it ! <script type="text/javascript"> function Show(e) { if(document.getElementById(e).style.display == 'none') { document.getElementById(e).style.display = 'block'; } } </script> <tr id='criteria1'> <?echo CriteriaRow();?> //this function have some form elements/html similar to the picture in one of my posts </tr> <input type="button" value="Display Criteria" onClick="Show('criteria1');"> #criteria1 { display: none; } when i click on the button.. nothing appear !
  2. okay let me forget for now doing the dependent lists first this is what i'm planning to have http://img76.imageshack.us/my.php?image=criteriafz2.jpg I'm wondering how can i by a click have a new criteria line then all criteria lines should be saved to thier variables ! so i can use them later inside a sql query statement after the word "WHERE" do i have to use java script ! .. or do i have to use php functions ! or multiple forms submitions !! ..
  3. but mine isn't only text ! .. I have select statements.. page.php <?php $items = "item1,item3"; ?> <a href="form.php?selectedItems=<?=$items?>" >View Form<a/> form.php <form name="selectionform" method="post" action=""> <select size="3" multiple name="selectedItems[]"> <option value="item1">Item1</option> <option value="item2">Item2</option> <option value="item3">Item3</option> </select> <input type="submit" value="View Result"> </form> What I'm looking for is when user click "View Form" link, they get the for filled with items - i.e some items are alreay selected ---- then if the user want to deselect one of the items or select more items he should able to do that.. ! to check the result: - in form.php if($_POST) echo implode($_POST['selectedItems'],","); so what do you think ? having $_GET inside form.php will solve the problem ! .. but I've tried it and it doesn't work.. I didn't know how to handle the array and nothing selected !! .. can you take my sample code and add to it the proper things so it will work ! please
  4. Hi guys, How can I send query result to EXCEL in PHP pages? is there such a function in PHP ? any code example !
  5. Hi anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ? maybe using (the process of passing variables to other pages - through url) but how can i assign them to form variables ?
  6. don't worry I've figured out the solution I just needed to used UNION ALL instead of UNION Thanks
  7. I've got the code from the internet but forgot where ! why do you need it online ! please just give some clues of how to fix the problem or a small example !
  8. I've got one solution but still have one more problem I'm getting the most biggest count from multible tables this is what i'm using: $fields = "Status,Count(names)"; $table1 = "myTable1"; $table2 = "myTable2"; $groupBy = "Status"; $sql = "SELECT * FROM((SELECT * FROM (SELECT $fields FROM $table1 GROUP BY $groupBy)AS $table1) UNION (SELECT * FROM(SELECT $fields FROM $table2 GROUP BY $groupBy)AS $table2))AS MainTable GROUP BY $groupBy"; so if my first table gives: status1 = 40 items status2 = 60 items and if my second table gives: status1 = 250 status2 = 20 the result from the above code is: status1 = 250 status2 = 60 which is not what i'm looking for (it's just outputing the biggest numbers) i want is this answer: status1 = 290 status2 = 80 what do you think ? : (
  9. There's something I don't understand here ! in order in use $_POST, you need to submit the form, right ? look at this: <? $firstQry = mysql_query("SHOW FIELDS FROM table1") or die(mysql_error()); // table 1 ?> <form name="check" method="post"> <select name="first" onchange="this.form.submit()"> <? while($res = mysql_fetch_row($firstQry)) {?> <option value="<? echo $res[0]?>"><? echo $res[0]?></option> <? } unset($firstQry,$res);?> </select> <? if(isset($_POST["first"])) { $sql2 = "Select ".$_POST['first']." FROM table1 GROUP BY ".$_POST['first']; $secondQry = mysql_query($sql2) or die(mysql_error()); ?> <select size="3" multiple name="second[]"> <? while($row = mysql_fetch_row($secondQry)){?> <option value="<? echo $row[0]?>"><? echo $row[0]?></option> <? } } unset($secondQry,$row);?> </select> </form> <? echo "<br/>"; echo "first: ".$_POST['first']; echo "<br/>"; echo "second: ".implode($_POST['second'],","); the problem is when i choose item2 in the first list values of item2 appear in the second list then when i select few values from second list and select a new field in first list ( let's say item5 ) form is submitted ! I get as an output list1 = item 5 list2 = values of item2 what i need is the match to appear.. item 2 with its values how can i use cookie ! or store session in my code above !
  10. how would I store in Cookie ! never done it before !
  11. I have this: SELECT $items FROM $table WHERE $conditions in my form I'm asking the user to select items from a list - multible selections and I'm asking the user to select from which table he/she would like to extract the data now my problem with the conditions selection ! I'm going to divide this problem to smaller ones and solve each one then relate it to the other I've already created a list that have all the fields available (user can only select one item) and I've already created a list with the values (multible selection is available) example: item1 is being chose___user can choose the relation(In/Not In..etc)___list of unique values of item1 should i use java to remember the first selection then i can use this selection in my second list sql so i can get the values that are related to this selection ? do you know any java script that will save selection then read it later and use it as a variable in my second sql ?
  12. Hi How can I merge the result of few quries that had been unioned ? example: SELECT item1,item2,item3 FROM table111 WHERE item2='something' GROUP BY item1 UNION SELECT item1,item2,item3 FROM table222 WHERE item2='something' GROUP BY item1 UNION SELECT item1,item2,item3 FROM table333 WHERE item2='something' GROUP BY item1 NOTE: table111, table222, and table333 has the same structure always i'm asking for same items to be selected here and for same group by and where statment the difference is with the table names each table has different records than the other table Is there any available code to do this ! any solution ! do you any idea of how doing this, do you have any simple example ?
  13. Thanks very much for your help things are working perfectly
  14. Hi.. I'm having problem in this code ! I beileve it's almost done, but just need a little fix ! here's the code: image.php <?php //already been connected to database $sql = "SELECT Status FROM Table1 GROUP BY Status"; $x = mysql_query($sql) or die("Error - Could not $sql" . mysql_error()); $sql = "SELECT COUNT(Items) FROM Table1 GROUP BY Status"; $y = mysql_query($sql) or die("Error - Could not $sql" . mysql_error()); //x= sold,shipped,InStock,UnKnown //y= 8,6,3,5 $width = 300; $height = 200; header ("Content-type: image/png"); $image = ImageCreate($width,$height) or die ("Cannot Create image"); $white = ImageColorAllocate($image,255,255,255); $black = ImageColorAllocate($image,0,0,0); $red = ImageColorAllocate($image,255,0,0); $green = ImageColorAllocate($image,0,255,0); $blue = ImageColorAllocate($image,0,0,255); $maxY = 0; for ($i=0;$i<7;$i++){ if ($y[$i] > $maxY)$maxY=$y[$i]; } ImageRectangle($image,1,1,319,239,$black); imageLine($image,10,5,10,230,$blue); imageLine($image,10,230,300,230,$blue); ImageString($im,3,15,5,"CR ID",$black); ImageString($im,3,280,240,"Status",$black); ImageString($im,5,100,50,"Simple Graph",$red); ImageString($im,5,125,75,"by Lina",$green); $xPos = 15; $yPos = 230; $barWidth = 20; $barHeight = 0; for ($i=0;$i<3;$i++){ $barHeight = ($y[$i]/$maxY)* 100; imagerectangle($image,$xPos,$yPos,$xPos+$barWidth,($yPos-$barHeight),$red); imagestring( $image,2,$xPos-1,$yPos+1,$x[$i],$black); imagestring( $image,2,$xPos-1,$yPos+10,$y[$i],$black); $xPos += ($barWidth+20); } ImagePng($image, "graph.png", 90); ?> page.php .... <img src="image.php"/> .... Error: after excuting page.php The image “http://websiteName.com/image.php” cannot be displayed, because it contains errors.
×
×
  • 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.