Jump to content

zszucs

Newly Registered
  • Posts

    27
  • Joined

  • Last visited

Everything posted by zszucs

  1. not among my non-technical users
  2. are there any good front ends to mysql tables similar to ms access grid views for tables? it can be web based or desktop. MS access as a front end to the mysql linked tables is too slow when using ctrl-f so I have to find an alternative (other than than that it's ok). It needs to be fast, allow the user to edit the record, allow fast use of ctrl-f,user friendly to non-technical users and preferred if I can set it up pretty quickly (there's lots of tables). Suggestions appreciated
  3. my bad document.form1.cur_code.value = req.responseText; actually works in a way. there was a large amount of space and then code and then the actual response that i wanted. with the large amount of space, i just assumed there was no output here's what was outputted in the text box <!-- //javascript functions, then php functions --><script>function preparehtml(whichdiv){//alert("preparing");//alert("preparing" + whichdiv);document.all("htmlfromdiv").value=document.all(whichdiv).innerHTML;document.all("prepared").value=whichdiv;}function preparetextarea(whichdiv){//alert("preparing");alert("preparing" + whichdiv);document.all("htmlfromdiv").value=document.all(whichdiv).value;document.all("prepared").value=whichdiv;}</script><SCRIPT LANGUAGE='JAVASCRIPT' TYPE='TEXT/JAVASCRIPT'> <!--/**************************************************** AUTHOR: WWW.CGISCRIPT.NET, LLC URL: http://www.cgiscript.net Use the code for FREE but leave this message intact. Download your FREE CGI/Perl Scripts today! ( http://www.cgiscript.net/scripts.htm )****************************************************/var win=null;//MO 2004/02/16 Modified function to take additional variables for scrollbarsfunction NewWindow(mypage,myname,w,h,pos,infocus,sbars){if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=" + sbars + ",location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,titlebar=no";win=window.open(mypage,myname,settings);win.focus();}//MOfunction NewWindowdebug(mypage,myname,w,h,pos,infocus){if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=yes,resizable=yes,titlebar=yes";win=window.open(mypage,myname,settings);win.focus();}//MO 2004/02/16 Modified function to take additional variables for window sizefunction CMS_PopUp(msgid, typeid){if (typeid==null) { NewWindow('/site/cms_popup.php?msgid='+msgid,'cms_popupwindow','390','220','null','front','no');}else if (typeid==1) { NewWindow('/site/cms_popup.php?msgid='+msgid,'cms_popupwindow','400','400','null','front','no');}else if (typeid==2) { NewWindow('/site/cms_popup.php?msgid='+msgid,'cms_popupwindow','500','500','null','front','yes');}}//MO// --></script>11749 111 the only thing i want is right at the end after </script> - 11749 111. is there a way I can just get that?
  4. thanks but that doesn't work
  5. so i'm using prototype to do an autopopulate. select from a drop list and then a textbox is supposed to get filled. it works fine if it's going into a div but it doesn't work for a text box for some reason. the code is a little flaky but it does work for a div file 1 <html> <head> <title>Changing textbox value based on dropdown list using Ajax and PHP</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script src="ajax.js"></script> <script src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("ajax.php", { method: 'post', postBody: 'id='+ $F('id'), onComplete: showResponse }); } function showResponse(req){ $('fadeBlock').innerHTML= req.responseText; //document.form1.cur_code.value = 'asdfad'; document.form1.cur_code.value = eval(req.responseText); //document.getElementById('cur_code').value=req.responseText; //$F('cur_code').value = 'asdf'; } </script> </head> <body style="font: 12px Verdana, Arial, Helvetica, sans-serif;"> <div id="fadeBlock"></div> <?php $sql = "SELECT * FROM product WHERE productid =11749"; $result = mysql_query($sql); ?> <form style="text-align:center" method="post" action="" name="form1" id="form1"> <p style="color:#000099 ">When you change the dropdown list, the respective currency code of the country will be displayed in the textbox which is fetched from PHP using Ajax. </p> <p>Country : <select name="id" onChange="sendRequest()" id="id"> <option value="">Select Country</option> <?php while($row = mysql_fetch_array($result)) { echo "<option value=\"$row[productid]\">$row[prodname]</option>\n"; } ?> </select><br/><br/> Currency : <input type="text" name="cur_code" id="cur_code" ></p> </form> </body> </html> ajax file getting called <?php include_once('functions.php'); $sql = "SELECT * FROM product WHERE id =11749"; $result = mysql_query($sql); $row = mysql_fetch_array($result); echo $row[productid]; ?> insights are appreciated
  6. this is the relevant code from the form: <?php session_start(); include('functions.php') if($_POST) { //print_r($_POST); $msg = ''; $fund_weight_total = 0.00; $policy_weight_total = 0.00; $at_least_one_fund = 0; $at_least_one_policy = 0; for($i = 1; $i < 7; $i++) { $fund = 'fund' . $i; $fundwgt = 'fund' . $i . 'wgt'; $policy_weight = 'policy' . $i . 'wgt'; $policy = 'policy' . $i; $benchmark_policy = 'benchmark_policy' . $i; if(!empty($_POST["$fund"])) { $at_least_one_fund = 1; if($_POST["$fundwgt"] == 0) { $msg .= 'You must enter a value for fund weight ' . $i . '<br>'; } else { $fund_weight_total += $_POST["$fundwgt"]; } // if(empty($_POST["$policy"])) // { // $msg .= 'You must select a policy for fund weight ' . $i .'<br>'; // } } //validate for at least one policy if(!empty($_POST["$policy"])) { $at_least_one_policy = 1; if($_POST["$policy_weight"] == 0) { $msg .= 'You must enter a value for policy weight ' . $i . '<br>'; } else { $policy_weight_total += $_POST["$policy_weight"]; } if(empty($_POST["$benchmark_policy"])) { $msg .= 'You must select a benchmark for fund weight ' . $i .'<br>'; } } else { if(!empty($_POST["$benchmark_policy"])) { $msg .= 'You must select a policy for benchmark ' . $i .'<br>'; } } } if(!$at_least_one_fund) { $msg .= 'You must select at least one fund.<br>'; } if(!$at_least_one_policy) { $msg .= 'You must select at least one policy.<br>'; } if($fund_weight_total != 100) { $msg .= 'Fund weight must total 100%<br>'; } if($policy_weight_total != 100) { $msg .= 'Policy weight must total 100%<br>'; } if(empty($msg)) { $funds = array(); $benchmarks = array(); foreach($_POST as $k => $v) { //echo "$k => $v<br>"; if(ereg("^fund[0-9]$", $k)) { $sql = "SELECT reguniverse, assetclass FROM product WHERE productid = $v"; $result = mysql_query($sql); $row = mysql_fetch_array($result); if($v) { $funds[] = array('id' => $v, 'reguniverse' => $row['reguniverse'], 'assetclass' => $row['assetclass'], 'name' => $k); } } if(ereg("^benchmark_policy[0-9]$", $k)) { $sql = "SELECT reguniverse, assetclass FROM product WHERE productid = $v"; $result = mysql_query($sql); $row = mysql_fetch_array($result); if($v) { $benchmarks[] = array('id' => $v, 'reguniverse' => $row['reguniverse'], 'assetclass' => $row['assetclass'], 'name' => $k); } } } //print_r($funds); //die; $products = array_merge($funds, $benchmarks); usort($products, 'compare_reguniverse_assetclass'); //print_r($products); $first = 0; $compare = array(); $count = 0; //$_SESSION = array();//undo session vars here if(count($_SESSION) > 0) { $_SESSION = array();//undo session vars here } // $_SESSION['aquart'] = array(); // $_SESSION['val'][] = array(); foreach($products as $a => $b) { $current_pair = array(); foreach($b as $c => $d) { if($c == 'reguniverse') { $current_pair[] = $d; } if($c == 'assetclass') { $current_pair[] = $d; } } $months=12; $enddateoffset=0; $lsuniverse='stdunv'; $riskmetric='ROR'; $charttype='quartile'; if(!$first) { $first++; $arisk = getriskuniverse($current_pair[0], $current_pair[1], $asatdate, $months, $enddateoffset, $lsuniverse, $riskmetric, $charttype); $aquart = getquartuniverse($arisk, $asatdate, $months, $enddateoffset); $compare[0] = $current_pair[0]; $compare[1] = $current_pair[1]; } else { $compare_string = $compare[0] . $compare[1]; $current_string = $current_pair[0] . $current_pair[1]; if($compare_string != $current_string) { //if($compare[0] != $current_pair[0] || $compare[1] != $current_pair[1]) { //echo "$current_pair[0], $current_pair[1] else<br>"; $compare[0] = $current_pair[0]; $compare[1] = $current_pair[1]; $arisk = getriskuniverse($current_pair[0], $current_pair[1], $asatdate, $months, $enddateoffset, $lsuniverse, $riskmetric, $charttype); $aquart = getquartuniverse($arisk, $asatdate, $months, $enddateoffset); } } //get the $aquart array in the right order and add additional values needed for the spreedsheet array_shift($aquart);//get rid of end date for now $temp = array(); $temp['productid'] = ''; $temp['begindate'] = begin_date($asatdate, 12); $temp['enddate'] = $asatdate; $temp['exporttype'] = $riskmetric; $temp['datatype'] = ''; $aquart = array_merge($temp, $aquart); $aquart['rank'] = ''; //now get $val array in the right order and add additional values needed for the spreedsheet $val = riskandrankuniverse($products[$a]['id'], $arisk, $asatdate, $months, $enddateoffset, $riskmetric); $val = array_slice($val, 4); $temp = array(); $temp['productid'] = $products[$a]['id']; $temp['begindate'] = begin_date($asatdate, 12); $temp['enddate'] = $asatdate; $temp['exporttype'] = $riskmetric; if(ereg("^fund[0-9]$", $products[$a]['name'])) { $temp['datatype'] = 'VAL'; } else { $temp['datatype'] = 'BMK'; } $temp['reguniverse'] = $current_pair[0]; $temp['assetclass'] = $current_pair[1]; $temp['value'] = $val['prodrisk']; $temp['rank'] = $val['rank']; $val = array(); $val = $temp; $_SESSION['aquart'][] = $aquart; $_SESSION['val'][] = $val; $_SESSION['count'] = $count;//loop control var $count++; } //include('excel.php'); echo "<a href=\"excel.php\" target=\"_blank\">Click here</a>"; } } ?> from the dowload file excel.php <?php session_start(); ini_set("memory_limit","256M"); require_once "ExcelExport.php"; $xls = new ExcelExport(); //titles //$xls->addRow(Array("ProductID","Last Name","Website","ID")); $per_labels = array('P0','P5','P10','P20','P25','P30','P40','P50','P60','P70','P75','P80','P90','P95','P100'); $count = $_SESSION['count']; for($i = 0; $i <= $count; $i++) { $row1 = array(); $row2 = array(); foreach ($_SESSION['aquart'][$i] as $k => $v) { if($k != 'qerror' && $k != 'minpointlimit' && $k != 'numrows') { if($k == 'datatype') { foreach($per_labels as $v) { $row1[] = $v; } } else { $row1[] = $v; } //echo "$k => $v<br>"; } } foreach ($_SESSION['val'][$i] as $k => $v) { if($k != 'qerror' && $k != 'minpointlimit' && $k != 'numrows') { $row2[] = $v; //echo "$k => $v<br>"; } } $row = array_merge($row1, $row2); $xls->addRow($row); } print_r($_SESSION); //$xls->download("spreadsheet.xls");
  7. i have a file that will produce a link to an xls download once the information is validated. i notice that i need to refresh the browser on the originating page to get the session vars to appear on the download page once the link is clicked which is a seperate file. I have session_start() start at the top both of the pages. i tried using a header refresh after the link but it didn't work. any suggestions?
  8. this is a full html/php page so there's content there. by the sounds of it i can't do it. i tried to redirect to the download and then back to the form but when it comes back to the form, that page never finishes rendering
  9. I'd like to see if there's a better way of doing this. Right now, i have a form that has some selection criteria and posts to it itself to validate. If it's good, a link to a forced download that consists of an xls file that has the processed details is presented. what i would like is to have it post to itself, validate and just force the download if it's good data all there on the same form. The problem seems to be that there can't be code above the header calls that force the download or the data will just be sent to the browser thus ruining the download. Is there any way around this to acheive what I'm looking for which is a little more user friendly?
  10. not sure if this is a php app per se (hope so, that would make it easier for me). i need to get a live feed from a warehouse and display it on the website. something like this http://71.130.119.83/view/index2.shtml?newstyle=One&cam=2 . any suggestions?
  11. the framework that I was using - kohana - was stripping the meta tags out. if I used ajax outside of the framework i could save it. If i included the framework, meta tags disappeared even with ajax
  12. trying to save meta tags in a mysql db. the client just wants to paste the full tags into a text area. unfortunately it the post data after it submits indicates its gone. nothing in view source either. other tags seem to save fine. is it even possible to save meta tags like this? if it's possible, what's the right way of going about it?
  13. total noob at jquery so not suprised that i ran into a problem. what im trying to do is an image swap when clicking on a group of images which works fine. The problem is that i need the image swap only to occur when only one particular item is selected from a drop list. this is what i have so far (probably could be more effiecient but i'm new at this): <script type="text/javascript"> <?php $sql = "SELECT * FROM images WHERE image_category_id=2"; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error()); } if(mysql_num_rows($result) > 0) { ?> $(document).ready(function(){ <?php while($row = mysql_fetch_array($result)) { ?> //if ($("#office_loc")[0].selectedIndex == 1) { $('#action_card<?=$row['id']?>').toggle( //function(){ alert($("#office_loc")[0].selectedIndex) }, function() { $('#action_card<?=$row['id']?>').show('slow'); $('#main_image').attr('src','images/<?=$row['image']?>'); }, function() { $('#main_image').show('slow'); $('#main_image').attr('src','images/<?=$row['image']?>'); }); //} <?php } ?> }); <?php } ?> </script> i tried putting the conditional if ($("#office_loc")[0].selectedIndex == 1) { outside and inside of $('#action_card<?=$row['id']?>').toggle to no avail. I also tried if ( $("#office_loc").val() != 'whatever') ) { which also didn't work. Need some help here ...
  14. if you delete a product, wouldn't that leave the history table with orphans?
  15. I was thinking that maybe I can remove teh product id from the order _detail. Apparently, they don't want to do things like query what's been selling. Are there any pitfalls for taking this approach?
  16. I'm putting together an online ordering sysytem. The problem I'm having is that the client wants to edit products but not change prices in the order history as a result of the edit so the prices there would be accurate for the time. I think this can be overcome by adding the product_price in with the order_detail. The problem is when they want to delete products. If they delete them, the order history would either get deleted with the product getting deleted if it was ordered or leave it as orphaned in the order history. I suggested a show or not show option for the product but they weren't too happy with that. Any suggestions? Scaled down version of how it works now: orders: id user_id order_detail id order_id product_id product_price
  17. I'm trying to keep free emails from being registered. I haven't been able to locate a script that does that yet.
  18. Is there any tool or script out there that can validate against free email addresses like hotmail.com, gmail.com etc ? Right now, the only thing I can think of is to compile our own list of emails and then compare the registrant's email to each item in the list. It's not the best way but haven't seen anything else. Any suggestions?
  19. It's an issue in that an editor could highlight thoses kinds of mistakes for you and make it easier to find. Zend studio will do that and probably others as well. I personally never had a problem with pasting code into an editor and it getting mangled.
  20. Totally agree with the spirit of that. It's not just php you are learning. Using the example of a web 2.0 project, you could potentially need learn html, css, javascript/ajax, db development, server config/administration, graphic design, flash and probably some other things I forgot along with php.
  21. This is where things went wrong. The open and close php tags weren't needed here. Also the echo statements here weren't right and the ones towards the bottom weren't right either. <?php echo <a href="record.php?wid=".$wid-1."\">Previous Entry</a><br />"; echo <a href="record.php?wid=".$wid+1."\">Next Entry</a><br />"; ?> This corrects the syntax errors. <html> <head></head> <body> <!-- standard page header --> <?php // includes include('conf.php'); include('functions.php'); // open database connection $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect'); //select database mysql_select_db($db) or die ('Unable to select database'); // generate and excecute query // check for record ID if ( empty($_GET['wid']) ) { $wid=1; } else { $wid = $_GET['wid']; } $query = "SELECT word, category, tags, def, pub, author, submitted, amended, flagged FROM words WHERE wid = $wid"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); // get resultset as object $row = mysql_fetch_object($result); //Create navigation links for top of page echo '<a href="record.php?wid='.$wid-1 .'">Previous Entry</a><br />'; echo '<a href="record.php?wid=' .$wid+1 .'">Next Entry</a><br />'; // print details if ($row) { ?> <p> <font size="1"><?php echo ($row->word); ?></font> <p> <b><?php echo "Word ID: ".$record." (Primary Key)" ?> </b> <p> <font size="-1"><?php echo "Category: " .$row->category; ?></font> <p> <font size="-1"><?php echo "Tags: " . $row->tags; ?></font> <p> <font size="-1"><?php echo "Definition: " . $row->def; ?></font> <p> <font size="-1"><?php echo "Published?: Feature to follow"; ?></font> <p> <font size="-1"><?php echo "Submitted by: " . $row->author; ?></font> <p> <font size="-2"><?php echo "Date Submitted: " . formatDate ($row->submitted); ?></font> <p> <font size="-1"><?php echo "Date Amended: Feature to Follow"; ?></font> <p> <font size="-1"><?php echo "Flagged: Feature to Follow"; ?></font> <p> <font size="-1"><?php echo "Votes: Feature to Follow"; ?></font> <p> <?php } else { ?> <p> <font size="-1">That record could not be located in the database.</font> <?php } // close database connection mysql_close($connection); ?> <!-- standard page footer --> </body> </html>
  22. coreftp or dreamweaver I find to be good gui ones. ssh with putty (command line) is the best for large transfers. Don't know for sure if putty works on a mac but there is probably a similar client that will achieve the same effect.
  23. or $url = 'http://yoururl.com'; header('Refresh: 3; URL="' . $url . '"');
  24. Zend is bit buggy but is the best one I found so far. I don't mind komodo either. No vi users?
×
×
  • 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.