Jump to content

calmchess

Members
  • Posts

    297
  • Joined

  • Last visited

Everything posted by calmchess

  1. It didn't save format when I posted..........I want the last line of above text to be block not inline.
  2. What tag should I use for text of a webapp for short pieces of text . I want each piece of text to be block elements. I thought I would use span at first but its inline. I have this with span time remaining: 00.00.60 $1.00 but I want this and I want it to be semantically correct. time remaining:00.00.60$1.00
  3. final solution to getting $i to echo is if($i-1>0){ echo $i-1; }else{ echo 0; }
  4. i already told you what I"m trying to accomplish I need to echo $i for ajax.....the code is appopriate. Please just stop answering
  5. lines destroys the echo statement I've verified it 3 diffrent ways.I think its time for somebody else to help. I need to isolate the delete statement from the echo statment. anybody have any ideas on how i can accomplish that? $q3=mysqli_query($conn0,"delete from room_attributes where _current_created_rooms='empty' order by id desc limit 1")or die(mysqli_error($conn0)); echo $i-1;
  6. LOL i guess now you understand why i didn't show all the code. The point here now is $i doesn't echo $i if the delete statement is there somehow the delete statement kills the echo. If i comment out the delete statment the one near $i then everything works fine. I just need it to delete and then echo $i so that some ajax that is calling this php returns "echo's" the index number and changes an image within the javascript callback.
  7. newest working code <?php $conn0=mysqli_connect("localhost","calmchess","ptoK4ptoK4","book"); if($conn0){ $q0=mysqli_query($conn0,"select _current_created_rooms from room_attributes")or die(mysqli_error($conn0)); while($row0 = mysqli_fetch_array($q0)){ $currentrooms0[]=$row0['_current_created_rooms']; } if(!isset($currentrooms0)){//used in the case of only 1 user logging out $q1=mysqli_query($conn0,"delete from room_attributes where id > 1")or die(mysqli_error($conn0)); echo "not empty"; return; } $numindexes0= array_count_values ($currentrooms0); if(!isset($numindexes0["empty"])){ echo "not empty"; return;//just return here because all rooms might be created wouldn't want to delete them all } if(count($currentrooms0)==1 && $numindexes0["empty"]==1|| count($currentrooms0)==2 && $numindexes0["empty"]==2){ $q2=mysqli_query($conn0,"delete from room_attributes where id>1")or die(mysqli_error($conn0)); return; } $isfound = in_array("empty",$currentrooms0); if($isfound===true){ for($i=0; $i<count($currentrooms0);$i++){ if($currentrooms0[$i]=="empty"){ echo $i-1; $q3=mysqli_query($conn0,"delete from room_attributes where _current_created_rooms='$currentrooms0[$i]'")or die(mysqli_error($conn0)); break; } } }else{ echo "not empty"; } } ?>
  8. <?php $conn0=mysqli_connect("localhost","calmchess","ptoK4ptoK4","book"); if($conn0){ $q0=mysqli_query($conn0,"select _current_created_rooms from room_attributes")or die(mysqli_error($conn0)); while($row0 = mysqli_fetch_array($q0)){ $currentrooms0[]=$row0['_current_created_rooms']; } if(!isset($currentrooms0)){//used in the case of only 1 user logging out $q1=mysqli_query($conn0,"delete from room_attributes where id > 1")or die(mysqli_error($conn0)); echo "not empty"; return; } $numindexes0= array_count_values ($currentrooms0); if(!isset($numindexes0["empty"])){ echo "not empty"; return;//just return here because all rooms might be created wouldn't want to delete them all } if(count($currentrooms0)==1 && $numindexes0["empty"]==1|| count($currentrooms0)==2 && $numindexes0["empty"]==2){ $q2=mysqli_query($conn0,"delete from room_attributes where id>1")or die(mysqli_error($conn0)); return; } $isfound = in_array("empty",$currentrooms0); if($isfound==true){ for($i=0; $i<count($currentrooms0);$i++){ if($currentrooms0[$i]="empty"){ echo $i; $q3=mysqli_query($conn0,"delete from room_attributes where _current_created_rooms='$currentrooms0[$i]'")or die(mysqli_error($conn0)); break } } }else{ echo "not empty"; } } ?>
  9. BTW above is returning the index value not the index position. I was confused about what array_search returns. My mistake.
  10. its ok I just take care of it with a for loop instead of using a handy php method to return the index number.
  11. I'm using the following code to search an array but my echo statement(echo $indexnum0) doesn't return the correct value after the delete statement runs. What is a better way to write this so that the indexnum0 variable always retruns the index value. If I remove the delete statement everything works well. Thanks for your time. --calmchess $isfound = in_array("empty",$currentrooms0); if($isfound==true){ $indexnum0 = array_search("empty",$currentrooms0); //index to remove sent on ajax callback $arrayid0=$currentrooms0[$indexnum0]; $q3=mysqli_query($conn0,"delete from room_attributes where _current_created_rooms='$arrayid0'")or die(mysqli_error($conn0)); if(mysqli_affected_rows($conn0)>0){ echo $indexnum0; } }else{ echo "not empty"; }
  12. while loop to the rescue! while (adminCons0.length) { adminCons0[0].className =roomToChange0; }
  13. I'm using the following script to change the class names of some elements and then as soon as I'm done changing those elements I want to get all the elements by their new class name and use them. But when I do this I can't get the new elements. The alert at the bottom does nothing. Can somebody please help me figure this problem out. BTW. I've tried running this with a for loop instead of reassigning them one by one but I have the same result. I think its a scope problem but I'm just guessing. if(document.getElementsByClassName("admin").length!=0){ var adminCons0=document.getElementsByClassName("admin"); adminCons0[0].className=roomToChange0; adminCons0[1].className=roomToChange0; adminCons0[2].className=roomToChange0; adminCons0[3].className=roomToChange0; trackArr00 = document.getElementsByClassName(roomToChange0); alert(trackArr00[0]); }
  14. well i mean an unusual name to search for I would think a google search for PHP search array would have given me results. At any rate thanks. --calmchess
  15. well that was unusual way of accomplishing a task but it worked .......added to the ole toolbox in my head Thanks.
  16. How do I search an array by string value and return the number of times that string occurs in an array? Is there a handy PHP method I don't know about that does this. my google search only comes up with array_search does setting it to strict do what I want? Thanks for taking the time to read this. --calmchess
  17. Nevermind I just learned something if you change a group of elements className within a for loop it changes the length of the elements dynamically while the for loop is running. I didn't call break on both elements one elements array just shrank so I was getting undesired results. Here is the entire working function in case somebody wants to study it. change1pic:function(picpaths0,userName0,roomId0,userLength0){ setTimeout(delay,3000); function delay(){ document.getElementsByClassName(roomId0)[0]=="admin"?trackArr00= document.getElementsByClassName(roomId0): trackArr00= document.getElementsByClassName("admin"); alert("this 6"+trackArr00.length); for(var i=0;i<trackArr00.length;i++){//this loop is necessary! there are 4 pic containers! //tracArr00[0] refers to the container that the 4 images are in //get image containers var trackPicCons0 = trackArr00[i].getElementsByTagName("img")[0].src.split("?")[0].substr(29,6); //get username containers //there is only 1 cotainer for usernames //use 0 var trackUserNames0 = trackArr00[i].parentNode.getElementsByTagName("span"); //get link containers //set all pic containers links to the roomid //use i var trackRoomLinks0 = trackArr00[i].parentNode.getElementsByTagName("a"); /*since admin has a shorter character length than defcon0 I don't need to change substr, it will parse as far as possible and return the shorter string*/ if(trackPicCons0=="defpic"||trackPicCons0=="admin"){ trackArr00[0].getElementsByTagName("img")[0].src = "http://localhost/book/images/"+picpaths0[0]; trackUserNames0[i].innerHTML=userName0; for(var j=0;j<4;j++){ trackRoomLinks0[j].href="http://localhost/book/swf/connect.html?roomid="+roomId0; } if(trackPicCons0=="admin"){ for(var k=0;k<4;k++){ trackArr00[k].className=roomId0; } } if(userName0=="offline"){ trackUserNames0[i].style.color="red"; }else{ trackUserNames0[i].style.color="black"; } break; } } } }, --calmchess
  18. in the following code snippet I have a for loop within a forloop but I need to break the first for loop but the break seems to stop both for loops instead of just one. I can't put the second for loop outside the first forloop because trackUserNames0 is defined within the first for loop and will negatively impact the first for loop if I call it before the break......in short how do I nest a for loop and it completes when the first forloop breaks? Maybe I'm clear off base here. some advice is welcomed. trackUserNames0[i].innerHTML=userName0; for(var j=0;j<4;j++){ trackArr00[j].className=roomId0; } if(userName0=="offline"){ trackUserNames0[i].style.color="red"; }else{ trackUserNames0[i].style.color="black"; } break; } --calmchess
  19. yeah that worked I thought because it was already a string it didn't need quotes....guiss I was wrong.....thanks for your help. --calmchess
  20. I'm stuck on this mysql condtional delete statment. I want it to delete the row where _roomid='$roomid00:::$roomid00:::$roomid00:::$roomid00' which works fine but I want it to exclude the row that contains _roomid!=roomx:::roomx:::roomx:::roomx I can't use the two statments togeather not sure why. How do I use AND in my sql statement? $q5=mysqli_query($conn5,"DELETE FROM logged_in_users WHERE _roomid='$roomid00:::$roomid00:::$roomid00:::$roomid00'AND _roomid!=roomx:::roomx:::roomx:::roomx")or die(mysqli_error($conn5));
  21. if I have two client applications calling myqli_query at the same instant in time will they both be honored by the mysql database or will a collision and error condition occur on one of the db transactions? --calmchess
  22. nevermind I just had to escape quotes instead of using single quotes go figure.
  23. I'm having trouble running this shell exec ....I suspect since there are spaces that it doesn't want to run it either that or there are restrictions on coping files from the system program files space. Can anybody shed some light on why i get the error the syntax of the command is incorrect? $test = shell_exec("copy /Y 'C:\Program Files\Adobe\Adobe Media Server 5\applications\\video_chat\streams\\$roomidX\\$roomidX$streamidX.flv' C:\webserver\dev\book\images\\$roomidX$streamidX.flv"); --calmchess
  24. yeah you are correct Here How I solved it <?php session_start(); $docID=7768; if($docID===7768){__putreg($docID);} function __putreg($docID){ if($docID===7768){ //check database for credentials $conn0=mysqli_connect("localhost","calmchess","ptoK4ptoK4","book"); if($conn0){ $q0=mysqli_query($conn0,"select _logged_in_picpath,_logged_in_username from logged_in_users")or die(mysqli_error($conn0)); $j=-1; while($row = mysqli_fetch_array($q0)){ $j++; $picpaths0[]=$row['_logged_in_picpath']; $usernames0[]=$row['_logged_in_username']; $picspaths00 = $picpaths0[$j].":::"; $picassets0=$picspaths00."^^^".$usernames0[$j]; if($j/4==0){ $picassets0=$picassets0."xxx"; } echo $picassets0; } } } } ?>
×
×
  • 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.