Jump to content

aleniko

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aleniko's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry - What are code tags?
  2. Hi all; I have the following statement to create a temporary table: mysql_query("create temporary table curdist1 select acct,name,address1,address2,krccust.city,krccust.state,krccust.zip,krccust.tel,zips.lat,zips.lon,termtype,web,shpadrs1,shpadrs2,shpcity,shpstate,shpzip from krccust left join zips on left(krccust.zip,6)=zips.zip") ;^M After the table is created, I need to go through it and change every record which has the phrase "P.O." in the name field. I need to replace the information in the name,address1,address2,city,state,zip with the corresponding shpname,shpadrs1,shpadrs2,shpcity,shpstate,shpzip for all the records which have "P.O" in the name field. Can someone let me know what's the syntax for that? Also, I would like to know if this is achievable withing the original select statement. Thanks!
  3. Wonderful. You've solved my problem. Thanks once more!
  4. Thanks Barand; So if I needed to run several queries on my initial query, what is the best way of doing so? Using option 2, I will need to run the initial query again and again for every secondary query I make, right? Also, using option 1 would mean I need to create the temp table and populate it manually - not using a select command? Thanks.
  5. Error is: Parse error: parse error, unexpected T_STRING, expecting '(' in /home/smartsco/public_html/krcweb/jj.php on line 34 Line 34 is declare curdist1 CURSOR I'm not sure what are code tags... No, this is supposed to work server side only. I need to find records according to geographic proximity, but its a complicated criteria. So I want to create an initial cursor and do my queries on that. Thanks and let me know if you need any additional info.
  6. Hi all; I'm a Foxpro programmer and I'm trying to do some work with php. Here is my problem: I need to create a few cursors and then select from the cursors. In Foxpro its pretty simple - select something from somewhere into cursor cur1 and then, select * from cur1 where something = somethingelse I'm having problems doing this with php. I tried declaring the cursor but I'm getting an error. Here is my entire declare code - all the math is for distance lookup.: declare curdist1 CURSOR FOR select acct,name,address2,krccust.city,krccust.state,krccust.zip,krccust.tel,zips.lat,zips.lon, ( 3959 * acos( cos(radians($olat)) * cos(radians(zips.lat)) * cos(radians(zips.lon) - radians($olon)) + sin(radians($olat)) * sin(radians(zips.lat)) ) ) AS distance from krccust left join zips on krccust.zip=zips.zip ;^M $res = mysql_query("select * from curdist1 where distance > 10");
  7. OK - figured it out for myself. I have to use the table name if the field names are identical. So I tried $sql='SELECT acct, name, address1,address2,krccust.city,krccust.state,krccust.zip,tel '.^M 'FROM krccust left join zips on krccust.zip = zips.zip ';^M And it worked. Still, thanks :-)
  8. Hi; What is wrong with the following syntax? $sql='SELECT acct, name, address1,address2,city,state,zip,tel '.^M 'FROM krccust left join zips on krccust.zip = zips.zip ';^M $res = mysql_query($sql);^M As opposed to $sql='SELECT acct, name, address1,address2,city,state,zip,tel '.^M 'FROM krccust ';^M $res = mysql_query($sql);^M In the first case I get an error "Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource" In the second case everything works fine. Note that I get the error when I issue the following: while($row = mysql_fetch_object($res)){ Thank you all!
×
×
  • 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.