Jump to content

hmark

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

hmark's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm currently using decimal(10,4) and allowing NULL. In addition i'm using round($row[3]). When I do this, I end up getting 0s when I query results. What can I do to avoid this? I've tried different things and tried looking thru archived help and haven't found anything that works. Thanks in advance.
  2. Thank you. This was very helpful.
  3. I'm trying to capture data with decimal places (ex: 614.283). Should I use int? Or should i use float or something else? I'm very new to mysql. I would appreciate any help. thanks.
  4. hmark

    mysqldump

    Do i need to install mysqldump? I tried "locate mysqldump" and I get "locate: /usr/add-on/local/var/locatedb: No such file or directory". Does this mean I need to get it? And how do i do that? Thank you. I'm new to mysql.
  5. My default is NULL. Is that okay?
  6. I've set my column to varchar(15) unique and null to okay. Yet, when I try and enter a record with a null in this column, I get the following message "Duplicate entry '' for key 2"". What do you suggest?
  7. I want to have a field that is unique, but allow zeros or nulls. Is this possible?
  8. Yes, this is still an issue. Do you know how i can correct this properly? Thank you.
  9. I'm having some trouble...here's my dilenma. I'm allowing my user to query the database based on a "pack code". It then displays the pack code and other information about this "pack code". I'm able to let users edit the other information with no trouble. But now, I'm wanting to change my code to allow them to also chance the "pack code" field if it's incorrect. Here my php codes (two parts php_edit2.php and php_edit3.php): [code=php:0]? require 'lib-hollydb.inc'; connect_to_db("$dbname"); $pcode = $_GET['pcode']; $q = "select * from hollydb.experts where pcode='$pcode'"; connect_to_db("$dbname"); $res = run_query($q); $rec = mysql_fetch_array($res); if(!$rec){ errorMsg(" No record found. Please try again."); } ?> <? cePageHead(); ceLeftMenu(); ?> <td> <b>PRO input:</b> <a href="pred_input.php">add</a> | edit | <a href="pred_delete.php">delete</a> <br> <BR> Edit a record<br><br> <form action="pred_edit3.php"> <input type="hidden" name="pcode" value=<?echo "$pcode"?>> <table> <tr> <td>Code:</td> <td><input type="text" name="pcode" value="<?echo $rec['pcode']?>"><td> </tr> <tr> <td>Comcode:</td> <td><input type="text" name="comcode" value="<?echo $rec['comcode']?>"><td> </tr> <tr> <td>Description:</td> <td><input type="text" name="descript" value="<?echo $rec['descript']?>"><td> </tr> <tr> <td> </td> <td><br><input type="submit" value="save"><td> </tr> </table> </form> </body> </html> [/code] [code=php:0]<? require 'lib-hollydb.inc'; $pcode=$_GET['pcode']; $ay = array_keys($_GET); $x = implode(",",$ay); $y = implode("','", $_GET); $a = array(); foreach ($_GET as $key => $value) { if($value != ''){ $q = "$key='$value'"; array_push($a,$q); } } $q = implode(", ",$a); $q = "update experts set $q where pcode='$pcode'"; connect_to_db("$dbname"); run_query($q); ?> <? cePageHead(); ceLeftMenu(); ?> <b> Thank you. <br> Pack/Product Code: <?echo $pcode?> has been updated. </b> </td> </tr> <br> </td> </tr> </table> </div> </body> </html> [/code] Is there an easy way to modify this? Or should i just allow users to delete record and re-enter the data. This is not preferred, but i can do that if it's easier. Thank you
  10. hmark

    date field

    Hello. I simply wanted to add a column for date. I would like to have user enter MMM-YY. For example APR-09. How do i format the field? mysql> alter table experts add column best_est_date date(mmm-yy); This doesn't work. Thank you.
  11. I defined it as: function getFldArray($f){ $q = "describe experts $f"; $res = run_query($q); $row = mysql_fetch_array($res); $rt = $row['Type']; $rt = preg_replace('/enum\(\'/', '', $rt); $rt = preg_replace('/\'\)/', '', $rt); $arr = explode('\',\'',$rt); sort($arr); return $arr; }
  12. I'm trying to insert a dropdown menu on my webpage. THis is what I have right now: [code=php:0] <tr> <td>System:</td> <td><select name="system"> <option value=""> </option> <? $arr_system = getFldArray("system"); foreach ($arr_system as $f){ print "<option value=\"$f\">$f</option>"; } ?> <td> </tr> [/code] When i execute this, I get varchar(20) as a option. Anyone have any suggestions? I know very very very little php and mysql. I appreciate any help. I hope I posted enough info (and that I posted it correctly thanks.
  13. Hello. I'm wanting to modifymy php code from accepting only one input from a user, to giving them a choice of two. For instance, a user can look a information based on a "comcode" or a "pack name". I'm very new to PHP so, i would appreciate any help i can get. Right now it only works for "comcode". I want to give users options to query by "pack name" too. Here's what I have: ? require 'lib-hollydb.inc'; connect_to_db("$dbname"); $comcode = $_GET['comcode']; $q = "select * from hollydb.experts where comcode=$comcode"; connect_to_db("$dbname"); $res = run_query($q); $rec = mysql_fetch_array($res); if(!$rec){ errorMsg(" No record found. Please try again."); } ?> <? cePageHead(); ceLeftMenu(); ?> </td> <td valign="top"> <img src="images/red_vertical_bar.gif" width=1 height=120 border=0 alt=""> </td> <td valign="top"> </td> <td> <b>PRO input:</b> <a href="pred_input.php">add</a> | edit | <a href="pred_delete.php">delete</a> <br> <BR> Edit a record<br><br> <form action="pred_edit3.php"> <input type="hidden" name="comcode" value=<?echo "$comcode"?>> <table> <tr> <td>Code:</td> <td><input type="text" name="code" value="<?echo $rec['code']?>"><td> </tr> <tr> <td>Description:</td> <td><input type="text" name="descript" value="<?echo $rec['descript']?>"><td> </tr> <tr> <td>Indoor Predicted FIT Rate:</td> <td><input type="text" name="ind_pred_fit" value="<?echo $rec['ind_pred_fit']?>"><td> </tr> <tr> <td>Outdoor Predicted FIT Rate:</td> <td><input type="text" name="outd_pred_fit" value="<?echo $rec['outd_pred_fit']?>"><td> </tr> <tr> <td>Prediction Reference:</td> <td><input type="text" name="pred_ref" value="<?echo $rec['pred_ref']?>"><td> </tr> <tr> <td>Target FIT Rate:</td> <td><input type="text" name="target_fit" value="<?echo $rec['tareget_fit']?>"><td> </tr> <tr> <td>Target Reference:</td> <td><input type="text" name="target_ref" value="<?echo $rec['tareget_ref']?>"><td> </tr> <td> </tr> <tr> <td> </td> <td><br><input type="submit" value="save"><td> </tr> </table> </form> </form> </td> </tr> </td> </tr> </table> </div> </body> </html> Then I have the following: <? require 'lib-hollydb.inc'; $comcode=$_GET['comcode']; $ay = array_keys($_GET); $x = implode(",",$ay); $y = implode("','", $_GET); $a = array(); foreach ($_GET as $key => $value) { if($value != ''){ $q = "$key='$value'"; array_push($a,$q); } } $q = implode(", ",$a); $q = "update experts set $q where comcode=$comcode"; connect_to_db("$dbname"); run_query($q); ?> <? cePageHead(); ceLeftMenu(); ?> <b> Thank you. <br> Comcode: <?echo $comcode?> has been updated. </b> </td> </tr> <br> </td> </tr> </table> </div> <div align="center"> </body> </html> I hope i've posted enough info to explain myself. Once again, any help would be appreciated.
  14. Thank you for the reference. I think I got it!! Thanks again!
×
×
  • 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.