Jump to content

nestorvaldez

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nestorvaldez's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Im working with a MySql Database with PHP, but, right now I need to make some calculations in the client area, I mean the system must give the results before to send to the database, I've got it using Javascript. This is just the explanation what Im doing... My problem is that I have some decimal(3.2) fields in MySql with NULL. I want Java script in the calculation take the null value not like a 0. This is because I'm making some avg calculations, and I have two Fields to make the avg calculation, if the fields are >=0 it will promediate considering this field if some of the fields is not 0 (NULL.  it take the value from DB) it will not considerate it to promediate. EX1. REG_PRA1 =80     REG_PRA2 =90     In this case it must calc (80+90) /2 = 85 EX2. REG_PRA1 =80     REG_PRA2 =0     In this case it must calc (80+0) /2 = 40 EX3. REG_PRA1 =80     REG_PRA2 =NULL     In this case it must calc (80+90) /1 = 80 Im using this code: the code is working well, the problem is takin the value (0 or null) from the DB) it take both (0 and null) like 0.0 I need to solve it to make the correct average. var reg_pra1 = document.Actualizar.reg_pra1.value; var reg_pra2 = document.Actualizar.reg_pra2.value; var count=0; var sum=0; if(reg_pra1>=0){ count=count+1; sum = reg_pra1 * 1; } if(reg_pra2>=0){ count=count+1; sum = (sum * 1) + (reg_pra2 * 1); } if(sum>0){ var prompra = sum/count; prompra.toFixed(1) document.Actualizar.reg_promp.value = prompra.toFixed(1); }
  2. I need to locate a button next to the email field to validate if this email exists, how can I make it, How can I know if the email typed is real? If somebody can help to get this, pliz..
  3. I cant get it..  This is all the code of the two files: and this is the link of the file to see what I have: http://www.internationaljobagency.com/fnuevo.php
  4. Yes I know About the SET in the STATUS, what I need to set is what I check in the checkbox in the list.If mark it I need to move 1 if I dont I what to move 0. That is the only thing I need to do.. update in the table what i check. But I dont know if the code is correct? Help me with this.....
  5. Hi... I need to update an status Field in my table.. I have a List (select query) and one of the field in thelist is a checkbox form (this checkbox is a field in the table) I just need to adjust the status. If I marked the checkbox it save 1 and if it is unmarked it it will save 0. I use a bottom at the end of the form to make this update. I found some code, but it doesn't  work.. I will show it, I hope I could get some help here. This is some code in the List: $updatelink="<p align=\"right\"><a href=\"actstatus.php?personal=$id&did=$did\"> <p align=\"right\"><img border=\"0\" src=\"../../images/actstatus.jpg\"alt=\"Update Docs Status\">"; echo ("$updatelink"); [actstatus.php] <?php include("../../functions/db.php"); $personal = $_GET['personal']; $did = $_REQUEST['did']; foreach ($did as $key => $value){ $p = "$value"; echo $p; $query = mysql_query("UPDATE regdocu SET RDOC_STATUS=  WHERE RDOC_PERSONAL='$personal' AND RDOC_DOCU='$did'");     } if(!$query){ echo '<p><b><font face="Arial" color="#CE0808" style="font-size: 9pt">Error<span lang="es-do">:</span> </font></b> <font face="Arial" style="font-size: 9pt" color="#CE0808">No se pudo actualizar status del Documento Contacte el administrador.</font></p>'; } else { echo ("<meta http-equiv=\"refresh\" content=\"5; url=./fnuevo.php?id=$personal\">"); } ?>
  6. $id = $_GET['id']; $query = mysql_query("SELECT per_mensaje FROM `personal` WHERE PER_ID='$id'"); $row = mysql_fetch_array($query); $mensaje = $row['per_mensaje']; <td><textarea name="mensaje" cols="40" rows="10" class="tabla" id="textarea3" tabindex="16"  value="<?php echo("$mensaje");?>"></textarea></td> PS: The PER_MENSAJE field is a TEXT type.
  7. Hi I have a Text Type Field in Mysql.. I can save the data but If want to show it in a select or retrieve to update I can't get it. I can't see the data I've saved in the table. How can I do this?
  8. Hi guys Im getting a problem trying to copy  a list of records from one table to another, I was investiganting and I got it: INSERT INTO TABLE2 (COL1, COL2, COL3) SELECT COL1, COL4, COL7 FROM TABLE1 I think I can do in this way, but the problem is the tables are not identical and I need to insert some varibles in the destination table, and a current date, and so on, so in this way I think I cant do it... From the table I need to take the data I just need some fields, but the others are variables that are in my script.. How can I solve it.... If anybody can give a solution to this issue..
  9. Im getting problem doing it.. The problem is, it is in the new record form Im try to register a new one.. So I dont have it the code in the DB, yet.. My problem is that I cant make refresh the page in order show the city in my combo, depending on the country I selected.. I mean the first field is the country and the next one is the City, then I want that when I select the One country and go out from this field to the next it make the refresh or what ever and show me in the next field (the Cities combo) just the cities from the country I selected... This is my code to select the country from the DB <select size="1" name="country"  tabindex="13">   <?php           $query = mysql_query("SELECT PAI_ID, PAI_NOMBRE FROM pais");     while ($row = mysql_fetch_array($query)) {     $pid=$row['PAI_ID'];     $pnombre=$row['PAI_NOMBRE'];     ?>     <option value="<?=$pid?>" <?//=$selected?>><?=$pnombre?></option>     <?     }     ?> </select> and this is to select the City:   <select size="1" name="city" tabindex="12">   <?php           $query = mysql_query("SELECT CIU_ID, CIU_NOMBRE FROM ciudad" WHERE CIU_PAIS=$pid);     while ($row = mysql_fetch_array($query)) {     $cid=$row['CIU_ID'];     $cnombre=$row['CIU_NOMBRE'];     ?>     <option value="<?=$cid?>" <?//=$selected?>><?=$cnombre?></option>     <?     }     ?> </select> How to refresh dinamically when the focus leave the Country field
  10. I need some Help. I want to filter my data in two combo box field, retreiving the data form my mysql DB. Ex. I have three DB : country, city, customer; city is relationed with country; and customer with both so I want that when I select on country in the Customer Form the script could show/filter only the cities that belong to this country.. COUNTRY          - id -countryname CITY          - id - cityname - country CUSTUMER - id - name - country - city                  
  11. I need some help, I have a long report query more than 300records and increasing, so it get slow, so I need to insert in my website the posibility to divide it in pages of 10 records or what ever amount, but divide it. I have seen it  in other website something like this en to bottom of the page: First Next Previous Last is something like that if somebody can help with this....
×
×
  • 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.