Jump to content

switchdoc

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by switchdoc

  1. Two things I can think of 1) echo out $del_id so you know its getting set correctly. 2) (and I may be wrong about this) can the action for your form really be "" ? -Switch
  2. A better example is found in the query: $lw1_query = mysql_query($lw1_sql) OR DIE ("There was an error" .mysql_error()); ("There was an error" .mysql_error()); Is basically saying if there is an error to output: "There was an error" + whatever mysql_error()) reports as the error. So you would get "There was an error unspecified field 'monkey' in table 'zoo'" or whatever -Switch
  3. Its kinda like a way to write this + this + this to allow you to move in and out of the quotes. In that case you are basically saying: echo '<option value="'.$player_id.'"> plus '.$player.' (the variable not the actual words $player) plus </option>\n'; The '.'s link it together. Matt may be able to explain it better but thats the basic jist anyway. -Switch
  4. Hey all, Thanks for all the replies! The answer just came via an email to a buddy I'd sent out earlier. Here is what he ended up having me do so I could get the hit count and use the page name (from another table) rather than just ID: [code] $query = "select count(t1.linkid),t2.pagename from page_counter as t1 inner join pages as t2 on t2.linkid=t1.linkid where t1.clickdate>='$sd' and t1.clickdate<='$ed' group by t1.linkid"; $result = mysql_query($query) OR DIE ("there was an error" .mysql_error()); while ($line = mysql_fetch_array($result,MYSQL_NUM)){list($count,$name) = $line; [/code] Then I can echo out the page name ($name) and the hits($count) into a table using the while loop. Thanks again for all your replies! -Switch
  5. Well, I just went back and looked and I think I screwed you all up. The scoop is I need ALL hits for each link in a date range So if the user selects 11/3 - 11/21 Each time the link appears in that date range, I need to count it so I can say LinkID 111 Hits 3 LinkID 237 Hits 56 Sorry for the confusion. -Switch 
  6. Thanks for the fast replies! I don't suppose anyone can show me how to pull this out on the other end, I am not quite sure how to echo out the clickdate (sum). Appologies in advanced and thanks! -Switch
  7. Hello,   Assuming you are using MySQL, this is how I do this: (I am taking while guesses that you have player names and auto-incremented player IDs. If you don't, you might want to consider it. ) [code] <select name='players'> <?php $query = "SELECT * from players"; $result = mysql_query($query) OR DIE ("There was an error .mysql_error()); while ($line = mysql_fetch_array($result,MYSQL_ASSOC)){ $playerid = $line["playerid"]; $player = $line["player"]; echo "<option value='$playerid'>$player</option>\n"; } ?> </select> [/code] The first part queries all the players out of the database. The second part assigns the variables in the array to straight variable names which are easier to work with. The while loop runs through each player that is pulled and writes the <option> line for each player. Make sense? Hope this helps, Switch
  8. Hello all,   I am hoping you can help me with what I am sure is a very simple issue. I need to keep track of the date and number of times certain links are clicked. To do that I've written a little script that pushes in the linkID and the date it was visited to a mysql db when that page is visited. The DB looks something like this:  [code]      LinkID  clickdate        604   2006-11-08       111   2006-11-08       111   2006-11-08       111   2006-11-08       229   2006-11-09       662   2006-11-09       183   2006-11-25       229   2006-11-09       183   2006-11-09 [/code] You'll note that LinkID 111 got hit 3 times on the same day. LinkID 183 got hit twice. When I output this I want to show LinkID: 111 Hits: 3 LinkID: 183 Hits: 2 LinkID: 229 Hits: 1 etc... I can't figure out the correct way to count this out of the query. Doing a select all and running it through a while loop lets me pull everything out, but somewhere there in the middle I have to add up the duplicates. Any thoughts appreciated!! -Switch
  9. I got it. Trick is to do it in reverse. Get the total number of files, start at the end and do the writes backwards. That way you aren't incrementing what you just changed. Thanks anyway, -Switch
  10. Well, I know why the while loop doesnt work. I am incrementing what I already incremented.  I am SOOO dumb. i.e. I say set step5 to 6, set step 6 to 7, etc and since it runs one at a time the I just set 5 to 6 so not I am setting that same step to 7 so eventually they all equal the highest possible number. So, can't do this in a while loop.. Any thoughts? -Switch
  11. I don't know exactly how your script is set up, but to send in HTML you'll want to output this to the headers: "Content-Type: text/html; charset=\"iso-8859-1\"\n" "Content-Transfer-Encoding: 8bit\r\n\r\n"; Hope that helps a little. -Switchdoc
  12. Hello,   I am hoping you can give me a hand with this. It's basic but I can't get it to work. I have a mysql table with a bunch of steps in it: instruction1 "do this" instruction2 "do that" instruction3 "do the other thing". What I am trying to do is allow a user to add a step in the middle and then re-write the id numbers so they are still in order. i.e. the user would add instruction2 "do something different" and i would end up with: instruction1 "do this" instruction2 "do something different" instruction3 "do that" instruction4 "do the other thing". I've tried doing this in a while loop: (frameid is the number I am trying to increment)(I am limiting at the frame number the user wants to add at, and 2000 because I know there will never be that many steps) [code] $update = "select * from tutorialfiles2 where tutorial='$tutorial' limit $frameidupdate, 2000"; $result = mysql_query($update) OR DIE ("There was an error" .mysql-error()); while ($line = mysql_fetch_array($result)){ $frameid = $line["frameid"]; $stepname = $line["stepname"]; $frameid2 = $frameid++; echo "<br><br>$frameid - $stepname <br>"; $change = "update tutorialfiles2 set frameid='$frameid2' where frameid='$frameid'"; $done = mysql_query($change) OR DIE ("There was an error" .mysql_error()); [/code] but what I get is, for example: instruction1 "do this" instruction2 "do something different" instruction4 "do that" instruction4 "do the other thing". its not incrementing, its just adding the highest possible step. Any thoughts appreciated. I'll be around if you need more info as I realize this is clear as mud. Thanks, Switchdoc
  13. Again thanks for the reply. Added the changes suggested by folks so far. Here again is the code: [code]$ssInfo =  "var point = new GLatLng(" . $location . ");"; $ssInfo .= "var marker = createMarker(point,\"$name\",\'<div id=\"infowindow\" style=\"white-space: nowrap;\">"   . addslashes($row['name'])   . $spacer   . addslashes($row['address'])   . $spacer   . addslashes($row['city'])   . $comma   . $space   . addslashes($row['state'])   . $spacer   . addslashes($row['zipcode'])   . $doublespacer   . addslashes($row['description']) . "</div>\');\n"; $ssInfo .= "map.addOverlay(marker);\n"; $ssInfo .= "\n";[/code] And here is the result: [quote]var point = new GLatLng(39.925112 , -105.087608);var marker = createMarker(point,"Broomfield Location",\' Broomfield Location 123 w smith Broomfield, CO 80020 Email: broomfield@company.com '); map.addOverlay(marker); [/quote] Still no div :( Any other thoughts?
  14. Hello,   That definitely looks to be the standard error you get when it can't log into the database. So, the things to check would be to verify that the username, password, and address of the DB are correct.   This is assuming the code itself didn't change and you are still calling the db connection where required, etc. -Switch
  15. I appreciate the reponse! I've added the slash where indicated, but no joy. Now I just get: [quote]var point = new GLatLng(39.922512 , -105.087608);var marker = createMarker(point,"Broomfield Location",\' Broomfield Location 123 w smith Broomfield, CO 80020 Email: broomfield@company.com '); map.addOverlay(marker); [/quote] Basically it just shows the slash.. this kind of little stuff drives me nuts.
  16. Thanks for the reply! It's close but I am still running into an issue. Here is what I am running into: Here is an example of what I ultimately need outputted with all the variables added so its easier to see whats going on: [quote]var point = new GLatLng(39.925512 , -105.086708); var marker = createMarker(point,"Broomfield Location",'<div id="infowindow" style="white-space: nowrap;">Broomfield location<br>123 W smith<br>Broomfield,&nbsp;CO<br>80020<br><br>Email:<br>broomfield@company.com</div>'); map.addOverlay(marker);[/quote] Here is what I am getting with the example you provided: [quote]var point = new GLatLng(39.925512 , -105.086708); var marker = createMarker(point,"Broomfield Location",' Broomfield location 123 W smith Broomfield, CO 80020 Email: broomfield@company.com '); map.addOverlay(marker); [/quote] The <div .....> and </div> tags are gone. Is there a way to escape this so those stay? Its gotta be easy but I've thrown every \ at it I can think of and nothing :) Thanks, -Switch
  17. I don't have an exact answer, but I am wondering why you have to save the <?php into the variable. If you are reading the string, shouldn't you already be in a <?php tag?
  18. Looks like Tom beat me too it, and better too!
  19. I believe what you need here is a JOIN statement. Here are a few pages on it. See if this helps: http://mysql.com/doc/refman/5.0/en/join.html http://www.keithjbrown.co.uk/vworks/mysql/mysql_p5.php
  20. Hello all! Hoping you can help me with what is probably a simple issue but it has me stymied. I am working with google maps and ajax and I have to take a fairly complex bit of info and stuff it into one variable. Here it is: echo "var point = new GLatLng(" . $location . ");"; echo "var marker = createMarker(point,\"$name\",'<div id=\"infowindow\" style=\"white-space: nowrap;\">"   . addslashes($row['name'])   . $spacer   . addslashes($row['address'])   . $spacer   . addslashes($row['city'])   . $comma   . $space   . addslashes($row['state'])   . $spacer   . addslashes($row['zipcode'])   . $doublespacer   . addslashes($row['description']) . "</div>');\n"; echo "map.addOverlay(marker);\n"; echo "\n"; I need to get $info to equal all of that so it can be passed correctly back to my script. I am having a terrible time getting all the characters escaped. The semi-colons in particular resist all my efforts. Its got to be simple, but i can't seem to get it. How can I get $info = "<all that stuff>"; ? Thanks in advance! -Switchdoc
×
×
  • 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.