Jump to content

watagal

Members
  • Content Count

    120
  • Joined

  • Last visited

Community Reputation

0 Neutral

About watagal

  • Rank
    Member

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Gender
    Male
  • Location
    San Jose, Costa Rica
  1. watagal

    INNER JOIN

    Ok, it looks like there is only one "id" which is overwritten by the 2nd table's value (9). How do I gain access to the 1st table's "id"? Do I need to rename all my pkeys to a unique name or is there a better way? Thanks, Galprint_r($record) = [0] => 5 [id] => 9 [1] => 1 [countryId] => 1 [2] => 3 [areaCodeId] => 3 [3] => 555-5555 [phoneNumber] => 555-5555 [4] => 1 [origMemberId] => 1 [5] => 1 [isActive] => 1 [6] => 2008-06-23 17:13:23 [date] => 2008-06-23 17:13:23 [7] => Family [share] => Family [8] => 3 [9] => 555 [areaCode] => 555 [
  2. watagal

    INNER JOIN

    Greetings-When I do an INNER JOIN on 2 tables with the "id" field or column existing in both tables - I get 2 IDs in the fetched record set. How do I distinguish between the 2 while looping thru while($record = mysql_fetch_array($result)) { echo $record['tableA.id']; echo $record['tableB.id'];} I know the above does not work, what is the correct syntax?TiA, Gal
  3. -- Never mind, I found some more info on this - I'll give it a try! Sorry for the post.
  4. Greetings-I can create a SELECT statement with one INNER JOIN, but How do I create a statement with 2?TiA, Gal-- Never mind, I found some text - I'll give it a try!
  5. watagal

    INSERT

    Found the answer to the first question:$sql = "INSERT INTO person VALUES ('Børge','Refsnes','Sandnes','17')";$result = mysql_query($sql,$con);echo "ID of last inserted record is: " . mysql_insert_id(); Still looking for the answer to #2.
  6. watagal

    INSERT

    Greetings-I have some very basic questions concerning the INSERT command in MySQL (v5):1) When inserting a new record, how can I get the record key ('id', primary_key, auto_increment) number?2) How can I determine if the insertion failed based on a unique field ('email', unique) already exists?I realize I can execute a SELECT command just before or after the INSERT to get what I want, but I thought I might get clever here. Tia, Gal
  7. aspnetguy writes: What about using $_SESSION[] ? Is this more secure or less secure?
  8. Thankyou!! That's it!!my reponse PHP file includes the header() AND IT WORKS!! -- Thanks sooo much! header('Content-type: text/xml');echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
  9. Thanks again jesh -It appears (to me) that I am requesting a "text/xml" content type, but recieving "text/html" type (via firebug):So my XML response must be malformed, but I don't know how or where? Here it is: <?xml version="1.0" encoding="ISO-8859-1"?><root> <node> <target></target> <id>1</id> <label>Administrator</label> <email>admin@abc.com</email> <isPrimary>1</isPrimary> <share>All</share> </node> <node> <target></target> <id>3</id> <label>Family
  10. Thanks again jesh- in either case - i get nullI think the problem is either my XmlHttpRequest or my PHP script generating the XML response - because my response is returning via the "responseText", not the "responseXML".Here's my 'responseXML':Here's my 'responseText':So where might I be going wrong?Gal
  11. Thanks jesh-I tried the alert() and it came up null - but according to Firebug, the response has XML data:I'm looking at w3schools example: http://www.w3schools.com/ajax/tryit.asp?fi...httprequest_js4Here's my ajaxCall() function: // create AJAX objectvar xmlHttp = null;function createAjaxObject() { try { xmlHttp=new XMLHttpRequest();} // Firefox, Opera 8.0+, Safari catch (e) { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");} // Internet Explorer catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");} } return xmlHttp;}// AJAX callfunction ajaxCall(dataSource, method, encode
  12. This JS routine is called from an HTML control using the 'onclick' event: all good here function getEmailData(id,el) { ajaxCall(PHPDIR+'form_MyPage_getEmailData.php', "POST", 'id='+id+'&el='+el, async, getEmailData_Callback, 'xml');} The PHP (form_MyPage_getEmailData.php) produces the following XML (responseXML) code: all good here <?xml version="1.0" encoding="ISO-8859-1"?><root> <node> <target>divContent</target> <id>1</id> <label>Administrator</label> <email>admin@************.com</email> <isPrimary>1</i
  13. Ok, let's see if I'm on the right track?My assumptions:1) We can recursively call the same function.2) Variable scope is limited to within each recursive call of the same function. In other words, each time I call the function "addNode()", a whole new set of variables are created in memory.3) Except when I use pointer references (as in &$d and &$photoTag) and any modification made is visible in any of the recursive calls4) Am I using pointer references correctly?The top array is a sample PHP array and this code should transfer it to the bottom javascript sample.Are my assumption corre
  14. ThanksI'm querying my database with the results building a single multi-dimensional array where the nested depth is determined by the DB query. In other words, it will vary at runtime. This data will eventually populate a javascript tree (menu) control. The array is built in PHP and transferred to JS array.I'm trying to read the PHP array in order to replicate it in JS.This may not be the best way, if not - someone please let me know.TiA, Gal
  15. Greetings-All weekend, I've been trying to walk through an array where the elements can be specific data or another sub array. The nested arrays (or depth) is unknown. I've determined "array_walk()" and "array_walk_recursive()" won't work for me because it doesn't provide feedback on the depth (which I need). So I have been trying with "foreach()" statements. The problem is I don't think hardcoding a specific number of nested foreach() statements is a good solution.There must be a better approach. Any help is appreciated (as always).Gal
×
×
  • Create New...