Jump to content

Kristian_C

Members
  • Posts

    246
  • Joined

  • Last visited

Posts posted by Kristian_C

  1. Hehe, i remember when i started to code, i was so confused becouse i allways forgot that } at the eds of thigs.. and i dident know that the error was that :) so i used about 10hours searching the net for error names but i just found other things :)But i found it later and now i allways check if i have forgotten it before i update the page :) its not many times i get a error free page but it gets better all the time :blink: hehe...-> Kristian_C

  2. Just a create window function :) hehe... ¨just like you click a link and the window opens in a browser... but i want to have the control the window myself.. so if the user gets a new message a new window pops up... But thanks for the help anyway tho :)

  3. I dont know PHP :)
    The php part can i figure out myself.. just need help to create the popup thing.. etc a code so when u go on a page another window pops up. The part with when the window should come and stuff wont be a problem..-> Kristian_C
  4. That part aint hard. Its only the image i cant figure out.. If you know how to create a simple popup window? like a normal browser window.. goes like :

    <?if($bruker->meld=ny){echo"Then the function thig to aktivate the popup should go here or something :p hehe... dont know if its possible at all...";->Kristian_C?>

  5. I am not a total expert in JavaScript but I dont thinkg that this is actually possible to add a custom image to an alert box. But if you really want an image in the alert you can make your own function that would be able to pop up any time. Try this out.
    <html><head><script>function loadIt(){ pop.style.display="none";}function popIt(what){  pop.innerHTML="<img src='http://geocities.com/psaxena_17/197.jpg'/><p>"+what+"</p>";  pop.style.display= " ";}function close(){ pop.style.display="none";}</script><style>#pop{ position:absolutel top:100px; left:100px;}</style></head><body><a href="#" onClick="popIt('Testing the pop function')">test it</a><div id="pop"></div></body></html>

    I have not comiled the code myself so please correct any minor errors :)

    Hmm, it works tho. but i cant have any links or anything, and it should just popup from the screen when the user gets like a message to the inbox etc.. but trying to make something else to so thats why i need picture :) hehe...But thanks for the help to, i really cant do anything with javascript so allways good to get some help..-> Kristian_C
  6. thanks :)but hmm.. whould :

    <?if($_POST['out']){session_destroy(username)echo"<script LANGUAGE='JavaScript'>window.location=index.php;</script>";?>

    that work? or must i do something else to select the username from somewhere?its a admin fuction so if i want to close down the site and need all users to logout...- Kris

  7. Hey, if i use this :if (empty($_SESSION['username'])){echo "<script LANGUAGE='JavaScript'>window.location='index.php';</script>";and add a submit form. will that logout all users that are online on page? ->Kristian_C

  8. Hey, dont really know if this should go under PHP or JS but posting it here :) I have a table with bbcodes that onloads to the textarea, but i dont want it to be shown on the page all the time, so anyone here that can help me with a show/hide function.. like you click on a link and the table goes onto the site.

  9. Hey again people :)just wondering how i can spilt up number, like you have 100,000 on your bank account but it shows 100000 insted of how it should be.. how can i spilt it?- Kristian_C

  10. Right, so what are you having problems with? For the checkboxes, you will want to name them all the same thing (an array) and have the value of each one be the database ID.<input type="checkbox" name="cars[]" value="123">You can get the list of IDs as an array from post:$cars = $_POST['cars'];and loop through it to total up the sum, or do whatever. If you are showing a confirmation screen between the form and the database work, then you will want to have a hidden form on the confirmation screen containing all the same stuff but inside hidden elements instead of checkboxes:<input type="hidden" name="cars[]" value="123">
    The problem is just to get the counted sum and id's to be updated/deleted from the db :the count code that u fixed for we works so its counting and showing the sum and total cars.. but need to delete all ids from sql as ive said and update the users money thats my only problem :hers the count/delete/update codes :
    <script language=JavaScript>function sell_all (amount, total){ 				var del = confirm("Are you sure you wish to sell " + amount + " cars, totaling $ " + total); 				if (del == true){ var loc="garage.php?sell_all=true&sell_s=go"; window.location=loc; } 			}			</script><?$mysql=mysql_query("SELECT * FROM users WHERE username='$username'");$fetch=mysql_fetch_object($mysql);if (strip_tags($_GET['sell_s'])){$vv=$_POST['vv'];$i=0; $d=0;if (is_array($_POST['vv'])){  foreach($_POST['vv'] as $val){	$nice=mysql_fetch_object(mysql_query("SELECT * FROM garage WHERE id='$val'"));	$i+=$nice->worth;	$d++;  }}if (strip_tags($_GET['sell_all']) != "true" ){ echo "<script> sell_all('$d', '$i') </script>"; } if (strip_tags($_GET['sell_all']) == "true"){$n_money = $fetch->money + $nice->worth;mysql_query("UPDATE users SET money='$n_money' WHERE username='$username'");mysql_query("DELETE FROM garage WHERE id='$nice'"); echo "Cars Sold"; } }

    and i have a form like this :

    <form name="form1" method="post" action="?sell_s=go">  <table width="52%" border="1" align="center" cellpadding="2" cellspacing="0" class=thinline bordercolor=black>	<tr bordercolor="#000000" background="includes/grad.jpg">	  <td height="25" background="includes/grad.jpg" colspan="9"><center class="style2">		  <strong>Garage </strong>	  </center></td>	</tr>	<tr bgcolor=#666666>	  <td height="201" colspan="6" class=tip><div align="center"></div>		  <div align="center"><img src="includes/garagepic.jpg" width="642" height="201"></div></td>	</tr>	<tr>	  <td height="24" colspan="6" background="includes/grad.jpg" class=tip><div align="center"></div>		  <div align="center">			<div align="center"></div>			<div align="center"></div>			<div align="center"></div>			<div align="center"><span class="style1 style2"><strong>Your cars: </strong></span></div>		  </div>		  <div align="center"></div>		  <div align="center"></div>		  <div align="center"></div></td>	</tr>	<tr bgcolor=#666666>	  <td width="36%" height="24" class=tip><div align="center"><span class="style1">Type(id)</span></div></td>	  <td width="12%" class=tip><div align="center"><span class="style1">Damage</span></div></td>	  <td width="21%" class=tip><div align="center"><span class="style1">Origion</span></div></td>	  <td width="21%" class=tip><div align="center"><span class="style1">Location</span></div></td>	  <td width="10%" class=tip><div align="center"><span class="style1 style2">Sell</span></div></td>	</tr>	<?   $gather = mysql_query("SELECT * FROM garage WHERE owner='$username'");  $count=mysql_num_rows($gather);  if ($count=="0"){  echo "<tr><td colspan=6 bgcolor='666666' cellspace=2><center>No Cars In Garage</center></td></tr>";  } $e=0;  while($object=mysql_fetch_object($gather)){if ($e == "0"){ $color="#666666"; $e=1; }else{ $color="#434343"; $e=0; }  echo   "  <tr bgcolor=$color> 	<td><input type=checkbox name='vv[]' value='$object->id'><a href=?type=$object->id&prc=$for>$object->car</a>  <font color='black'><b>$object->id</b></font></td>	<td width=13%>$object->damage%</td>  	<td width=16%>$object->origion</td>";	if($object->status==1){		$ships=$object->shiptime-time();		if($ships<1){			mysql_query("UPDATE garage SET status='0' WHERE id='$object->id'");		}	  echo"	<td width=19%>$ships seconds before $object->car will arive in $object->location</td>	  ";	}else{	  echo"		  <td width=19%>$object->location (<a onclick=ship($object->id); href=#>Ship!</a>)</td>";	}	 echo "<td><a href='?sell=$object->id&prc=$type->car'</a>Sell</td>";  }  ?>  </table></form>

  11. I'm not sure what you're asking, what are you trying to do?
    well i have a game (online mafia game), but still working on some functions that i need to comlete before i can start makeing new ones... and it is like a "garage" lets say it is a inbox then and in most inboxes you have check boxes to delete more then one message.. its just like the same, the player checks the boxes that counts id from the table garage and when he pushes sell it comes up a alert box with : are you shure you want to sell # of cars for a total of xxx money.If yes it is a code that should be counting all id's to delete and update the users table with the money the user should get by selling his cars... understand? ...
  12. Aha, i think i can see what i did wrong :).. dident add the "select random" or what i can name it.. like $test[$nr]. the : [] counts the random tight? or not counts but selects or something? hehe.. thanks for helping again and again...

  13. Thanks mate, now i works without errors... But dont delete the id/update the users money tho...i really cant do so much with count functions so dont know what do make it count several id's to delete from the db... can you help with that to?and thanks again :)

  14. Hey, lets say i click a link, or a button.How can i etc get : hey the frist time then hello ?tried with this code :

    if ($_POST[test]){$test=rand(0,3);$test = array('Hello','Hey','Test');echo"$test";

    but dident work...anyone that know it?

  15. You can always go there www.php.net/foreach and make sure what you did was all right.
    Aha :) ill check it out.. dont use php.net so much to hard to understand :) hehe... thanks again :)
  16. Well if you have every thing in the DB i dont see anything wrong...my final solution may be this:make a new file :just add the refresh in it... and add :<?include "refresh.php";?>at the end of edit3...if that wont work its your code that are missing something.. so just check everything in your db to see if it matches your code.. if it does add the file and test... - Kris

×
×
  • Create New...