Jump to content

[SOLVED] Stuck ......


burnside

Recommended Posts

Can you please have a look at this..........

 

if ($_GET['justnews'] == "deletenews"){

mysql_query("DELETE FROM usernews WHERE id = '$id'");

}elseif($justnews == "deleteall"){

mysql_query("DELETE FROM usernews WHERE user = '$info[id]'");

}

if (!$_GET[action])

{

     

 

    $resul = mysql_query("SELECT * FROM usernews WHERE user='$info[id]' order by id DESC LIMIT 0,15");

}

if (mysql_num_rows($resul)>0)

{

echo "<b>News:<br></b>";

}

while ($news = mysql_fetch_array($resul)){

echo "[<a href=cont.php?justnews=deletenews&id=$news[id]>D</a>] $news[text]<br>";

}

if(mysql_num_rows($resul) > 1){

echo "[<a href=cont.php?justnews=deleteall>Clear News</a>]<br>";

}

 

 

i have glodal functions on but yet the script doesnt delete the post any ideas ..............?

Link to comment
Share on other sites

You have absolutely no error checking in your code. At the very least use...

 

mysql_query($query) or die(mysql_error();

 

and post the given error.

 

PS: Please enclode your code within [ code ] [ / code ] tags (no spaces) in future.

Link to comment
Share on other sites

my code might be a bit pants as i am a n00b at it only been at it past 2 -3 days code is as followed :

 <?php 
mysql_connect("localhost", "username", "password") or die(mysql_error()); 
mysql_select_db("database") or die(mysql_error()); 


//checks cookies to make sure they are logged in 
if(isset($_COOKIE['ID_my_site'])) 
{ 
$username = $_COOKIE['ID_my_site']; 
$pass = $_COOKIE['Key_my_site']; 
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); 
while($info = mysql_fetch_array( $check )) 
{ 

//if the cookie has the wrong password, they are taken to the login page 
if ($pass != $info['password']) 
{ header("Location: index.php"); 
} 
else 
{ 
$battlesfought = $info[lost] + $info[won] + $info[draw];
if($battlesfought == 0) {
$battlesfought += 1;
$zero = "yes";
}
$percentwon = ($info[won] / $battlesfought) * 100;
if($zero == "yes") { $battlesfought -= 1; }
$percentwon = sprintf ("%01.2f", $percentwon);

$battlesfought1 = $info[lost] + $info[won] + $info[draw];
if($battlesfought1 == 0) {
$battlesfought1 += 1;
$zero = "yes";
}
$percentlost = ($info[lost] / $battlesfought) * 100;
if($zero == "yes") { $battlesfought1 -= 1; }
$percentlost = sprintf ("%01.2f", $percentlost);

$battlesfought2 = $info[lost] + $info[won] + $info[draw];
if($battlesfought2 == 0) {
$battlesfought += 1;
$zero = "yes";
}
$percentdraw = ($info[draw] / $battlesfought) * 100;
if($zero == "yes") { $battlesfought2 -= 1; }
$percentdraw = sprintf ("%01.2f", $percentdraw);


// Hard shit this is like
$battlesfought = $info[lost] + $info[won] + $info[draw];
if($battlesfought == 0) {
$battlesfought += 1;
$zero = "yes";
}
$percentwon = ($info[won] / $battlesfought) * 100;
if($zero == "yes") { $battlesfought -= 1; }
$percentwon = sprintf ("%01.2f", $percentwon);
//lost
$battlesfought1 = $info[lost] + $info[won] + $info[draw];
if($battlesfought1 == 0) {
$battlesfought1 += 1;
$zero = "yes";
}
$percentlost = ($info[lost] / $battlesfought) * 100;
if($zero == "yes") { $battlesfought1 -= 1; }
$percentlost = sprintf ("%01.2f", $percentlost);
//stalemate
$battlesfought2 = $info[lost] + $info[won] + $info[draw];
if($battlesfought2 == 0) {
$battlesfought += 1;
$zero = "yes";
}
$percentdraw = ($info[draw] / $battlesfought) * 100;
if($zero == "yes") { $battlesfought2 -= 1; }
$percentdraw = sprintf ("%01.2f", $percentdraw);
include('top.php');
include('error.php');

echo ' Here at the brother hood, We keep track of every thing you do. ';


	echo ' <BR> <br> ';
// START OF IMAGE SHIT AND PHRASE 


echo " <img src =\"$info[image]\" alt ='This is curently you game logo'> <br> <a title ='$info[main_phase]' > Phrase One </a> | <a title ='$info[main_sub]'> Phrase Two </a><br>";

$now_then = array("$info[main_phase]","$info[main_sub]",);$hello_mate = $now_then[array_rand($now_then)];

echo " <font size ='5' color =gray><b><u><a title ='Your Current Phrase'> $hello_mate </font></u></b>";




echo "<Br>";
echo " <table align ='left' width =25%> <td> <font size =4><u>Player Stats</u></font> </table> ";

if($info[hp] <= 0) { echo " <img src=img\dead.gif alt='Unable to battle, You are Dead' > "; }
elseif($info[hp] > 0) { echo " <img src=img\alive.gif alt='Able to battle you have $info[hp]hit points left out of $info[maxhp]'>"; }

//WON

if($info[won] > 0 || $info[draw] > 0 || $info[draw] > 0) { echo "";} else {  }


$suckmycock = $info[won] + $info[lost] + $info[draw] ;


if ($action == "delete"){$request2 = "DELETE FROM usernews WHERE ID = $id";$result2 = mysql_query($request2,$db);}


if ($_GET['justnews'] == "deletenews"){
   mysql_query("DELETE FROM usernews WHERE id = '$id'");
}elseif($justnews == "deleteall"){
   mysql_query("DELETE FROM usernews WHERE user = '$info[id]'");
}
if (!$_GET[action])
{
      

    $resul = mysql_query("SELECT * FROM usernews WHERE user='$info[id]' order by id DESC LIMIT 0,15");
}
if (mysql_num_rows($resul)>0)
{
echo "News:
";
}
while ($news = mysql_fetch_array($resul)){
   echo "[<a href=cont.php?justnews=deletenews&id=$news[id]>D[/url]] $news[text]
";
}
if(mysql_num_rows($resul) > 1){
   echo "[<a href=cont.php?justnews=deleteall>Clear News[/url]]
";
}




include("bottom.php");
}}}?> 

it all word apart from the

 if ($_GET['justnews'] == "deletenews"){
   mysql_query("DELETE FROM usernews WHERE id = '$id'");
}elseif($justnews == "deleteall"){
   mysql_query("DELETE FROM usernews WHERE user = '$info[id]'");
}
if (!$_GET[action])
{
      

    $resul = mysql_query("SELECT * FROM usernews WHERE user='$info[id]' order by id DESC LIMIT 0,15");
}
if (mysql_num_rows($resul)>0)
{
echo "News:
";
}
while ($news = mysql_fetch_array($resul)){
   echo "[<a href=cont.php?justnews=deletenews&id=$news[id]>D[/url]] $news[text]
";
}
if(mysql_num_rows($resul) > 1){
   echo "[<a href=cont.php?justnews=deleteall>Clear News[/url]]
";
}

Link to comment
Share on other sites

Try....

 

if ($_GET['justnews'] == "deletenews"){
   mysql_query("DELETE FROM usernews WHERE id = '$id'") or die(mysql_error());
}elseif($justnews == "deleteall"){
   mysql_query("DELETE FROM usernews WHERE user = '$info[id]'") or die(mysql_error());
}

Link to comment
Share on other sites

Try:

 

if ($_GET['justnews'] == "deletenews"){
   mysql_query("DELETE FROM usernews WHERE id = '".$_GET['id']."'") or die(mysql_error());
}elseif($_GET['justnews']== "deleteall"){
   mysql_query("DELETE FROM usernews WHERE user = '$info[id]'") or die(mysql_error());
}

 

Unless you have register_globals turned on, then $justnews and $id are undefined. You need to retreive them from the $_GET array.

 

 

Link to comment
Share on other sites

what do they mean :

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 27

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 27

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 27

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 27

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 32

 

Notice: Undefined variable: zero in /home/b/l/blades_of_darkness_co_uk/cont.php on line 33

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 36

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 36

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 36

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 36

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 41

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 41

 

Notice: Undefined variable: zero in /home/b/l/blades_of_darkness_co_uk/cont.php on line 42

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 45

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 45

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 45

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 45

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 50

 

Notice: Undefined variable: zero in /home/b/l/blades_of_darkness_co_uk/cont.php on line 51

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 56

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 56

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 56

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 56

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 61

 

Notice: Undefined variable: zero in /home/b/l/blades_of_darkness_co_uk/cont.php on line 62

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 65

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 65

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 65

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 65

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 70

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 70

 

Notice: Undefined variable: zero in /home/b/l/blades_of_darkness_co_uk/cont.php on line 71

 

Notice: Use of undefined constant lost - assumed 'lost' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 74

 

Notice: Undefined index: lost in /home/b/l/blades_of_darkness_co_uk/cont.php on line 74

 

Notice: Use of undefined constant won - assumed 'won' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 74

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 74

 

Notice: Use of undefined constant draw - assumed 'draw' in /home/b/l/blades_of_darkness_co_uk/cont.php on line 79

 

Notice: Undefined variable: zero in /home/b/l/blades_of_darkness_co_uk/cont.php on line 80

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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