Jump to content

calmchess

Members
  • Posts

    297
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

calmchess's Achievements

Regular Member

Regular Member (3/5)

1

Reputation

  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
×
×
  • 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.