Jump to content

khan kaka

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    australia

khan kaka's Achievements

Member

Member (2/5)

0

Reputation

  1. can some one explain to me how this code works or convert this code to dream weaver style. i want to be able to bind date and and apply rpeat reagion behaviour . this is the code: <?php //@ $mySQLConnection = mysql_connect("localhost", "ultratune", "u1tr@t00n3"); @ $mySQLConnection = mysql_connect('localhost', 'root', ''); mysql_select_db("ultratune"); $postcode = 3174; /* zipcode */ $suburb = @$_GET["suburb"]; $storename = @$_GET["storename"]; $SearchDistance = 10; /*  km */ $EarthRadius = 6365; $pc = array(); // if we are searching by city then get the suburb if (strlen($storename) != 0) { //echo "by storename"; $qry = "select postcode from stores where storename = '$storename' limit 1"; $recordSetStore = mysql_query($qry); if (mysql_num_rows($recordSetStore) > 0) { $result = mysql_fetch_array($recordSetStore); $pc[$result["state"]] = $result["postcode"]; } } else if (strlen($postcode) != 0 && strlen($suburb) != 0) { //echo "by city"; $qry = "select Min(postcode) as postcode, state from postcodes where city = '$suburb' group by state"; $recordSetPC = mysql_query($qry); if (mysql_num_rows($recordSetPC) > 0) { if (mysql_num_rows($recordSetPC) > 1) { for ($i = 0; $i < $toCount; $i++) { $currentRow = mysql_fetch_array($recordSetPC); $pc[$currentRow["state"]] = $currentRow["postcode"]; } } else { $result = mysql_fetch_array($recordSetPC); $pc[$result["state"]] = $result["postcode"]; } } } else if (strlen($postcode) == 0 && strlen($suburb) != 0) { //echo "by city 2"; $qry = "select Min(postcode) as postcode, state from postcodes where city = '$suburb' group by state"; $recordSetPC = mysql_query($qry); if (mysql_num_rows($recordSetPC) > 0) { if (mysql_num_rows($recordSetPC) > 1) { for ($i = 0; $i < mysql_num_rows($recordSetPC); $i++) { $currentRow = mysql_fetch_array($recordSetPC); $pc[$currentRow["state"]] = $currentRow["postcode"]; } } else { $result = mysql_fetch_array($recordSetPC); $pc[$result["state"]] = $result["postcode"]; } } } else if (strlen($postcode) != 0) { //echo "by postcode"; $qry = "select postcode,state from postcodes where postcode = '$postcode' limit 1"; $recordSetStore = mysql_query($qry); if (mysql_num_rows($recordSetStore) > 0) { $result = mysql_fetch_array($recordSetStore); $pc[$result["state"]] = $result["postcode"]; } } else { echo "nothing"; echo "<br>storename = " .strlen($storename); echo "<br>suburb = " .strlen($suburb); echo "<br>postcode = " .strlen($postcode); } function getLongAndLat($pcode) { $qry = "select longitude, latitude from postcodes where postcode = $pcode limit 1"; $recordSetLonLat = mysql_query($qry); $result = mysql_fetch_array($recordSetLonLat); return "<longitude>" .$result["longitude"] ."</longitude><latitude>" .abs($result["latitude"]) ."</latitude>"; } if (count($pc) > 0) { $xmlStr = "<stores>"; while ($item = each($pc) ) { $xmlStr = "$xmlStr<state name=\"" .$item["key"] ."\">"; $itemPostCode = $item["value"]; $CenterLonQry = mysql_query("select longitude from postcodes WHERE PostCode = $itemPostCode LIMIT 1"); $CenterLonRecord = mysql_fetch_array($CenterLonQry); $CenterLon = $CenterLonRecord[0]; $CenterLatQry = mysql_query("select latitude from postcodes WHERE PostCode = $itemPostCode LIMIT 1"); $CenterLatRecord = mysql_fetch_array($CenterLatQry); $CenterLat = $CenterLatRecord[0]; $postCodes = " SELECT DISTINCT postcodes.PostCode, MIN($EarthRadius * acos((XAxis * (cos(RADIANS($CenterLat)) * cos(RADIANS($CenterLon)))) + (YAxis * (cos(RADIANS($CenterLat)) * sin(RADIANS($CenterLon)))) +(ZAxis * sin(RADIANS($CenterLat))))) AS ProxDistance, stores.* FROM postcodes, stores WHERE ( $EarthRadius * acos( XAxis * (cos(RADIANS($CenterLat)) * cos(RADIANS($CenterLon))) + YAxis * (cos(RADIANS($CenterLat)) * sin(RADIANS($CenterLon))) + ZAxis * sin(RADIANS($CenterLat))) <= $SearchDistance OR postcodes.PostCode = $itemPostCode ) AND stores.PostCode = postcodes.PostCode GROUP BY postcodes.PostCode ORDER BY ProxDistance ASC "; $recordSet = mysql_query($postCodes); $records = mysql_num_rows($recordSet); $toCount = min(50, $records-1); for ($i = 0; $i <= $toCount; $i++) { $currentRow = mysql_fetch_array($recordSet); $thisLonLat = getLongAndLat($currentRow["Postcode"]); $xmlStr = "$xmlStr<location> <locationName>" .$currentRow["StoreName"] ."</locationName> <franchisee>" .$currentRow["Franchisee"] ."</franchisee> <manager>" .$currentRow["Manager"] ."</manager> <address1>" .$currentRow["Address1"] ."</address1> <address2>" .$currentRow["Address2"] ."</address2> <suburb>" .$currentRow["Suburb"] ."</suburb> <state>" .$currentRow["State"] ."</state> <postcode>" .$currentRow["Postcode"] ."</postcode> <phone>" .$currentRow["PhoneNumber"] ."</phone> <fax>" .$currentRow["FaxNumber"] ."</fax> <email>" .$currentRow["EmailAddress"] ."</email> <image>" .$currentRow["Image"] ."</image> " .$thisLonLat ." </location> "; } $xmlStr = "$xmlStr</state>"; // loop again } $xmlStr = "$xmlStr</stores>"; } else { $xmlStr = "<stores></stores>"; } echo "$xmlStr";  echo $currentRow["StoreName"]; ?>
  2. i am realy stuck with this can some one please help me. --------------------------------------------------------- These instructions describe how to link the Post eDeliver Delivery Rate Calculator (DRC) to a Merchant web site via an HTTP request.  The DRC estimates delivery charges and times for parcels dispatched via the Australia Post network, allowing Merchants to pass this information to their customers as they browse the Merchant’s product catalogue and place orders.  Services for which the DRC provides estimates are :  · Domestic parcels : Regular or Express Post parcels · International parcels : Air, Economy or Sea parcels ------------------------------------------------------------------ INSTRUCTIONS : PHP These instructions are for web sites built using PHP scripting language versions 3 and 4. 1  ACTIVATING THE DRC Send the following code to the DRC : $myfile=file('http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode='.$var_pickup.'&Destination_Postcode='.$var_destination.'&Country='.$var_country.'&Weight='.$var_weight.'& Service_Type='.$var_service.'&Length='$var_length.'&Width='.$var_width.'&Height='.$var_height.'&Quantity='.$var_quantity); Example of PHP query to obtain data for above code $qs .= 'Height='.$HTTP_POST_VARS["Height"].'&'; $qs .= 'Length='.$HTTP_POST_VARS["Length"].'&'; $qs .= 'Width='.$HTTP_POST_VARS["Width"].'&'; $qs .= 'Weight='.$HTTP_POST_VARS["Weight"].'&'; $qs .= 'Pickup_Postcode='.$HTTP_POST_VARS["Pickup_Postcode"].'&'; $qs .= 'Destination_Postcode='.$HTTP_POST_VARS["Destination_Postcode"].'&'; $qs .= 'Country='.$HTTP_POST_VARS["Country"].'&'; $qs .= 'Service_Type='.$HTTP_POST_VARS["Service_Type"].'&'; $qs .= 'Quantity='.$HTTP_POST_VARS["Quantity"]; . Please note It is recommended that Merchants with domestic deliveries only preset the Country Code to “AU” (Australia). 2  INTERPRETING THE RESULTS When the $myfile=file('http://drc.edeliver.com.au/ratecalc.asp?'.$qs) enquiry is executed by the DRC the results are placed into an array called $myfile. The name/value pairs of the results are returned as per this example: charge=2.74 days=2 err_msg=OK Where: · charge = the estimated delivery charge in $AUS; · days = the estimated transit time in business days through the Australia Post delivery network from time of lodgement with Australia Post to time of delivery; · err_msg  = a message verifying that the data sent is correct (“OK”) or notifying data errors detected (Eg “Item girth outside valid ranges”). 3  DISPLAYING THE RESULTS PHP’s  “split()” function is used to retrieve the values returned by the DRC. Merchants may manipulate the results to suit the needs of Consumers and the requirements of their Web page design. Ie Merchants can select which parts of the results to display (Eg delivery time may be displayed and delivery charge ignored), alter the data returned (Eg to add a margin to the delivery charge estimate or to add order processing time in the Merchant’s warehouse to the delivery time estimate) and set the format used to display the results. Example $x = split('=',$myfile[0]) splits the data pair line into items separated by the “=” sign, resulting in an array called $x with values, which can be displayed.  Using the example above, the first data pair could be split, manipulated and displayed as follows: $x[0] = "charge" and $x[1] = 2.74 echo "The charge is $".$x[1]; The next two data pairs ( $myfile[1] and $myfile[2] ) can be split, manipulated and displayed in the same way. ------------------------------------------------------ when i run this code all in one page it get an error message. can some one please explain to me how this work. your help very important to me  thanks in advance
  3. Hi there i want to be able to search for an exact post code and also for sorounding area. for example the post codes are 3801 3802 3803 3804 3805 3806 3807 3809. customer searchs for 3804 but i want to be able to bring up all other as well from 3801 to 3809. i am going crazy [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]
  4. [!--quoteo(post=340770:date=Jan 28 2006, 10:31 PM:name=Robertphp)--][div class=\'quotetop\']QUOTE(Robertphp @ Jan 28 2006, 10:31 PM) [snapback]340770[/snapback][/div][div class=\'quotemain\'][!--quotec--] Has anyone successfully been able to use the database recordsets with a Godaddy account? I can't seem to connect to the server for the MySQL, so I never get a chance to use the recordsets. Anyone run into this?? I get an 403 forbidden. Are there any other web hosts out there where it's easy to connect to with dreamweaver? Thanks, Robert [/quote] you can ask your hosting company to allow your ip to be connected to mysql database with dream weaver. that is the only you can get connected. and you have to have a static ip address.
  5. i have a table wiht name field and address field. i have alot of duplicte names but diffrent address. how can i list only one name. i used SELECT DISTINCT (links.name), links.info FROM links but it still returns all names.
  6. Hi there how can i convert the dollar amount to cents eg i want to convert 1.00 to 100 cents. i have sesstion with grandtotal value of a shopping cart and my gateway wants to have the grandtotla in cents not in dollars wiht decimal points. this is my session varible . <?php if (!session_id()) session_start(); if(($shoptill->GrandTotal() != "")) { $_SESSION["grandtotal"] = "".$shoptill->GrandTotal() .""; } ?> the help is greatly appreciated
  7. [!--quoteo(post=323288:date=Nov 30 2005, 10:03 AM:name=ChrisDarl)--][div class=\'quotetop\']QUOTE(ChrisDarl @ Nov 30 2005, 10:03 AM) 323288[/snapback][/div][div class=\'quotemain\'][!--quotec--] Believe this should work... you but the code within your loop for calling the mysql data. Not a seperate loop inside the loop? If you get what i mean :S Anyway, give it a try, let me know if it doesnt work and ill test it out n sort it for ya Chris <td>phone</td> <td>mobile</td> </tr> <?php $num = 1; do { ?> <tr> <td><?php echo $num; ?></td> <td></td> <td><?php echo $row_listatoz['name']; ?></td> <td><?php echo $row_listatoz['address']; ?></td> <td><?php echo $row_listatoz['city']; ?></td> <td><?php echo $row_listatoz['state']; ?></td> <td><?php echo $row_listatoz['postcode']; ?></td> <td><?php echo $row_listatoz['phone']; ?></td> <td><?php echo $row_listatoz['mobile']; ?></td> <?php $num++; ?> </tr> <?php } while ($row_listatoz = mysql_fetch_assoc($listatoz)); ?> </table> </body> </html> <?php mysql_free_result($listatoz); ?> Hi Chris thanks for your help it worked but the problem was if i had 100 records and i displayed only 20 per page and when i click next page. on the next page it starts agin from 1 where is should start from 20. i found a solution for it if i place this code outside loop it works fine and starts the new page from 20 or what ever the number should be. <td>phone</td> <td>mobile</td> <?php isset($startRow_listatoz)? $orderNum=$startRow_listatoz:$orderNum=0;?> </tr> <?php do { ?> <tr> <td><?php echo ++$orderNum; ?></td> <td></td> <td><?php echo $row_listatoz['name']; ?></td> <td><?php echo $row_listatoz['address']; ?></td> <td><?php echo $row_listatoz['city']; ?></td> <td><?php echo $row_listatoz['state']; ?></td> <td><?php echo $row_listatoz['postcode']; ?></td> <td><?php echo $row_listatoz['phone']; ?></td> <td><?php echo $row_listatoz['mobile']; ?></td> </tr> <?php } while ($row_listatoz = mysql_fetch_assoc($listatoz)); ?> </table> </body> </html> <?php mysql_free_result($listatoz); ?> once agin thanks for your hlep. Cheers
  8. [!--quoteo(post=322869:date=Nov 28 2005, 04:26 PM:name=ryanlwh)--][div class=\'quotetop\']QUOTE(ryanlwh @ Nov 28 2005, 04:26 PM) 322869[/snapback][/div][div class=\'quotemain\'][!--quotec--] if you're using a loop to return the result, then it's easy $num=0; while($row=mysql_fetch_array($result)) { echo $num; /* do stuff */ $num++; } ------------------------------------------------------------------------------------------------------------------- Hi there its not working properly or i am doing some thing wrong. i am using rpeated region server behaviour in dream weaver 8. i placed the code it works but the problem is it will only loop the number. and it doese it in the same box it returns 1234 ... 50 in the same row and my data displays only one row. this is the code. <td>phone</td> <td>mobile</td> </tr> <?php do { ?> <tr> <td><?php $num=0; while($row=mysql_fetch_array($listatoz)) { echo $num; /* do stuff */ $num++; } ?></td> <td></td> <td><?php echo $row_listatoz['name']; ?></td> <td><?php echo $row_listatoz['address']; ?></td> <td><?php echo $row_listatoz['city']; ?></td> <td><?php echo $row_listatoz['state']; ?></td> <td><?php echo $row_listatoz['postcode']; ?></td> <td><?php echo $row_listatoz['phone']; ?></td> <td><?php echo $row_listatoz['mobile']; ?></td> </tr> <?php } while ($row_listatoz = mysql_fetch_assoc($listatoz)); ?> </table> </body> </html> <?php mysql_free_result($listatoz); ?> thanks in advance
  9. how can number my search result like yahoo. if my search returns 50 result i want to be bale to place a number next to it . such as 1 -- test result 2 - test reult any dream weaver extentions that can solve this problem? thanks
  10. [!--quoteo(post=322409:date=Nov 27 2005, 03:10 AM:name=Honoré)--][div class=\'quotetop\']QUOTE(Honoré @ Nov 27 2005, 03:10 AM) 322409[/snapback][/div][div class=\'quotemain\'][!--quotec--] As company.name and routes.name are identical in your query you only have to select one of them in your result set: SELECT routes.name FROM routes, company WHERE company.name = routes.name ORDER BY routes.name The usage of DISTINCT can eliminate doubles in your result set: SELECT DISTINCT routes.name FROM routes, company WHERE company.name = routes.name ORDER BY routes.name If possible, making routes.name and company.name indexes will improve the speed of your query. i tried it its still very very very slow. how can i index my tables?
  11. i want to display only the records that mach from two tables i have used this mysql code but it takes toolong to show the records it takes more then few min. SELECT company.name, routes.name FROM company, routes WHERE company.name = routes.name ORDER BY routes.name i have 16000 records in routes table and 3000 records in company table. what i want to do is i want the mysql to take the name of company from routes table and compare it wiht company.name table . if the same company name exists in company.name table display. and when it takes few min and displays the records it shows i have 28558 records. in table routes i have the same company name repeated few times but the functions are diffrent. how can i solve this problem and make it work faster its very very slow now.
  12. i am using dreamweaver 8 and php. i want to make a recordset that displays records older then 20 days. i cant work out how to filter the date field. thanks in advance
  13. Hi there i am trying to make a database wiht 16000 records i have made the text file and when i try to inset it to data base using phpmyadmin it doest work. IS 16000 RECORDS TOO MUCH FOR MYSQL. IS IT OK IF I KEEP 16000 RECORDS IN ONE TABLE. IF NOT HOW CAN I GET AROUND THIS PROBLEM.
  14. =============================== hi there thanks very much for you respond but it seems to be working when i try the code in dreamweaver recordset window when i test the counting it works but on the page once agin it shows the frist count on all fields. i have used repeat region server on table soo when it repeats on fields it shows the same count for all rpeated fileds. any idea
  15. how can i ask the sql to display results from two diffrent tables. wich feedid is = to id from diffrentt able ============================== SELECT content.id, messeges.feedid FROM messeges, content WHERE messeges.feedid = content.id =========================== i have designed a web log and on each topic i want others to be able to gave thier feed back. soo when user clicks on post feed back button i pass the id of topic to form by url and soo the feed back table has a field named feedid wich is equal to id of the topic. on main page i want to be able to display how money responds have been saved for each topic. i used the code above but all the topics shows same amount of responds. i am going crazy wiht this problem. thanks alot
×
×
  • 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.