Jump to content

Kristian_C

Members
  • Posts

    246
  • Joined

  • Last visited

Posts posted by Kristian_C

  1. Thanks ill start useing it, but how do i print the error? added : mysql_query($sql)OR die(mysql_eorror);dont think it is right, now it just shows up mysql_error when i test the function.

  2. Well this is verry new to me. Ive never had so many insert problem in so few days... And this one is just wird.

    }else{$tid=gmdate("Y-m-d H:i:s");$denbilen=$bisal->bil;$denskade=$bisal->skade;Here is the problem :mysql_query("INSERT INTO bruktbil (`id`, `eier`, `pris`, `bil`, `tid`, `skade`, `status`)VALUES('','$brukernavn','$pris','$denbilen,'$tid','$denskade')");Problem end.and here it works again.mysql_query("UPDATE biler SET status='1' WHERE id='$bilad'");echo"Car added";}} ?>

    I cant figure it out. Can you?-> Kristian_C

  3. Just wondred about a little thing, what is the easyest way to separate id's with comma?Lets say i want to add users to my e-mail notice system. But dont want to do it 15 times, how can i separate the users id with 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15.Anyone that can help?->Kritsian_C.

  4. Hey again, i need some help with the round() function.Lets say i want to duplicate $anumber with 10, will that be = round(10*$anumber); ? i tried it but dident work, its just a simple ting like :

    if($_POST['test']){$money=$fetch->money;$exp=$fetch->exp;$nmoney=round($exp+$money /10);mysql_query("UPDATE test SET money='$money' WHERE id='$id'");echo"Testing Complete";[code]Just something like that  not quite shure that i acutally know what im doing here  but ive seen some exaples here and there so tested but dident work.->Kritsian_C
  5. I don't know if this is the right answer, but I saw a whitespace on the third line and you missed these ( )You've written: include_once"includes/kontakt.php";And you should have written: include_once ("includes/kontakt.php");And have you named the form itself? I mean, the submit button must have name="regg" because you've used if(isset($_POST['regg'])) {You also need to name the inputs with what you've used in the PHP code.
    Hehe, ive allways used include_once"include.include.php"; so that is not the problem.every form button/textfiled ++ have the right names. And to the mail answer : i used allmost the same mail code at my first game so that aint the problem, anyway it whould insert the user to the db before it sends the mail. so the mail aint the prob.->Kristian_C
  6. Hello,I know this is an easy question, but I'm not currently very good at SQL and would like to know how to update a TIMEDATE field.Currently I'm trying to use
    $current_timestamp=mysql_query("SELECT CURRENT_TIMESTAMP");$mysql_update_last_login=mysql_query("UPDATE account SET last_login='" . $current_timestamp . "' WHERE user_id='1');

    I dont know much about timestamp but i really think it is easyer to add it as DATETIME insted of timestamp if you just want to update the date when a user logs in.etc :$logintime = gmdate('Y-m-d h:i:s');mysql_query("UPDATE account SET last_login='$logintime' WHERE user_id='1'");->Kristian_C
  7. that not the part im having trouble with echo '<a href="descrip.php">'; echo '<img src="images/'. $row['imagename'] .'" width="400"height="400">';what would i add to this transfer the varible over i know that this is probly the dumbest question ever but i never realy learned html i just jumped into phpecho '<a href="descrip.php?accountnum=1">';echo '<img src="images/'. $row['imagename'] .'" width="400"height="400">';and then $_GET["accountnum"];i think that might be it
    That should work.ot just : <a href="descrip.php?accountnim=$avariable><img src="images/img"></a>if you have something to bring a variable to the link tho, so it shows what id it is..
  8. Hmm, im shure that this chould be to good help if you can to more with javascript then write the <script type='text/javascript'> </script>. But i really cant do so much more then that :).. Can you or someone else explain a bit better? ect write down how i should set up the table so it aint on page before i click show..I just copy'ed the one code u wrote and made a table and added id. but dident work so good :) hehe.. so help?!? :)

  9. hehe :

    <?$house=$_GET['house'];$select=mysql_fetch_object(mysql_query("SELECT * FROM houses WHERE house='$house'"));?><table width="26%"  border="1">  <tr>	<td>Location</td>	<td><? echo"$select->location"; </td>  </tr>  <tr>	<td>Rooms</td>	<td><? echo"$select->rooms"; ?></td>  </tr>  <tr>	<td>Price</td>	<td><? echo"$select->price"; ?> </td>  </tr></table>

    its just to add something like that on the page you want.Thought you dident want a new page :) But yeah this is the easyest way to do it :)->Kristian_C

  10. Hey, sorry for useing so long time on answering :) but allmost forgot about it, but now it have become a problem again as i am working on a new game.I added ("allmost copyed") your code :) but it dont work :s... It deletes but it just deletes one or two messages and it wont delete the oldest message in the inbox : Heres the code :

      <?$mysql1 = mysql_query("SELECT * FROM `inkom` WHERE `til`='$brukernavn' AND `lagra` ='no' ORDER by tid DESC");$antall =mysql_num_rows($mysql1);if ($antall == "0"){echo "<table with='60%' hight='15' bordercolor='000000' border='1' align=center><tr><td background=link.jpg><font color='ffffff'>You have no mail.</font></tr></td></table>";}else{while($inkom = mysql_fetch_object($mysql1)){$row = mysql_fetch_assoc($mysql1);$t++;$n++;?>  <table width='77%'  border='1' align='center' cellspacing='0' bordercolor='010101'>	<tr>	  <td background='link.jpg' width='31%'><? if($inkom->lest=="no"){echo"Unread :"; } echo"<a href=?side=lesmeld&meld=$inkom->id>$inkom->tittel</a>"; ?>	  </td>	  <td background='link.jpg' width='34%'><? echo" $inkom->fra"; ?> </td>	  <td background='link.jpg' width='28%'><? echo" $inkom->tid"; ?> </td>	  <td background='link.jpg' width='7%'><?php  echo "<input type=\"checkbox\" name=\"delete_ids[]\" value=\"{$row['id']}\" />";?></td>	</tr>  </table>  <?}}?><table width="10%" height="30"  border="0" align="center" cellspacing="1">	 <tr>	   <th scope="col"><table width="38%"  border="0" cellspacing="1">		 <tr>		   <th width="50%" scope="col"><input name="slettalle" type="submit" class="button" id="slettalle" value="Delete All"></th>		   <th width="50%" scope="col"><input name="slettsel" type="submit" class="button" id="slettsel" value="Delete Selected"></th>		 </tr>	   </table></th>	 </tr>   </table> </form> <?phpif($_POST['slettsel']){$delete_ids = $_POST['delete_ids'];if (is_array($delete_ids) && count($delete_ids) > 0){  $id_list = "";  foreach ($delete_ids as $id)  {	if ($id_list != "")	  $id_list .= ",";	$id_list .= $id;  }  mysql_query("DELETE FROM inkom WHERE id IN ($id_list)");}}?></body></html>

    If you can help me out again it whould be great :)-> Kristian_C

  11. the most simple way may be this. :1. Add a table at the end of all images. And add a get variable into your link. like <a href="?house=house">2. Add this code inside the table :

    <? if($_GET[house]){   $house=$_GET[house];if($house="house"){?><table width="26%"  border="1">  <tr>	<td>Location</td>	<td>the location </td>  </tr>  <tr>	<td>Rooms</td>	<td>the rooms</td>  </tr>  <tr>	<td>Price</td>	<td>the price </td>  </tr></table><? }if($house="anotherhouse"){ ?><table width="26%"  border="1">  <tr>	<td>Location</td>	<td>the location </td>  </tr>  <tr>	<td>Rooms</td>	<td>the rooms</td>  </tr>  <tr>	<td>Price</td>	<td>the price </td>  </tr></table><? }} ?>

    that may be the simplest way if you want to use php.The table you have the code in will be empty before the visitor clicks a house link offcourse. ->Kristian_C

  12. Here's the code.

    <?session_start();include_once"includes/kontakt.php";if(isset($_POST['regg'])){$brukernavn=$_POST['brukernavn'];$kjonn=$_POST['######'];$ref=$_POST['ref'];$land=$_POST['land'];$email=$_POST['email'];$email2=$_POST['email2'];$sjekkbrukernavn=mysql_query("SELECT brukernavn FROM brukere WHERE brukernavn='$brukernavn'");$sjekkemail=mysql_query("SELECT email FROM brukere WHERE email='$email'");$brukernavnsjekk=mysql_num_rows($sjekkbrukernavn);$emailsjekk=mysql_num_rows($sjekkemail);if($brukernavnsjekk > 0){echo"That username is allready in use";exit();if($emailsjekk > 0){echo"That email is allready beeing used";exit();}if (ereg('[^A-Za-z^0-9]', $brukernavn)) { echo "Username can only contain letters!";}if (strlen($brukernavn) <= 5 || strlen($brukernavn) >= 18){echo "The username is to big or to small!";}else{$passord=rand(111111,999999);$ip = $_SERVER['REMOTE_ADDR'];mysql_query("INSERT INTO `brukere` (`id` , `passord` , `brukernavn` , `email` , `aktivert` , `oppdrag` , `liv` , `ip` , `l_ip` , `online` , `brukerlevel` , `rank` , `penger` , `kuler` , `tos` , `######` , `profiltekst` , `profilbilde` , `profilmusikk` , `sistkrim` , `sistgta` , `antallkrim` , `antallgta` , `land` , `sistfly` , `fly` , `antalldrap` , `antallfly` , `antallmeld` , `amtallforum` , `antalloc` , `antallforum` , `hus` , `antallprofil` , `huspenger` , `krimsjanse` , `gtasjanse` , `hjelper` , `lukket` , `avisskriver` , `aviseier` , `avis` , `avisavis` , `status` ) VALUES ('', '$passord', '$brukernavn', '$email', 'ja', '1', '100', '$ip', '', '$nå', 'bruker', 'Slave', '500', '0', 'Accepted', '$kjonn', '', '', '', '0', '0', '0', '0', '$land', '0', 'None', '0', '0', '0', '0', '0', '0', '1', '200', '0', '0-0-0-0', '0-0-0', 'nei', '0', 'nei', 'nei', 'None', 'nei', 'lever')");$subject="UnderWorld Mafia";$message="Hello $brukernavn <br>		  Welcome to UnderWorld Mafia. You can login with the following information : <br>		  Username : $brukernavn		  Password : $passord		  		  This information is sent from a server that humans dont watch so pleace do not reply.		  UnderWorld Mafia Crew.";mail($email,$subject,$message,"From: UW Mafia<admin@UnderWorld-Mafia.com>");echo"Your account has been created. Pleace check your spam folder to if you dont get your account iformation within 10Minutes."; }}}?>

    It dont show any errors. echo's or nothing :s.Anyone that can help me out? ->Kristian_C

  13. Hey, im kind of new when it comes to functions like Round() Sterlen() +++ so was just wondering of someone chould help me out. Look'ed at the functions at the w3schools page, but dident understand so much, like how i can use sterlen to check lenght of a selected number like etc : i have a site, with a login function but ive just set the limit of max char inside the sql db. And not the textfield. I know i can use max char there to but its better for me to use other functions that i may need to use on other things that dont limmit of max char etc.If some one chould help me out with this i whould be verry verry happy :)Thanks.->Kristian_C

  14. Either enclose the variable in brackets:...VALUES('','{$biler[$få]}','...Or it might be because of the unicode character in the variable name. I'm not sure if that's allowed or not.
    Thanks mate, ill test it :)..-> Kristian_C.
    Thanks mate, ill test it :blink:..-> Kristian_C.
    :) it was the unicode character thing :) hehe... Thanks :blink:->Kristian_C
  15. Hey i have a small problem. On my front page i have a image with some glow effects to make the textfields loock cooler. But i forgot that when i use the image as table bg image resize destroys the cool effects and the textfields goes where they want to. So if anyone can help me sort this out it whould be glad.Heres the code :

    <table width="65%"  border="0" align="center" cellspacing="1">  <tr>	<th height="503" bordercolor="#0A0629" background="nyuwmfront.jpg" scope="col"><table width="98%"  border="0" cellspacing="1">	  <tr>		<th scope="col"> </th>	  </tr>	  <tr>		<td height="157"><table width="91%"  border="0" cellspacing="1">		  <tr>			<th width="28%" rowspan="3" scope="col"> </th>			<th width="40%" height="167" scope="col"> </th>			<th width="32%" scope="col"> </th>		  </tr>		  <tr>			<td height="41" colspan="2"><form name="form1" method="post" action="">			  <table width="91%" cellspacing="1" bordercolor="#000000">				<tr>				  <th width="40%" height="23" scope="col"><input name="usersid" type="text" value="" size="30" maxlength="30"></th>				  <th width="3%" scope="col"> </th>				  <th width="57%" scope="col"><input name="userspa" type="password" size="30" maxlength="30"></th>				</tr>				<tr>				  <td colspan="3"><div align="center">					<table width="92%" align="center" cellspacing="1">					  <tr>						<th width="40%" scope="col"> </th>						<th width="60%" scope="col"><div align="left">						  <input type="submit" name="innnnn" value="Login">						</div></th>					  </tr>					</table>				  </div></td>				  </tr>			  </table>			</form>			  </td>			</tr>		  <tr>			<td> </td>			<td> </td>		  </tr>		</table></td>	  </tr>	</table></th>  </tr></table>

  16. Hey :) Happy newyr people :) Another year with errors and late nights :) Heres the problem. The function is ment to insert cars into a "Garage". But i have an array problem that i cant figure out myself.The array works fine actually, it goes perfect into the echo and i get random every time. But it just wont insert the right "biler" into mysql.If someone can help me here it whould be great.

    }else{$få=rand(0,6);if ($biler[$få] == "Volvo 240"){ $bilde= "bilder/biler/volvo.jpg"; }elseif ($biler[$få] == "Subaru Impresa"){ $bilde= "bilder/biler/sub.jpg"; }elseif ($biler[$få] == "Skyline"){ $bilde= "bilder/biler/sky.jpg"; }elseif ($biler[$få] == "Farrari"){ $bilde= "bilder/biler/far.jpg"; }elseif ($biler[$få] == "Hummer H1"){ $bilde= "bilder/biler/hum.jpg"; }elseif ($biler[$få] == "TransAm"){ $bilde= "bilder/biler/tra.jpg"; }elseif ($biler[$få] == "Mini Cooper"){ $bilde= "bilder/biler/min.jpg"; }echo "<table width='65%' align='center'  border='1' bordercolor='#000000' cellspacing='0'>  <tr>	<th background='grad.jpg' scope='col'>Crime Success</th>  </tr>  <tr>	<td background='link.jpg'>You got away with a $biler[$få]!!</td>  </tr></table>";$time= time() + 4;if($biler[$få]=="Volvo 240"){$pris=rand(7000,12000);$skade=rand(13,23);}if($biler[$få]="Subaru Impresa"){$pris=rand(7000,15000);$skade=rand(13,32);}if($biler[$få]=="Skyline"){$pris=rand(7000,19000);$skade=rand(13,55);}if($biler[$få]="Farrari"){$pris=rand(7000,22000);$skade=rand(15,55);}if($biler[$få]="Hummer H1"){$pris=rand(7000,26000);$skade=rand(12,59);}if($biler[$få]="TransAm"){$pris=rand(8000,30000);$skade=rand(19,44);}if($biler[$få]="Mini Cooper"){$pris=rand(13000,60000);$skade=rand(10,23);}mysql_query("INSERT INTO `biler`(`id`,`bil`,`skade`,`pris`,`sted`,`eier`,`status`,`flyttetid`)VALUES('','$biler[$få]','$skade','$pris','$info->land','$brukernavn','0','')");mysql_query("UPDATE brukere SET antallgta=antallgta+1 WHERE brukernavn='$brukernavn'");}

    ->Kristian_C

  17. if($_POST['setsted'] && $_POST['sted']){$sted=$_POST['sted'];$postid=$_POST['postid'];$avisidse=mysql_query("SELECT id FROM avissider WHERE avis='$avis->navn'");$seaviss=(mysql_num_rows($avisidse));if($postid != $seaviss){echo"That newspaper is not yours.";}else{

    Anyone here that can see something wrong? :s ->Kristian_C

  18. I think that is possible but be alot of extra unneeded code. you would have to run a query to your database to store the field name into your varaible $artikkel before you run the query you just posted. But like i said basicly your sorta doing things twice when you can do it once just by using the field name instead of $artikkel and this putts more overhead on your server. if that makes any sense
    Hehe, think i understand, just used the regular update with alot of if's/elseif's insted :) hehe...Thanks->Kristian_C
×
×
  • Create New...