Jump to content

Greywacke

Members
  • Posts

    510
  • Joined

  • Last visited

Everything posted by Greywacke

  1. thats what i did thanks... this function has been updated since sunday. with a slight difference in accessing it on the online survey form and the cronjob survey mailer. it generates the forms now, beautifully ^^ function getquestions($surveytype,$consumerid,$leadid=0,$refid=0) { $sql = "SELECT * FROM 22_surveyquestions LEFT JOIN 23_surveyoptions ON ( 22_surveyquestions.bigint_QuestionID = 23_surveyoptions.bigint_QuestionID ) WHERE 22_surveyquestions.bigint_TypeID = ".$surveytype." ORDER BY 22_surveyquestions.smallint_SortOrder, 23_surveyoptions.smallint_SortOrder;"; $result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ ); $html = "<form id=\"form_survey\" name=\"form_survey\" method=\"post\" accept-charset=\"UTF-8\" action=\"survey_handler.php\" onsubmit=\"valform(this);\">". "<input name=\"consumersurveyid\" id=\"consumersurveyid\" type=\"hidden\" value=\"".$GLOBALS["q"]."\" />\n"; $q = array(); $q[0] = ""; $q[1] = ""; $shtml = ""; if ($result) { $i = 0; while ($row = mysql_fetch_array($result)) { $arr0 = array(); $arr1 = array(); $arr2 = array(); $q[1] = $row["text_QuestionContent"]; if ($q[0] != $q[1]) { $i++; $n = 0; if ($q[0] != "") { $html .= " </p>\n"; } $q[0] = $q[1]; $html .= " <p><label for=\"radio_answer_".$i."_1\"><strong>".$i."). ".$q[1]."</strong></label></p>\n". " <p>\n"; $shtml = ""; } $n++; $a = $row["text_OptionContent"]; $sid = 0; if (preg_match_all("/%Supplier_([\d]+)%/",$a,$arr0)) { // get suppliers for premium & test / freemium leads and loop through $sql0 = "SELECT 5_suppliers.bigint_SupplierID, 5_suppliers.text_SupplierName FROM 5_suppliers LEFT JOIN 27_leadssent ON ( 5_suppliers.bigint_SupplierID = 27_leadssent.bigint_SupplierID ) LEFT JOIN 13_prospectleadsent ON ( 5_suppliers.bigint_SupplierID = 13_prospectleadsent.bigint_SupplierID ) WHERE 27_leadssent.bigint_LeadID = ".$leadid." OR 13_prospectleadsent.bigint_ProspectID = ".$refid." GROUP BY 5_suppliers.text_SupplierName;"; $result0 = mysql_query_errors($sql0, $conn , __FILE__ , __LINE__ ); // get record by number in $arr if (preg_match_all("/Repeat/",$a,$arr2)) { if (mysql_data_seek($result0,1)) { while ($row0 = mysql_fetch_array($result0)) { $html .= " </p>\n"; $html .= " <p>\n"; $html .= preg_replace("/%SID%/",$row0["bigint_SupplierID"],preg_replace("/%Supplier_[\d]+%/",xmlentities($row0["text_SupplierName"]),$shtml)); } } } else { $shtml .= " <input type=\"radio\" name=\"radio_group_".$i."_%SID%\" id=\"radio_answer_".$i."_".$n."_%SID%\" value=\"".$row["bigint_OptionID"]."_%SID%\" />". "<label for=\"radio_answer_".$i."_".$n."_%SID%\" > ".$a."</label><br />\n"; if (intval($arr0[1][0])-1 < mysql_num_rows($result0)) { if (mysql_data_seek($result0,intval($arr0[1][0])-1)) { if ($row1 = mysql_fetch_array($result0)) { $a = preg_replace("/%Supplier_".intval($arr0[1][0])."%/",$row1["text_SupplierName"],$a); $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."_".$row1["bigint_SupplierID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" > ".$a."</label><br />\n"; } } } } } else { if (preg_match_all("/specify/",$a,$arr1)) { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" onfocus=\"document.form_survey.text_specify_".$row["bigint_OptionID"].".focus();\" />". "<label for=\"radio_answer_".$i."_".$n."\" > ".$a." ". "<input type=\"text\" name=\"text_specify_".$row["bigint_OptionID"]."\" id=\"text_specify_".$row["bigint_OptionID"]."\" value=\"\" width=\"32\" /></label><br />\n"; } else { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" > ".$a."</label><br />\n"; } } } mysql_free_result($result); } $html .= " </p>\n"; $html .= " <p><input type=\"submit\" value=\"Submit!\" /><input type=\"Reset\" value=\"Reset...\" /></p>\n"; $html .= "</form>"; return array($i, $html);} this issue has now been resolved!
  2. an option could be: to add a mysql_update_id function, to replace the use of mysql_insert_id with the ON DUPLICATE KEY UPDATE queries... this function can then first try to get the mysql_insert_id, check that it exists in the database - if not, select the updated row's id by email (the unique field in this consumers table).something like this as replacement: $userid = mysql_update_id($conn, $mail); will post an update of the suggested function. it is imperative to me, and i am sure not just me - to be able to get the id of the updated record if updating instead of inserting - otherwise retrieve the new insert id.
  3. thing is i have repeated this on a private server using mysql version 5.1.41 and it just returns 0 as the id when updated. it would seem mysql has taken the return of the value of the autoincrement field away... any ideas how to work around this? if it is updated, i need to select the id. on the private test server (5.1.41) mysql_insert_id returns 0 if updating. if on the live server (5.0.91) it returns the LAST_INSERT_ID() function - which contains the next insert id to be inserted if nothing was inserted. this really breaks my mood somewhat... :/ any ideas for solutions?ps: it does not return the id that it updated, or 0 as the documentation states. it returns the LAST_INSERT_ID() value from mysql instead, and this sometimes contains id's that do not exist in the table yet (when updating instead of inserting).
  4. ok, the function has been updated as follows: function getquestions($surveytype,$leadid=0,$refid=0) { $sql = "SELECT * FROM 22_surveyquestions LEFT JOIN 23_surveyoptions ON ( 22_surveyquestions.bigint_QuestionID = 23_surveyoptions.bigint_QuestionID ) WHERE 22_surveyquestions.bigint_TypeID = ".$surveytype." ORDER BY 22_surveyquestions.smallint_SortOrder, 23_surveyoptions.smallint_SortOrder;"; $result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ ); $shtml = ""; $html = "<form id=\"form_survey\" name=\"form_survey\" method=\"post\" accept-charset=\"UTF-8\" onsubmit=\"valform(this);\">\n". " <input name=\"leadid\" id=\"leadid\" type=\"hidden\" value=\"".$leadid."\" />\n". " <input name=\"leadid\" id=\"refid\" type=\"hidden\" value=\"".$refid."\" />\n". " <input name=\"surveyid\" id=\"surveyid\" type=\"hidden\" value=\"".$surveytype."\" />\n"; $q = array(); $q[0] = ""; $q[1] = ""; if ($result) { $i = 0; while ($row = mysql_fetch_array($result)) { $arr0 = array(); $arr1 = array(); $arr2 = array(); $q[1] = $row["text_QuestionContent"]; if ($q[0] != $q[1]) { $i++; $n = 0; $q[0] = $q[1]; $html .= " <label for=\"radio_answer_1\"><strong>".$i."). ".$q[1]."</strong></label><br />\n"; } $n++; $a = $row["text_OptionContent"]; if (preg_match_all("/%Supplier_([\d]+)%/",$a,$arr0)) { // get suppliers for premium & test / freemium leads and loop through $sql0 = "SELECT 5_suppliers.text_SupplierName FROM 5_suppliers LEFT JOIN 27_leadssent ON ( 5_suppliers.bigint_SupplierID = 27_leadssent.bigint_SupplierID ) LEFT JOIN 13_prospectleadsent ON ( 5_suppliers.bigint_SupplierID = 13_prospectleadsent.bigint_SupplierID ) WHERE 27_leadssent.bigint_LeadID = ".$leadid." OR 13_prospectleadsent.bigint_ProspectID = ".$refid." GROUP BY 5_suppliers.text_SupplierName;"; $result0 = mysql_query_errors($sql0, $conn , __FILE__ , __LINE__ ); // get record by number in $arr if (preg_match_all("/specify/",$a,$arr1)) { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n". " <input type=\"text\" name=\"text_specify\" id=\"text_specify\" value=\"\" width=\"32\" /><br />\n"; } elseif (preg_match_all("/Repeat/",$a,$arr2)) { if (mysql_data_seek($result0,1)) { while ($row0 = mysql_fetch_array($result0)) { $html .= preg_replace("/%Supplier_[\d]+%/",xmlentities($row0["text_SupplierName"]),$shtml); } } } else { $shtml .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; print_r($arr0); if (mysql_data_seek($result0,intval($arr0[1][0])-1)) { if ($row1 = mysql_fetch_array($result0)) { $a = preg_replace("/%Supplier_".intval($arr0[1][0])."%/",$row1["text_SupplierName"],$a); $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; } } } } else { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; } } mysql_free_result($result); } $html .= "<input type=\"submit\" value=\"Submit!\" /><input type=\"Reset\" value=\"Reset...\" />\n"; $html .= "</form>"; return array($i, $html);} ok it is now replacing with the supplier names as expected to, and repeating if "repeat" is encountered in the value. my fault was executing $sql instead of $sql0 after the query was typed out.i have also printed the values of $arr0, and when this function is run with the current database values that were specified in the previous post (the outer query), it print_r's as follows: Array( [0] => Array ( [0] => %Supplier_1% ) [1] => Array ( [0] => 1 ))Array( [0] => Array ( [0] => %Supplier_1% ) [1] => Array ( [0] => 1 ))Array( [0] => Array ( [0] => %Supplier_1% ) [1] => Array ( [0] => 1 ))Array( [0] => Array ( [0] => %Supplier_1% ) [1] => Array ( [0] => 1 ))Array( [0] => Array ( [0] => %Supplier_1% ) [1] => Array ( [0] => 1 ))Array( [0] => Array ( [0] => %Supplier_1% ) [1] => Array ( [0] => 1 ))Array( [0] => Array ( [0] => %Supplier_2% ) [1] => Array ( [0] => 2 ))Array( [0] => Array ( [0] => %Supplier_3% ) [1] => Array ( [0] => 3 ))Array( [0] => Array ( [0] => %Supplier_4% ) [1] => Array ( [0] => 4 ))<br /><b>Warning</b>: mysql_data_seek() [<a href='function.mysql-data-seek'>function.mysql-data-seek</a>]: Offset 3 is invalid for MySQL result index 14 (or the query data is unbuffered) in <b>/home/dwtphovu/public_html/intellisource.co.za/survey.php</b> on line <b>82</b><br />Array( [0] => Array ( [0] => %Supplier_5% ) [1] => Array ( [0] => 5 ))<br /><b>Warning</b>: mysql_data_seek() [<a href='function.mysql-data-seek'>function.mysql-data-seek</a>]: Offset 4 is invalid for MySQL result index 15 (or the query data is unbuffered) in <b>/home/dwtphovu/public_html/intellisource.co.za/survey.php</b> on line <b>82</b><br /> and the inner recordset for the supplier names, returns the following: text_SupplierName=================Canopy and Weca Centre (Centurion)Faaz Fit Canopy (Roodepoort)Midvaal Canopies (Meyerton) yet it does not seem to be finding the text for "specify" and include the text field if found.also how would i hide the warnings that are printed if the following code runs and returns false (ie it is asking to return a supplier name beyond the length of the resultset.) if (mysql_data_seek($result0,intval($arr0[1][0])-1)) {
  5. looking at the results of $arr, and the concatenation of $a - the function has been updated to follows: function getquestions($surveytype,$leadid=0,$refid=0) { $sql = "SELECT * FROM 22_surveyquestions LEFT JOIN 23_surveyoptions ON ( 22_surveyquestions.bigint_QuestionID = 23_surveyoptions.bigint_QuestionID ) WHERE 22_surveyquestions.bigint_TypeID = ".$surveytype." ORDER BY 22_surveyquestions.smallint_SortOrder, 23_surveyoptions.smallint_SortOrder;"; $result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ ); $shtml = ""; $html = "<form id=\"form_survey\" name=\"form_survey\" method=\"post\" accept-charset=\"UTF-8\" onsubmit=\"valform(this);\">\n". " <input name=\"leadid\" id=\"leadid\" type=\"hidden\" value=\"".$leadid."\" />\n". " <input name=\"leadid\" id=\"refid\" type=\"hidden\" value=\"".$refid."\" />\n". " <input name=\"surveyid\" id=\"surveyid\" type=\"hidden\" value=\"".$surveytype."\" />\n"; $q = array(); $q[0] = ""; $q[1] = ""; if ($result) { $i = 0; while ($row = mysql_fetch_array($result)) { $arr0 = array(); $arr1 = array(); $arr2 = array(); $q[1] = $row["text_QuestionContent"]; if ($q[0] != $q[1]) { $i++; $n = 0; $q[0] = $q[1]; $html .= " <label for=\"radio_answer_1\"><strong>".$i."). ".$q[1]."</strong></label><br />\n"; } $n++; $a = $row["text_OptionContent"]; if (preg_match_all("/%Supplier_([\d]+)%/",$a,$arr0)) { // get suppliers for premium & test / freemium leads and loop through $sql0 = "SELECT 5_suppliers.text_SupplierName FROM 5_suppliers LEFT JOIN 27_leadssent ON ( 5_suppliers.bigint_SupplierID = 27_leadssent.bigint_SupplierID ) LEFT JOIN 13_prospectleadsent ON ( 5_suppliers.bigint_SupplierID = 13_prospectleadsent.bigint_SupplierID ) WHERE 27_leadssent.bigint_LeadID = ".$leadid." OR 13_prospectleadsent.bigint_ProspectID = ".$refid." GROUP BY 5_suppliers.text_SupplierName;"; $result0 = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , true ); // get record by number in $arr if (preg_match_all("/specify/",$a,$arr1)) { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n". " <input type=\"text\" name=\"text_specify\" id=\"text_specify\" value=\"\" width=\"32\" /><br />\n"; } else if (preg_match_all("/Repeat/",$a,$arr2)) { while ($row0 = mysql_fetch_array($result0)) { $html .= preg_replace("/%Supplier_[\d]+%/",xmlentities($row0["text_SupplierName"]),$shtml); } } else { $shtml .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; //print_r($arr0); $res = mysql_result($result0,intval($arr0[1][0])-1); $a = preg_replace("/%Supplier_".intval($arr0[1][0])."%/","/".xmlentities($res)."/",$a); $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; } } else { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; } } mysql_free_result($result); } $html .= "<input type=\"submit\" value=\"Submit!\" /><input type=\"Reset\" value=\"Reset...\" />\n"; $html .= "</form>"; return array($i, $html);} $a is set to include $row["text_OptionContent"], and be used when writing the form to $html to return from the function.$shtml is to keep certain fields in memory, and use them again when repeating for all suppliers.the questions returned by the query here, are as follows, and need to be displayed and repeated verbatim: bigint_QuestionID smallint_SortOrder bigint_TypeID text_QuestionContent7 10 4 What is the status of your purchase at this time?7 10 4 What is the status of your purchase at this time?7 10 4 What is the status of your purchase at this time?7 10 4 What is the status of your purchase at this time?31 20 4 Did the suppliers in the CanopyXchange network contact you with a quotation?31 20 4 Did the suppliers in the CanopyXchange network contact you with a quotation?31 20 4 Did the suppliers in the CanopyXchange network contact you with a quotation?31 20 4 Did the suppliers in the CanopyXchange network contact you with a quotation?31 20 4 Did the suppliers in the CanopyXchange network contact you with a quotation?31 20 4 Did the suppliers in the CanopyXchange network contact you with a quotation?32 30 4 Which supplier or manufacturer did you choose for your purchase?32 30 4 Which supplier or manufacturer did you choose for your purchase?32 30 4 Which supplier or manufacturer did you choose for your purchase?32 30 4 Which supplier or manufacturer did you choose for your purchase?32 30 4 Which supplier or manufacturer did you choose for your purchase?32 30 4 Which supplier or manufacturer did you choose for your purchase?33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)33 40 4 How much did you pay for your canopy? (Don't worry! This information will only be used anonymously)34 50 4 Which factor was the most important to you in choosing to purchase from the particular supplier?34 50 4 Which factor was the most important to you in choosing to purchase from the particular supplier?34 50 4 Which factor was the most important to you in choosing to purchase from the particular supplier?bigint_OptionID smallint_SortOrder bigint_QuestionID text_OptionContent1 10 7 I'm still considering my purchase2 20 7 I have purchased from a supplier in CanopyXchange supplier network3 30 7 I purchased from another supplier outside the CanopyXchange supplier network6 40 7 I have decided not to make a purchase at this time32 0 31 %Supplier_1% No, this supplier didn't contact me31 0 31 %Supplier_1% Yes, within a week30 0 31 %Supplier_1% Yes, within the next day29 0 31 %Supplier_1% Yes, sameday still28 0 31 %Supplier_1% Yes, within 10 minutes!57 0 31 %Supplier_2% Repeat options for this supplier33 0 32 %Supplier_1%34 0 32 %Supplier_2%35 0 32 %Supplier_3%36 0 32 %Supplier_4%37 0 32 %Supplier_5%38 0 32 Another supplier not listed here. Please specify ...39 0 33 Less than R3,00040 0 33 Between R3,000 to R4,00041 0 33 Between R4,000 to R5,00042 0 33 Between R5,000 to R6,00043 0 33 Between R6,000 to R7,00044 0 33 Between R7,000 to R8,00045 0 33 Between R9,000 to R10,00046 0 33 Between R8,000 to R9,00047 0 33 Between R10,000 to R11,00048 0 33 Between R11,000 to R12,00049 0 33 More than R12,00050 0 34 Design and features best suited my needs51 0 34 Best value for money (good trade-off between design, quality and price)53 0 34 Customer service (professionalism, friendly, truely helpful, timely communications) unfortunately i do not see the forest for the trees: why it does not repeat the $shtml questions per supplier name in the query when Repeat is encountered or why does it replaces the Supplier_N flags with digits 0osomebody please help! :)i have yet to test the updated function, having trouble with ftp at the moment to the server.
  6. the page selects by consumer survey id, this contains the survey type, lead id and reference id's passed to the function when it is called.the function has been updated as follows, but does not replace the flags on detection. function getquestions($surveytype,$leadid=0,$refid=0) { $sql = "SELECT * FROM 22_surveyquestions LEFT JOIN 23_surveyoptions ON ( 22_surveyquestions.bigint_QuestionID = 23_surveyoptions.bigint_QuestionID ) WHERE 22_surveyquestions.bigint_TypeID = ".$surveytype." ORDER BY 22_surveyquestions.smallint_SortOrder, 23_surveyoptions.smallint_SortOrder;"; $result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ ); $html = "<form id=\"form_survey\" name=\"form_survey\" method=\"post\" accept-charset=\"UTF-8\" onsubmit=\"valform(this);\">\n". " <input name=\"leadid\" id=\"leadid\" type=\"hidden\" value=\"".$leadid."\" />\n". " <input name=\"leadid\" id=\"refid\" type=\"hidden\" value=\"".$refid."\" />\n". " <input name=\"surveyid\" id=\"surveyid\" type=\"hidden\" value=\"".$surveytype."\" />\n"; $q = array(); $q[0] = ""; $q[1] = ""; if ($result) { $i = 0; $shtml = ""; $arr = array(); while ($row = mysql_fetch_array($result)) { $q[1] = $row["text_QuestionContent"]; if ($q[0] != $q[1]) { $i++; $n = 0; $q[0] = $q[1]; $html .= " <label for=\"radio_answer_1\"><strong>".$i."). ".$q[1]."</strong></label><br />\n"; } $n++; $a = $row["text_OptionContent"]; if (preg_match_all("/%Supplier_([\d]+)%/",$a,$arr)) { // get suppliers for premium & test / freemium leads and loop through $sql0 = "SELECT 5_suppliers.text_SupplierName FROM 5_suppliers LEFT JOIN 27_leadssent ON ( 5_suppliers.bigint_SupplierID = 27_leadssent.bigint_SupplierID ) LEFT JOIN 13_prospectleadsent ON ( 5_suppliers.bigint_SupplierID = 13_prospectleadsent.bigint_SupplierID ) WHERE 27_leadssent.bigint_LeadID = ".$leadid." OR 13_prospectleadsent.bigint_ProspectID = ".$refid.";"; $result0 = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , true ); // get record by number in $arr if (preg_match_all("/specify/",$a,$arr)) { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n". " <input type=\"text\" name=\"text_specify\" id=\"text_specify\" value=\"\" width=\"32\" /><br />\n"; } else if (preg_match_all("/Repeat/",$a,$arr)) { while ($row0 = mysql_fetch_array($result0)) { $html .= preg_replace("/%Supplier_[\d]+%/",xmlentities($row0["text_SupplierName"]),$shtml); } } else { $shtml .=" <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; $res = mysql_result($result0,intval($arr[0][0]-1)); $a = preg_replace("/%Supplier_".$arr[0][0]."%/",xmlentities($res),$a); $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; } } else { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label><br />\n"; } } mysql_free_result($result); } $html .= "<input type=\"submit\" value=\"Submit!\" /><input type=\"Reset\" value=\"Reset...\" />\n"; $html .= "</form>"; return array($i, $html);} the url where used is still http://www.intellisource.co.za/survey.php?q=1, but it does not replace the flags and repeat options for the rest of the suppliers.
  7. hi there,having some trouble wrapping my head around the finer details of this. can't seem to get it to work, the hospital was rescheduled for a 6th time :)the function i created sofar, is as follows: function getquestions($surveytype,$leadid=0,$refid=0) { $sql = "SELECT * FROM 22_surveyquestions LEFT JOIN 23_surveyoptions ON ( 22_surveyquestions.bigint_QuestionID = 23_surveyoptions.bigint_QuestionID ) WHERE 22_surveyquestions.bigint_TypeID = ".$surveytype." ORDER BY 22_surveyquestions.smallint_SortOrder, 23_surveyoptions.smallint_SortOrder;"; $result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , true ); $html = "<form id=\"form_survey\" name=\"form_survey\" method=\"post\" accept-charset=\"UTF-8\" onsubmit=\"valform(this);\">". "<input name=\"leadid\" id=\"leadid\" type=\"hidden\" value=\"".$leadid."\" />". "<input name=\"surveyid\" id=\"surveyid\" type=\"hidden\" value=\"".$surveytype."\" />\n"; $q = array(); $q[0] = ""; $q[1] = ""; if ($result) { $i = 1; $shtml = ""; $arr = array(); while ($row = mysql_fetch_array($result)) { $q[1] = $row["text_QuestionContent"]; if ($q[0] != $q[1]) { $i++; $n = 1; $q[0] = $q[1]; $html .= " <label for=\"radio_answer_1\"><strong>".$i."). ".$q[1]."</strong></label>\n"; } $n++; $a = " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label>\n"; if (preg_match_all("/%Supplier_([\d]+)%/",$a,$arr)) { // get suppliers for premium & test / freemium leads and loop through $sql0 = "SELECT 5_suppliers.text_SupplierName FROM 5_suppliers LEFT JOIN 27_leadssent ON ( 5_suppliers.bigint_SupplierID = 27_leadssent.bigint_SupplierID ) LEFT JOIN 13_prospectleadsent ON ( 5_suppliers.bigint_SupplierID = 13_prospectleadsent.bigint_SupplierID ) WHERE 27_leadssent.bigint_LeadID = ".$leadid." OR 13_prospectleadsent.bigint_ProspectID = ".$refid.";"; $result0 = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , true ); // get record by number in $arr if (preg_match_all("/specify/",$a,$arr)) { $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label>\n". "<input type=\"text\" name=\"text_specify\" id=\"text_specify\" value=\"\" width=\"32\" />\n"; } else if (preg_match_all("/Repeat/",$a,$arr)) { while ($row0 = mysql_fetch_array($result0)) { $html .= preg_replace("/%Supplier_1%/",xmlentities($row0["text_SupplierName"]),$shtml); } } else { $shtml .=" <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label>\n"; $res = mysql_result($result0,intval($arr[0][0]-1)); $a = preg_replace("/%Supplier_".$arr[0][0]."%/",xmlentities($res),$a); $html .= " <input type=\"radio\" name=\"radio_group_".$i."\" id=\"radio_answer_".$i."_".$n."\" value=\"".$row["bigint_OptionID"]."\" />". "<label for=\"radio_answer_".$i."_".$n."\" >".$a."</label>\n"; } } else { $html .= $a; } } mysql_free_result($result); } $html .= "<input type=\"submit\" value=\"Submit!\" /><input type=\"Reset\" value=\"Reset...\" />\n"; $html .= "</form>"; return array($i, $html);} the basic database table designs that it uses here, are leads as instance records, and send records per supplier. therefor getting the list of suppliers bound to a lead from this table.if the option contains "%Supplier_1%" etc in it, it will save that series of options and repeat it on "Repeat" found. Also if "specify" is found, it will include a text field. however, this function returns no questions or options - just the opening and closing form elements... somebody please help me focus here - as i seem to be struggling to. the table consisting of the options, links to a question.this function is called on the public Test Page, which is supposed to return the related questionnaire for the consumer survey in question. the function above is all that does not work at the moment. it is sent the valid survey type id, lead id and reference id - but does not seem to get any results. if the variable &Supplier_1% etc was found, it is supposed to return the number found in $arr[0][0]. this is slightly above my head and i seem to be battling tremendously!
  8. all of a sudden this stopped working - in that the mysql_insert_d($conn) function is now returning the LAST_INSERT_ID value generated and not the ON DUPLICATE KEY UPDATE id.here is the sql query run, now its returning an id that does not exist in the table. // create consumer $csql = "INSERT INTO 19_consumers ( `text_ConsumerE-Mail`, text_ConsumerName, text_ConsumerPhone, text_ConsumerCity, bigint_ConsumerRegion, tinyint_ConsumerStatus ) VALUES ( \"".$consumeremail."\", \"".$consumerfullname."\", \"".$consumercell."\", \"".$city_town."\", ".$region.", 0 ) ON DUPLICATE KEY UPDATE `text_ConsumerE-Mail` = \"".$consumeremail."\", text_ConsumerName = \"".$consumerfullname."\", text_ConsumerPhone = \"".$consumercell."\", text_ConsumerCity = \"".$city_town."\", bigint_ConsumerRegion = ".$region.", tinyint_ConsumerStatus = 0;"; $tresult = mysql_query_errors($csql, $conn , __FILE__ , __LINE__ ); $userid = mysql_insert_id($conn); how would i be able to repair this? it should return the id of the updated record if a record was not inserted.
  9. i have selected the individual records required, and this issue has fallen away.
  10. hi again. i've tested the first query, and it returns with two rows containing all the values used creating the first insert query within the resultset.printing the queries run, it gets to the query and resultset for the outer sql query $sql0 then does not seem to go into the while loop. $now = getdate(strtotime(convert_tz(date("Y-m-d H:i:s", time()),"SAST")));$t = date("Y-m-d 23:59:59",mktime(23,59,59,$now["mon"],$now["mday"] - 1,$now["year"]));// loop through triggers created for previous day$sql0 = "SELECT * FROM 26_surveyqueue LEFT JOIN 25_serviceleads ON ( 26_surveyqueue.bigint_LeadID = 25_serviceleads.bigint_LeadID ) LEFT JOIN 10_serviceprospects ON ( 26_surveyqueue.bigint_ReferenceID = 10_serviceprospects.bigint_ProspectID ) LEFT JOIN 19_consumers ON ( 25_serviceleads.bigint_ConsumerID = 19_consumers.bigint_ConsumerID ) LEFT JOIN 20_surveytypes ON ( 26_surveyqueue.bigint_SurveyID = 20_surveytypes.bigint_SurveyID ) WHERE 26_surveyqueue.tinyint_TriggerInitiated = 0 AND 26_surveyqueue.timestamp_SurveyTrigger <= \"".$t."\";";$result0 = mysql_query_errors($sql0, $conn , __FILE__ , __LINE__ , true );while ($row = mysql_fetch_array($result0)) { // update prospectleads table to include consumer id $sql1 = "INSERT INTO 21_consumersurveys ( bigint_ConsumerID, bigint_LeadID, bigint_ReferenceID, bigint_SurveyType ) VALUES ( ".$row["bigint_ConsumerID"].", ".$row["bigint_LeadID"].", ".$row["bigint_ReferenceID"].", ".$row["bigint_SurveyID"]." );"; $result1 = mysql_query_errors($sql1, $conn , __FILE__ , __LINE__ , true ); $csid = mysql_insert_id($conn); $sql3 = "UPDATE 26_surveyqueue SET timestamp_SurveyTrigger = 1;"; $result3 = mysql_query_errors($sql3, $conn , __FILE__ , __LINE__ , true ); // initiate variables $consumerfullname = $row["text_ConsumerName"]; $consumeremail = $row["text_ConsumerE-Mail"]; $attribs = $row["text_LeadAttributes"]; $attribsarr = formattribs($attribs); $surveytype = $row["text_SurveyDescription"]; $surveyurl = "http://www.intellisource.co.za/survey.php?q=".$csid."&t=".$row["bigint_LeadID"]; $surveyquestions = getquestions($row["bigint_SurveyID"],$row["bigint_LeadID"],$row["bigint_ReferenceID"]); $qcnt = $surveyq[0]; $surveyquestions = $surveyq[1]; $body = getFile("/home/dwtphovu/public_html/intellisource.co.za/test_8347379386/templat/survey.html"); // load mail template $mail = new PHPMailer(); // create a new object $body = populateflags($body); // populate flags with variables require("/home/dwtphovu/public_html/intellisource.co.za/test_8347379386/includes/mailer/dwtphovu_auth.php"); // include mailer auth $mail->From = (stristr($row0["text_LeadAttributes"],"canopy_req")===false)?"canopy@canopyxchange.za.net":"canopy@quoteme.za.net"; // set from email $mail->FromName = (stristr($row0["text_LeadAttributes"],"canopy_req")===false)?"CanopyXchange":"QuoteMe Canopies"; // set from name $mail->Subject = utf8_decode(getSubText($body,"<title>","</title>")); // set subject to template page title $mail->ClearAttachments(); // clears attachments $mail->MsgHTML($body); // set HTML Body $mail->AltBody = strip_tags(html_entity_decode(getSubText($body, "<body>","</body>"))); // set Text Body $mail->AddAddress($consumeremail,$consumerfullname); // add recipient $mail->AddBCC("info@canopyxchange.za.net","CanopyXchange Info"); // bcc jaap the response $mail->IsHTML(true); // set send as HTML if(!$mail->Send()) { // if attempt sending failed array_push($errmsg,"FAILURE: ".$consumerfullname.", ".$consumeremail." (".trim(strip_tags($mail->ErrorInfo)).")"); // save error report $failure++; // increment failures count } else { // else success $sql2 = "UPDATE 21_consumersurveys SET timestamp_SurveyDateE-Mail = CURRENT_TIMESTAMP;"; // save timestamp sent $result2 = mysql_query_errors($sql2, $conn , __FILE__ , __LINE__ , true); array_push($errmsg,"SUCCESS: ".$consumerfullname.", ".$consumeremail); // save success report $success++; // increment success count } // insert into consumer surveys} this prints out the following: Array( [0] => SELECT * FROM 26_surveyqueue LEFT JOIN 25_serviceleads ON ( 26_surveyqueue.bigint_LeadID = 25_serviceleads.bigint_LeadID ) LEFT JOIN 10_serviceprospects ON ( 26_surveyqueue.bigint_ReferenceID = 10_serviceprospects.bigint_ProspectID ) LEFT JOIN 19_consumers ON ( 25_serviceleads.bigint_ConsumerID = 19_consumers.bigint_ConsumerID ) LEFT JOIN 20_surveytypes ON ( 26_surveyqueue.bigint_SurveyID = 20_surveytypes.bigint_SurveyID ) WHERE 26_surveyqueue.tinyint_TriggerInitiated = 0 AND 26_surveyqueue.timestamp_SurveyTrigger <= "2010-12-06 23:59:59"; [1] => NOTICE #0499: The query returned the following result in /home/dwtphovu/public_html/intellisource.co.za/test_8347379386/private/cronjob_surveystatus.php on line 126.Array( [0] => 1 [bigint_SurveyID] => 1 [1] => 2 [bigint_LeadID] => 2 [2] => 4689 [bigint_ReferenceID] => 4689 [3] => 0 [tinyint_TriggerInitiated] => 0 [4] => 2010-12-06 23:59:59 [timestamp_SurveyTrigger] => 2010-12-06 23:59:59 [5] => 2 [6] => 3149 [bigint_ConsumerID] => 3149 [7] => 1 [bigint_ServiceID] => 1 [8] => canopy_req = pre-owned_white<br />canopy_style = highline_standard<br />budget = R5,000 to R7,500<br />fitment = not_within_3_months<br />vehicle_status = possession_no_shopping<br />vehicle_make_model = Ford - SCAB<br />year_model = 2010 [text_LeadAttributes] => canopy_req = pre-owned_white<br />canopy_style = highline_standard<br />budget = R5,000 to R7,500<br />fitment = not_within_3_months<br />vehicle_status = possession_no_shopping<br />vehicle_make_model = Ford - SCAB<br />year_model = 2010 [9] => [text_Duplicates] => [10] => Testing survey manager work [text_LeadMessage] => Testing survey manager work [11] => 2011-04-06 23:59:59 [timestamp_ExpectedBy] => 2011-04-06 23:59:59 [12] => 2010-12-07 17:50:02 [timestamp_LeadCreated] => 2010-12-07 17:50:02 [13] => 4689 [bigint_ProspectID] => 4689 [14] => Andr?abuschagne;pierre@canopyxchange.za.net;0729154799;Kempton Park [text_Consumer] => Andr?abuschagne;pierre@canopyxchange.za.net;0729154799;Kempton Park [15] => 3149 [16] => [text_LeadSubject] => [17] => canopy_req = pre-owned_white<br />canopy_style = highline_standard<br />budget = R5,000 to R7,500<br />fitment = not_within_3_months<br />vehicle_status = possession_no_shopping<br />vehicle_make_model = Ford - SCAB<br />year_model = 2010 [18] => 2011-04-06 23:59:59 [19] => Testing survey manager work [20] => 1 [21] => 37 [bigint_RegionID] => 37 [22] => 0000-00-00 00:00:00 [timestamp_ProspectCreated] => 0000-00-00 00:00:00 [23] => 3149 [24] => pierre@canopyxchange.za.net [text_ConsumerE-Mail] => pierre@canopyxchange.za.net [25] => Andr?abuschagne [text_ConsumerName] => Andr?abuschagne [26] => 0729154799 [text_ConsumerPhone] => 0729154799 [27] => Kempton Park [text_ConsumerCity] => Kempton Park [28] => 37 [bigint_ConsumerRegion] => 37 [29] => 0 [tinyint_ConsumerStatus] => 0 [30] => 2010-11-22 19:37:20 [timestamp_Populated] => 2010-11-22 19:37:20 [31] => 1 [32] => 1 [33] => Test Survey [text_SurveyDescription] => Test Survey [34] => 5 [tinyint_SurveyDaysOffset] => 5 [35] => 0 [tinyint_OffsetFrom] => 0)) this is supposed to print queries, errors or resultsets if any when the last parameter in the mysql_query_errors function is set to true. but for some reason it does not. testing the outer query that is printed here, i get the following result set: [b]bigint_SurveyID bigint_LeadID bigint_ReferenceID[/b]1 2 46894 2 4689[b]tinyint_TriggerInitiated timestamp_SurveyTrigger[/b]0 2010-12-06 15:59:590 2010-12-06 16:59:59[b]bigint_LeadID bigint_ConsumerID bigint_ServiceID[/b]2 3149 12 3149 1[b]text_LeadAttributes text_Duplicates text_LeadMessage[/b]canopy_req = pre-owned_white Testing survey managercanopy_style = highline_standard workbudget = R5,000 to R7,500fitment = not_within_3_monthsvehicle_status = possession_no_shoppingvehicle_make_model = Ford - SCAByear_model = 2010canopy_req = pre-owned_whitecanopy_style = highline_standardbudget = R5,000 to R7,500fitment = not_within_3_monthsvehicle_status = possession_no_shoppingvehicle_make_model = Ford - SCAByear_model = 2010canopy_req = pre-owned_white Testing survey managercanopy_style = highline_standard workbudget = R5,000 to R7,500fitment = not_within_3_monthsvehicle_status = possession_no_shoppingvehicle_make_model = Ford - SCAByear_model = 2010canopy_req = pre-owned_whitecanopy_style = highline_standardbudget = R5,000 to R7,500fitment = not_within_3_monthsvehicle_status = possession_no_shoppingvehicle_make_model = Ford - SCAByear_model = 2010 [b]timestamp_ExpectedBy timestamp_LeadCreated bigint_ProspectID[/b]2011-04-06 16:59:59 2010-12-07 09:50:02 46892011-04-06 16:59:59 2010-12-07 09:50:02 4689[b]text_Consumer[/b]André Labuschagne;pierre@canopyxchange.za.net;0729154799;Kempton ParkAndré Labuschagne;pierre@canopyxchange.za.net;0729154799;Kempton Park[b]bigint_ConsumerID text_LeadSubject text_LeadAttributes[/b]3149 canopy_req = pre-owned_white canopy_style = highline_standard budget = R5,000 to R7,500 fitment = not_within_3_months vehicle_status = possession_no_shopping vehicle_make_model = Ford - SCAB year_model = 20103149 canopy_req = pre-owned_white canopy_style = highline_standard budget = R5,000 to R7,500 fitment = not_within_3_months vehicle_status = possession_no_shopping vehicle_make_model = Ford - SCAB year_model = 2010timestamp_ExpectedBy text_LeadMessage-----------------------------------------------------2011-04-06 16:59:59 Testing survey manager work2011-04-06 16:59:59 Testing survey manager workbigint_ServiceID bigint_RegionID timestamp_ProspectCreated1 37 2010-12-07 09:50:031 37 2010-12-07 09:50:03bigint_ConsumerID text_ConsumerE-Mail text_ConsumerName----------------------------------------------------------------------------------3149 pierre@canopyxchange.za.net André Labuschagne3149 pierre@canopyxchange.za.net André Labuschagnetext_ConsumerPhone text_ConsumerCity bigint_ConsumerRegion------------------------------------------------------------------------------0729154799 Kempton Park 370729154799 Kempton Park 37tinyint_ConsumerStatus timestamp_Populated bigint_SurveyID----------------------------------------------------------------------------0 2010-11-22 11:37:20 10 2010-11-22 11:37:20 4bigint_ServiceID text_SurveyDescription tinyint_SurveyDaysOffset--------------------------------------------------------------------------------1 Test Survey 51 Email Survey -17[b]tinyint_OffsetFrom[/b]01 also displayed on the printed results when testing the cronjob. if anyone could help me, please - i cannot see why the inner query is not running :/
  11. ahh it seems it got messed up by trying to convert a south african standard time to south african standard time.i modified the createtriggers and dateadd functions to work as follows: function dateadd($interval,$date = "", $ctz = true) { if ($date == "") { if ($ctz) { $now = getdate(strtotime(convert_tz(date("Y-m-d H:i:s", time()),"SAST"))); } else { $now = getdate(strtotime(date("Y-m-d H:i:s", time()))); } } else { if ($ctz) { $now = getdate(strtotime(convert_tz($date,"SAST"))); } else { $now = getdate(strtotime($date)); } } return date("Y-m-d H:i:s",mktime(23,59,59,$now["mon"],$now["mday"] + $interval,$now["year"]));}function createtriggers($leadid) { // loop through survey types and create triggers $sql0 = "SELECT * FROM 20_surveytypes WHERE bigint_ServiceID = ".$GLOBALS["service"]." AND tinyint_OffsetFrom < 2 ORDER BY bigint_SurveyID ASC;"; $result0 = mysql_query_errors($sql0, $conn , __FILE__ , __LINE__ ); $sql1 = "SELECT * FROM 25_serviceleads WHERE bigint_LeadID = ".$leadid.";"; $result1 = mysql_query_errors($sql1, $conn , __FILE__ , __LINE__ ); if ($result0 && $result1) { if ($row1 = mysql_fetch_array($result1)) { while ($row0 = mysql_fetch_array($result0)) { $osf = $row0["tinyint_OffsetFrom"]; switch (intval($osf)) { case 1: $ofs = $row1["timestamp_ExpectedBy"]; break; default: $ofs = $row1["timestamp_LeadCreated"]; } $tss = dateadd($row0["tinyint_SurveyDaysOffset"],$ofs,false); $sql2 = "INSERT INTO 26_surveyqueue (bigint_SurveyID, bigint_LeadID, timestamp_SurveyTrigger) VALUES (".$row0["bigint_SurveyID"].",".$leadid.",\"".$tss."\");"; $result2 = mysql_query_errors($sql2, $conn , __FILE__ , __LINE__ , true ); } mysql_free_result($result0); } mysql_free_result($result1); }} from this code, it is seen that it is not needed to apply the timezone conversion to the dates. this issue has now been resolved!
  12. hi there,the date add function i use, is as follows: function dateadd($interval,$date = "") { if ($date == "") { $now = getdate(strtotime(convert_tz(date("Y-m-d H:i:s", time()),"SAST"))); } else { $now = getdate(strtotime(convert_tz($date,"SAST"))); } return date("Y-m-d H:i:s",mktime(23,59,59,$now["mon"],$now["mday"] + $interval,$now["year"]));} convert_tz converts the US Central timezone (where the site is hosted) to South African standard time (where the site is used) - no problem, using a timezone class i downloaded from phpclasses.org.the function which calculates the values to add to the survey queue, which is processed by a cronjob - is as follows: function createtriggers($leadid) { // loop through survey types and create triggers $sql0 = "SELECT * FROM 20_surveytypes WHERE bigint_ServiceID = ".$GLOBALS["service"]." AND tinyint_OffsetFrom < 2 ORDER BY bigint_SurveyID ASC;"; $result0 = mysql_query_errors($sql0, $conn , __FILE__ , __LINE__ ); $sql1 = "SELECT * FROM 25_serviceleads WHERE bigint_LeadID = ".$leadid.";"; $result1 = mysql_query_errors($sql1, $conn , __FILE__ , __LINE__ ); if ($result0 && $result1) { if ($row1 = mysql_fetch_array($result1)) { while ($row0 = mysql_fetch_array($result0)) { $osf = $row0["tinyint_OffsetFrom"]; switch ($osf) { case 1: $ofs = $row1["timestamp_ExpectedBy"]; break; default: $ofs = $row1["timestamp_LeadCreated"]; } $tss = dateadd($row0["tinyint_SurveyDaysOffset"],$ofs); $sql2 = "INSERT INTO 26_surveyqueue (bigint_SurveyID, bigint_LeadID, timestamp_SurveyTrigger) VALUES (".$row0["bigint_SurveyID"].",".$leadid.",\"".$tss."\");"; $result2 = mysql_query_errors($sql2, $conn , __FILE__ , __LINE__ , true ); } mysql_free_result($result0); } mysql_free_result($result1); }} however, it seems not to be getting $osf (the offset from (time)stamp field)'s value as the digit 1 for the survey type in the table for these - as it's getting the default case for this value. what could be the matter? $ofs is the offset from timestamp. the tinyint_OffsetFrom field has a value for this survey type, 1 - with tinyint_SurveyDaysOffset being -17 for this record.
  13. ISSUE RESOLVEDooook... hehe the problem was with html attributes frame="border" rules="all" in that table
  14. hi there,i have been asked to remove the borders from tables in Parktown Boys High.now i have managed to remove most of the borders except borders between rows and cells as on this page:SCHOOL SHOP for Parktown Boys High School.here is the css decleration i inserted at the bottom of the global style: table, tbody, tr, td { border: none !important; outline: none !important; } why are there borders inbetween the cells? even with 5 !important declerations behind the lines, they do not overwrite! i can't find the reason for these borders unfortunately, please help!
  15. well this is where one usually has to start thinking bigger, to using databases and a backend language like php or asp. javascript is only for the client side. if you want to go about it this way, you could store the time played in the individual option values, ticking it on either every 60 seconds or every second per individual player. the problem with using something like javascript for this whole thing though, is that you wouldnt be able to store it unless in a cookie. and then the values are only for that specific browser that was visiting the page.
  16. accessing form elements can be done either by accessing by id where you would (to access the object) type document.getElementById("elementId") or by name which is the most cross-browser compatible, such as document.formName.elementName using a reference for the various form element object values will help too. to get a name from a dropdown such as follows: <form name="test_form"> <select name="sel1" id="sel2"> <option value="1">Player One</option> <option value="2">Player Two</option> <option value="3">Player Three</option> <option value="4">Player Four</option> <option value="5">Player Five</option> </select></form></form> would require you to access it as follows for best browser compatibility: document.test_form.sel1.options[document.test_form.sel1.selectedIndex].text; unless of course the script is in an event for the object, where you can use the this.options[this.selectedIndex].text; notation. hope this helps
  17. ahhhh... the issue was resolved. due to inserting into the handlers of the site, so that leads would create consumers when entering the database if they do not exist, otherwise update them - the $name variable was not used anymore. the if statement still did with that variable and not $consumerfullname.
  18. hi there,the previous leads table contained all the consumer info. it is still working and populating, but i managed to get this page written, slightly modified now to get unique emails in this table - and updating the existing record when a duplicate key is encountered: <?php// include database connectioninclude("includes/content/dwtphovu_f3rr37y.php");$sql = "SELECT 6_serviceleads.bigint_LeadID, 6_serviceleads.text_Consumer, 6_serviceleads.bigint_RegionID, 6_serviceleads.timestamp_LeadCreated, 1_regions.text_RegionDescription FROM 6_serviceleads LEFT JOIN 1_regions ON ( 6_serviceleads.bigint_RegionID = 1_regions.bigint_RegionID) GROUP BY 6_serviceleads.text_Consumer ORDER BY 6_serviceleads.timestamp_LeadCreated ASC;";echo $sql."<br />\n";$result = mysql_query_errors($sql, $conn , __FILE__ , __LINE__ , false);if ($result) { while ($row = mysql_fetch_array($result)) { // set_time_limit(25); $id = $row["bigint_LeadID"]; $consumer = explode(";",$row["text_Consumer"]); $consumeremail = $consumer[1]; $consumerfullname = $consumer[0]; $consumercell = $consumer[2]; $city_town = $consumer[3]; $region = $row["bigint_RegionID"]; $regionname = $row["text_RegionDescription"]; $ts = $row["timestamp_LeadCreated"]; $status = 0; if ($name != "" && !is_numeric($name)) { $tsql = "INSERT INTO 19_consumers ( `text_ConsumerE-Mail`, text_ConsumerName, text_ConsumerPhone, text_ConsumerCity, bigint_ConsumerRegion, tinyint_ConsumerStatus, timestamp_Populated ) VALUES ( \"".strtolower($consumeremail)."\", \"".ucwords(strtolower($consumerfullname))."\", \"".$consumercell."\", \"".ucwords(strtolower($city_town))."\", ".$region.", 0, \"".$ts."\" ) ON DUPLICATE KEY UPDATE `text_ConsumerE-Mail` = \"".strtolower($consumeremail)."\", text_ConsumerName = \"".ucwords(strtolower($consumerfullname))."\", text_ConsumerPhone = \"".$consumercell."\", text_ConsumerCity = \"".ucwords(strtolower($city_town))."\", bigint_ConsumerRegion = ".$region.", tinyint_ConsumerStatus = 0;"; echo $tsql."<br />\n"; $tresult = mysql_query_errors($tsql, $conn , __FILE__ , __LINE__ , false); echo $id."): ".$ts."<br />\n".$consumerfullname." - ". $consumeremail." (".$consumercell.")<br />\n". $city_town." - ".$regionname." (".$region. ")<br /><br />\n\n"; } } mysql_free_result($result);} else { echo "Parent query failed: #".mysql_errno($conn)."<br />\n".mysql_error($conn); }?> the table has the following coloumn specs: it used to populate previously, but doesn't anymore - since i tried adding uniqueness by email address... perhaps i should have posted this on the sql forum, but as most of the code was php - it seemed more relevant here.why when i load the page, does it not update this table anymore? i've tried commenting the set_time_limit(25); line incase the isp doesnt allow it anymore. i've also added the error trapping for the outer select, but to no avail. no errors display, despite all errors being marked to display on apache. the inner queries don't even echo
  19. this issue has been resolved: click the status, scroll down to region to select - press ctrl then click it and release to load filtered consumers
  20. although, i have thought of using two select boxes for the filters instead. one for the customer status, and another for the customer region. i can either include a button below the filters, or load the filtered consumers on select. i have spoken to my client regarding this, he will let me know as soon as he gets back.
  21. hi there.i need to disable it for a different reason than page layout or font sizes...as i have a multiple list box to select filters when selecting from a database via ajax, i need to cancel the zoom while the user is scrolling down to select more filters, as releasing the ctrl key - loads the consumers with the currently selected filters. how would i get past this? ctrl + click is required to select multiple options in the listbox. yet ctrl + mousewheel zooms in and out of the page 0othis page is to be used in firefox alone. any ideas how i could work around this? the filters are loaded dynamically as regions are updated constantly.i am thinking perhaps cancel the onmousedown event of ctrl, but would this not cancel the onmouseup event too?
  22. as in change the function to read as follows: function a_div_b(form) { a=parseInt(form.a.value,10); b=parseInt(form.b.value,10); c=a/b; d=(Math.floor(a/b)); e=b*d; f=a-e; if (f[color="#FF0000"][b]==[/b][/color]0) { form.ans.value = b; } else { form.ans.value = f; }} what he meant by the equality operator is the condition for the if statement. i've made this bold and red to enhance clarity.single = sets the value of f, and == only checks the value. === checks the value and type.it is usually best practice to tab out your functions for easier readability when scripting in any language. also you might find it best to end each line that is not part of an if/while/for/switch/etc statement, with a semicolon (.also you might want to use parseInt instead of eval, as these values are used in mathematical operations before the if statement.
  23. ohhhhh... i was following the flow of code wrongly. i missed an if statement, and only if that statement was true was it updating. else it also updates - but i didnt include the timestamp_ExpectedBy field yet in that update. i kept testing on the else... 0othis issue is now resolved ^^ going to write a php page to get the attributes and update the existing records which have the default value of 0000-00-00 23:59:59.
  24. then what could the problem that i am facing be? the sql query adds leads to the database, just with blank expected by dates... :)even renaming the $expected variable to $exby (definately not used elsewhere! didn't do a thing. yet if i print it before i do the sql query, i get it... 0o
  25. ok pasted the following line between every line and the next, in a test: echo $expected; and got 10 dates. as the flow of code goes, i should have received 11 - this means that between the following two lines it is dropping the variabl. $servicecost = costbycategory($service,$attribsarr,$recipient[9]); $append = duplicatedays($consumeremail,$service,$recipient[6]); i might need to speak to vodahost about increasing memory availability for the scripts on this site - i certainly hope that will be the end of this issue.
×
×
  • Create New...