-
Posts
2,527 -
Joined
-
Last visited
Everything posted by DeanWhitehouse
-
[SOLVED] delete entrys, using checkboxes?
DeanWhitehouse replied to DeanWhitehouse's topic in PHP Coding Help
ok, thanks , anyone know how to make a select all so it actually ticks the boxes, would that be ajax? -
[SOLVED] delete entrys, using checkboxes?
DeanWhitehouse replied to DeanWhitehouse's topic in PHP Coding Help
ok, i am using this code and it isn't deleting anything <?php if(isset($_POST['delete'])) { foreach($_POST['checkB'] as $checked) { mysql_query("DELETE FROM darkflame_news WHERE id='{$checked}'") or die("Error:" . mysql_error()); } } if(isset($_GET['delete_news'])) { ?> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> <table class="news_profile"><tr><th>Delete News</th><td class="delete">Delete</td></tr><tr><td align="left"> <?php //No ID passed to page, display user list: if($_SESSION['lang_en'] == true) { $query = "SELECT id, name, content, time FROM darkflame_news ORDER BY id DESC LIMIT 5"; } else { $query = "SELECT id, name, content, time FROM darkflame_news_ru ORDER BY id DESC LIMIT 5"; } $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $content = $row['content']; $cont = wordwrap($content, 118, "<br />", true); echo "<b>".$row['time']."</b>"; ?> - <a href="?news_id=<?php echo $row['id']; ?>"><?php echo $row['name']; ?></a></td><td><input type="checkbox" value="1" name="checkB[]" /></td></tr><tr align="left"><td><?php echo nl2br(stripslashes($cont));; ?></td></tr> <?php } } if($_SESSION['lang_en'] == true) { if (mysql_num_rows($result) < 1) { echo "No News To Display. <br>Keep Checking Back<br>"; } if (mysql_num_rows($result) > 5) { echo "<br><a href='?news_all'>All News</a>"; } } if($_SESSION['lang_ru'] == true) { if (mysql_num_rows($result) < 1) { echo "(in russian)No News To Display. <br>Keep Checking Back<br>"; } if (mysql_num_rows($result) > 5) { echo "<br><a href='?news_all'>More News</a>"; } } ?> </td></tr><tr><td><input type="submit" name="delete" value="Delete Selected"></td></tr></table> <?php exit(); } ?> -
i use it now and then
-
how can i have people select entry's to delete with checkboxes, how would i check to see what entry to delete? this is what i have so far <?php if(isset($_POST['delete'])) { $newname = mysql_real_escape_string($_POST['newname']); $newcontent = mysql_real_escape_string($_POST['newcontent']); $runame = mysql_real_escape_string($_POST['ru_name']); $rucont = mysql_real_escape_string($_POST['ru_content']); if ($newname && $newcontent) { mysql_query("INSERT INTO `darkflame_news` (id, name, content, time) VALUES( '','$newname','$newcontent', '$date')") or die('Error ' . mysql_error()); echo "<tr><td>News Saved</td></tr>"; if ($runame && $rucont) { mysql_query("INSERT INTO `darkflame_news_ru`(id, name, content, time) VALUES( '','$runame','$rucont', '$date')") or die('Error ' . mysql_error()); } } elseif (!newname.newcontent) { echo "<tr><td>Please Fill In The Required Fields</td></tr>"; } } if(isset($_GET['delete_news'])) { ?> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"> <table class="news_profile"><tr><th>Delete News</th><td class="delete">Delete</td></tr><tr><td align="left"> <?php //No ID passed to page, display user list: if($_SESSION['lang_en'] == true) { $query = "SELECT id, name, content, time FROM darkflame_news ORDER BY id DESC LIMIT 5"; } else { $query = "SELECT id, name, content, time FROM darkflame_news_ru ORDER BY id DESC LIMIT 5"; } $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $content = $row['content']; $cont = wordwrap($content, 118, "<br />", true); echo "<b>".$row['time']."</b>"; ?> - <a href="?news_id=<?php echo $row['id']; ?>"><?php echo $row['name']; ?></a></td><td><input type="checkbox" name="delete<?php echo $row['id']; ?>"></td></tr><tr align="left"><td><?php echo nl2br(stripslashes($cont));; ?></td></tr> <?php } } if($_SESSION['lang_en'] == true) { if (mysql_num_rows($result) < 1) { echo "No News To Display. <br>Keep Checking Back<br>"; } if (mysql_num_rows($result) > 5) { echo "<br><a href='?news_all'>All News</a>"; } } if($_SESSION['lang_ru'] == true) { if (mysql_num_rows($result) < 1) { echo "(in russian)No News To Display. <br>Keep Checking Back<br>"; } if (mysql_num_rows($result) > 5) { echo "<br><a href='?news_all'>More News</a>"; } } ?> </td></tr><tr><td><input type="submit" name="delete" value="Delete Selected"></td></tr></table> <?php exit(); } ?>
-
How to convert a time stamp to a date in mysql
DeanWhitehouse replied to ballhogjoni's topic in PHP Coding Help
it works fine for me -
mysql_connect does not need to be a vairable, just add or die after it and then the script won't work if it can't connect
-
it's for printable wedding invitations, that have the details you entered on it , and you can print it off with your details on it
-
will that print the text on the image, if i print it ? and if so anyone know where i can learn to do this
-
put this at the beggining ob_start();
-
anyone?
-
yer, please select topic solved at the bottom if it is.
-
or find a free encoder on the net, and encoded the bit with that , my advice is that you encoded a bit more ,something that is required for the page to work, or something that will display an error if it is not there
-
How to convert a time stamp to a date in mysql
DeanWhitehouse replied to ballhogjoni's topic in PHP Coding Help
instead of using a mysql timestamp, y not insert a php date variable into the database e.g. $time_stamp = date("d.m.Y"); $date = $time_stamp; -
if you do this it won't be browser friendly, but what you do is on the page where it redirects to , put <META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://downloadname.com"> then after that header("http://address to go to"); is this what u want?? you may need to add ob_start(); at the beggining
-
is it possible to burn information from a database to an image, so it can be printed on the image?? printed as in printing using a printer
-
this is blank value="" you need a value
-
succes, thanks for all the help
-
this <pre> <?php print_r($ban); ?> </pre> prints the same thing Resource id #4 this is my whole section <?php if (isset($_GET['add_gbookentry'])) { if(isset($_POST['add'])) { $name = mysql_real_escape_string($_POST['name']); $message = mysql_real_escape_string($_POST['message']); $email = mysql_real_escape_string($_POST['email']); $website = mysql_real_escape_string($_POST['website']); $ip = $_SERVER['REMOTE_ADDR']; $query = "SELECT * FROM darkflame_ban WHERE `ip`='$ip' LIMIT 0,1"; $ban = mysql_query($query) OR die(mysql_error()); ?><pre> <?php print_r($ban); ?> </pre> <?php echo "$ban<br>"; echo "$ip<br>"; if ($ban) { echo "Enough spamming<br>Your Posting Rights Have Been Suspended, contact the administrator if you think it is a mistake"; exit(); } elseif($name && $message) { mysql_query("INSERT INTO `darkflame_gbook` (id, time, ip, content, email, name, website) VALUES( '','$date','$ip', '$message', '$email', '$name' ,'$website')") or die('Error ' . mysql_error()); ?> <p><a href="guestbook.php">View Guestbook</a></p> <?php echo "Entry Added"; exit(); } else { echo "Please Fill In All The Fields"; } } ?> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">Name: <input type="text" name="name" /><br />Email: <input type="text" name="email" /><br />Website: <input type="text" name="website" /><br />Message:<textarea name="message" cols="50" rows="10" title="Your Message Here"></textarea><br /><input type="submit" value="Submit" name="add" /></form> <?php exit(); } ?>
-
using this code $query = "SELECT * FROM darkflame_ban WHERE `ip`='$ip' LIMIT 0,1"; $ban = mysql_query($query) OR die(mysql_error()); echo "$ban<br>"; echo "$ip<br>"; if ($ban) { echo "Enough spamming<br>Your Posting Rights Have Been Suspended, contact the administrator if you think it is a mistake"; exit(); } it count's everyone as banned, i am echoing to try and debug it, $ban echoes Resource id #4 any help?
-
what about ,giving a link in an email to something like ?itemnumber=&userid= and then have a get on the page, setting a session then if the session is there, let them download it?? i would also add a random number to the link , so that they can only use it once
-
[SOLVED] Help with a Quote of the Day script.
DeanWhitehouse replied to ExTouch's topic in PHP Coding Help
(Right Click: Safari - Download Linked File As... , Firefox - Save file as... [i think] , IE - Save File As...) won;t work, as it would be a big internet security risk how are you storing the quotes?? what is the actaul question?? -
i searched for how to upload video to website php tutorials and a large number of similar ones thanks for the posts
-
[SOLVED] Help with recognizing if we are logged in or not..
DeanWhitehouse replied to Cory94bailly's topic in PHP Coding Help
you haven't made an IF statement //If the cookie exists, show the "Logout" button. { ?> <a href="logout.php">Logout</a> <? } should be //If the cookie exists, show the "Logout" button. if(cookie_name) { ?> <a href="logout.php">Logout</a> <? } -
ok, i can't find a tutorial , only ones on how to convert before uploading and ones that offer software to do it
-
where do you think i found out about needing flash, i am asking if there is another way, as i don't read site listed on google, but from what i have seen the majority mention flash,