Jump to content

[SOLVED] Stuck ......


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
https://forums.phpfreaks.com/topic/62330-solved-stuck/
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
https://forums.phpfreaks.com/topic/62330-solved-stuck/#findComment-310153
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
https://forums.phpfreaks.com/topic/62330-solved-stuck/#findComment-310180
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
https://forums.phpfreaks.com/topic/62330-solved-stuck/#findComment-310191
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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