Jump to content

$php_mysql$

Members
  • Posts

    391
  • Joined

  • Last visited

    Never

Everything posted by $php_mysql$

  1. oh in my case i do not have registered users there is no login or register on my site its just come and post. how can i implant it for that?
  2. ok u mean while storing the data i even store their session in a row and use that session? can you please guide me to some simple examples? thanks soo much
  3. do you have any piece of code better than this one?
  4. friends whats wrong with this piece of code that one user on my site spams the same thing over and over tho i have added flood control for 6hours but he posts right after posting one. i have tested myself it works for me but why not for that user? if($_SESSION['last_session_request'] > time() - 21600){ header("location: antiflood.php?post=wait"); exit; } $_SESSION['last_session_request'] = time();
  5. i got that but why is it not executing my sql query? no matter what ever numeric value i input i get it printed by using print_r(); func but when i use $id = $_POST['id']; nothing prints <?php include 'db.php'; print_r($_POST['id']); if(isset($_POST['submit'])){ $id = $_POST['id']; // The $id is not effecting the sql query WHERE id='".$id."' $sql="SELECT `id`, `image` FROM `tbl` WHERE id='".$id."'"; $result = mysql_query($sql); if(!$result){ }else{ while($row = mysql_fetch_array($result)){ if (mysql_num_rows($result)) { $id = $row['id']; if(!unlink($row['image'])){ } } $sql="DELETE FROM tbl WHERE id = '".$id."'"; $result= mysql_query($sql); if(!$result){ } } } } ?> <form action="delete.php" method="POST"> <input type="text" name="id"> <input type="submit" value="Delete"> </form>
  6. something is still not right tho i made method to GET but nothing is happening in act=delete the values are not being executed there
  7. There lies your problem. still no value is being sent to act=delete i tried that too before
  8. Hey all whats wrong when i hit submit the numeric value which i enter is not being sent to act=delete <?php include 'db.php'; $act = $_GET["act"]; $id=$_GET["id"]; echo '<form action="delete.php?act=delete" method="post">'; echo '<input type="text" name="del">'; echo '<input type="submit" value="Delete">'; echo '</form>'; if($act=='delete'){ $id = $_GET['del']; $sql="SELECT `id`, `image` FROM `tbl` WHERE id='".$id."'"; $result = mysql_query($sql); if(!$result){ echo 'SELECT failed: '.mysql_error(); }else{ while($row = mysql_fetch_array($result)){ if (mysql_num_rows($result)) { $id = $row['id']; if(!unlink($row['image'])){ echo "unlink ".$row['image']." failed"; } } $sql="DELETE FROM tbl WHERE id = '".$id."'"; $result= mysql_query($sql); if(!$result){ echo 'DELETE from tbl with id '.$id.' failed: '.mysql_error(); } } } } ?>
×
×
  • 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.