Jump to content
xisto Community

sonesay

Members
  • Content Count

    958
  • Joined

  • Last visited

  • Days Won

    5

sonesay last won the day on January 25 2011

sonesay had the most liked content!

About sonesay

  • Rank
    |||[ n00b King ]|||

Contact Methods

  • Website URL
    http://si3.freeiz.com/

Profile Information

  • Gender
    Male
  • Location
    Auckland
  1. Does your while loop work? That's the first time I've seen variables being assigned that way in your loop. There is also a problem with your 'localhost'. it should be a string not just localhost which is a constant undefined. no $ symbol means it will look for the constant localhost. This is how I would of done it <?php$username="mrdee";$password="**********";$database="mrdee_reloader";mysql_connect('localhost',$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query="SELECT * FROM rouw";$result=mysql_query($query);// loop through array and output till its finishedwhile($row = mysql_fetch_assoc($result)) { echo $row["Name"] . "<br />"; echo $row["Town"] . "<br />"; echo $row["Email"] . "<br />";}?>You will need to place the while loop where you desire the output to occur. This would be in your html page etc.
  2. What version of php are you using? The warnings happen because your php version is much newer than what the script was designed for. Your script uses old methods so its not fully compatable or not supported with the current version of php. I'm still not 100% sure on what depreciation actually means but it could just mean it does still work but will probably not continue to work in further releases of php so the warning is displayed. I think you can try removing theses types of warning in your php settings. I did a quick search and one some examples you can try .. http://forums.cacti.net/about36427.html For all of you using PHP 5.3:Edit your php.ini and set error_reporting to:Code:error_reporting = E_ALL & ~E_DEPRECATEDAfter that edit /cacti/include/global.php and change line 196 fromCode:error_reporting(E_ALL);toCode:error_reporting(E_ALL ^ E_DEPRECATED);Do exactly the same in line 312 of file adodb-time.inc.php located in /cacti/lib/adodbNow restart your web server and you will see that all "deprecated" messages will be successfully suppressed.Best regards-Andreas- Try setting the error warnings to ignore deprecated errors. You can probably ignore the other lines where it tells you to find the error_reporting() to set as it only applies to their specific scripts so with your own you need to locate where ever your error reporting scripts are set specific to your scripts. So it should be in two places your php.ini and where ever it is set in your php script as it will overwrite the php.ini setting.
  3. I had a look at the example link where you are using as a guide. Your main problem is it has no styles correct? I think this is probably due to a setting you've set in the first snipplet of code <?php // turn off WordPress themes and include the WordPress core: define('WP_USE_THEMES', false); require($_SERVER['DOCUMENT_ROOT'] . '/wordpress/wp-blog-header.php');?> I'm guessing the WP_USE_THEMES = false will cause wp to output your content in just plain text. I have no personal experince of word press my self so I am only guessing that is what is happen. If that is the case then maybe you can try turn it on just to see the effect. If that still does not do what you need then it may look like you need to somehow create your own CSS to format it. You can probbaly do this by getting at your table container and selecting what ever child elements underneath it to style it as you please. Could you possible paste the entire html code generated by your page I would be interested to see what it actually outputs.
  4. This sounds like a very bad and common problem. I can give you some insight as I was once addicted to MMORPG myself. The more you let him get away with being a slob the worse it will get. Eventually it may get to the point where its so bad he will start giving up on everything all together or it might actually make him realize how much of a time hes wastes either way it will take too long and waste more valuable time. You say hes 24 that's the age you should be changing from a kid to and adult already. I know people are all different but generally by that age you should be old enough to take care of your self. I know a lot of people who grow up and are responsible when they are 20 and it amazes me. I wonder what makes them different from me and why at that age I was lost and messed up. It has to do with parenting I think. If you had raised your kid well and taught them good qualities like hard work and responsibilities then they would not end up like this. I have to say my parents were not the best being not very educated they still have no idea on how to be a parent or what parenting is. To this day it causes problems in the family when there is an argument and no one is willing to concede thinking they are the only ones right. You cannot go through live having kids and not teaching them good values and then expect them to turn out right when they are adults it does not work that way. I think a lot of parents fail this way because they don't know what parenting really is. My little brother has the same problem he is 11 and all he thinks about is games. I know its up to me to teach him because my parents wont do it. They are too concerned about their own life to really be parents. My only suggestion for you is to take it upon yourself to help your brother out. You have to find a way to make him see the light its not going to be easy but if you don't do it who will? Your his brother and true you may have your own life but it will take sacrifice if you love him enough you will do what ever it takes to help him. Your brother is probably also feeling a lot of helplessness and wondering why things arn't working out so he gives up trying. Nothing comes out good without putting in hard work and he should expect to fail many times before he success but if he does not change then the outcome surely will not be any different. Another problem is if your mum is letting him stay for free then its easy for him to be lazy. Kicking him out might sound bad but its probably the best thing and the only thing that will get him to do something about his situation. It may seem harsh to do such a thing to family but its not. I wish you the best of luck with your brother.
  5. What did you do to fix it? If it was just a power cable issue where it was not connected properly then it should be a simple fix. By the looks of it, it seems like a power issue when you say it has no power. Either that or the cd unit has shorted and no longer functions but I've never heard of any cases where that's happen before.
  6. I like the idea but I think it should be up to them whether they are subject to testing or not. Even though they are prisoners they are still human and their rights should not be taken away. We should not be forcing anything on anyone and the day we start doing that is the day we begin losing our freedom (if we even had it to begin with). This world is already messed up as it is (probably has always been) and the only way to make things better is to educate more people so they aren't just sheep being manipulated and used by the elites but be able to think and speak out on their own.
  7. sonesay

    Header Error

    The reason for that error is because you have already began outputting HTML code so redirecting after that point is not possible. You can move your whole PHP code block to the top before you begin your HTML output and it should work. <?php// Set Global Vars$HOST = "";$USERNAME = "";$PASSWORD = "";$DATABASE = "";$TABLE = "";// Establish a connectionmysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());mysql_select_db($DATABASE) or die(mysql_error());//==================================================================// Check if anything is posted//==================================================================if (isset($_POST['delete'])) { $sql = ("delete from $TABLE where "); for ($i = 0; $i < count($_POST['checkbox']); $i++) { if ($i != 0) { $sql.= "OR "; } $sql .= " id='" . $_POST['checkbox'][$i] . "'"; //================================================================== // Select file to unlink based on id posted //================================================================== $sql_file_unlink = "select Download from $TABLE where id = {$_POST['checkbox'][$i]}"; $result_file_unlink = mysql_query($sql_file_unlink); $row_file_link = mysql_fetch_assoc($result_file_unlink); if($row_file_link) { unlink('../testimonial_files/' . $row_file_link['Download']); } //================================================================== } $result = mysql_query($sql); header('Location: index.php'); exit;} else { // select sql here $sql = "select * from `$TABLE` order by `id`;"; $result = mysql_query($sql);}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Testimonials</title><link href="../style.css" rel="stylesheet" type="text/css" /><link href="uploadify/uploadify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="uploadify/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="uploadify/swfobject.js"></script> <script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#file_upload').uploadify({ 'uploader' : 'uploadify/uploadify.swf', 'script' : 'uploadify/uploadify.php', 'cancelImg' : 'uploadify/cancel.png', 'folder' : '../testimonial_files', 'auto' : true }); }); </script> </head><body><div class="container"> <div class="header"><br /><br /><br /> </div> <div class="sidebar1"> <ul class="nav"><b> <li><a href="../">Home</a></li> <li><a href="/admin/">Testimonials upload</a></li> <li><a href="audio/">Audio Testimonials upload</a></li> <li><a href="dvds/">Dvd's upload</a></li> <li><a href="newsletter/">Newsletter upload</a></li> <li><a href="news/">News box update</a></li> </b></ul></div> <div class="content"> <center><h2>Admin</h2></center> <br /><center><p><input id="file_upload" name="file_upload" type="file" /></p><p><table width="200" border="0"><form action="insert_test.php" method="post"> <tr> <td align="right">Name:</td> <td><input type="text" name="Name" /></td> </tr> <tr> <td align="right">Description:</td> <td><input type="text" name="Message" /></td> </tr> <tr> <td align="right">Download:</td> <td><input name="Download" type="text" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit" /></td> </tr></form></table></p><br /><br /><p><table align="center" width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td colspan="6" align="center"><strong>Testimonials</strong> </td> </tr> <tr> <td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <table width="400" border="1" cellpadding="3" cellspacing="1"> <tr> <td align="center"><strong>Select</strong></td> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>Description</strong></td> <td align="center"><strong>Download</strong></td> <td align="center"><strong>Last Modified</strong></td> </tr><?php $row = mysql_fetch_assoc($result); ?><?php do { ?> <tr> <td align="center"> <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>"> </td> <td align="center"><?php echo $row['id']; ?></td> <td align="center"><?php echo $row['Name']; ?></td> <td align="center"><?php echo $row['Message']; ?></td> <td align="center"><a href="../testimonial_files/<?php echo $row['Download']; ?>">Download</a></td> <td align="center"><?php echo date("j/n/y", strtotime($row["Modified"])) ?></td> </tr> <?php } while ($row = mysql_fetch_assoc($result)); ?> <tr> <td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> </table> </form> </td> </tr> </table></p></center></div> <div class="sidebar2"> <h4>Text here</h4> <p> </p> </div> <div class="footer"> <center><p>Š Copyright 2010</p></center> </div> </div></body></html>
  8. Hey thanks for uploading the files. Unfortunately there has always been this problem with me not being able to download files from there. Any ideas why it happens?
  9. Yeah your right. I didn't look at the entire code and just pasted the whole block in. the unlink('../admin/testimonial_files/' . $row['Download']); line you can delete I think because its not needed? if you look at http://php.net/manual/en/function.unlink.php this method deletes a file and I don't remember you mentioning there was any files you also needed deleting. If you do need to delete a file as well then you can paste that line back into the loop block. Edit: I just looked at your code again and by the looks of it you only want to be deleting (unlinking) the file if the user submits a delete post right? If that is the case then you would need to do: <?php// Set Global Vars$HOST = "database";$USERNAME = "sonint99";$PASSWORD = "C2sHF9Zxq3ULXCTV";$DATABASE = "Random";$TABLE = "Testimonials";// Establish a connectionmysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());mysql_select_db($DATABASE) or die(mysql_error());//==================================================================// Check if anything is posted//==================================================================if (isset($_POST['delete'])) { $sql = ("delete from $TABLE where "); for ($i = 0; $i < count($_POST['checkbox']); $i++) { if ($i != 0) { $sql.= "OR "; } $sql .= " id='" . $_POST['checkbox'][$i] . "'"; //================================================================== // Select file to unlink based on id posted //================================================================== $sql_file_unlink = "select Download from $TABLE where id = {$_POST['checkbox'][$i]}"; $result_file_unlink = mysql_query($sql_file_unlink); $row_file_link = mysql_fetch_assoc($result_file_unlink); if($row_file_link) { unlink('../admin/testimonial_files/' . $row_file_link['Download']); } //================================================================== } $result = mysql_query($sql); header('Location: index.php'); exit;} else { // select sql here $sql = "select * from `$TABLE` order by `id`;"; $result = mysql_query($sql);}?><table align="center" width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td colspan="6" align="center"><strong>Testimonials</strong> </td> </tr> <tr> <td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <table width="400" border="1" cellpadding="3" cellspacing="1"> <tr> <td align="center"><strong>Select</strong></td> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>Description</strong></td> <td align="center"><strong>Download</strong></td> <td align="center"><strong>Last Modified</strong></td> </tr> <?php $row = mysql_fetch_assoc($result); ?><?php do { ?> <tr> <td align="center"> <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>"> </td> <td align="center"><?php echo $row['id']; ?></td> <td align="center"><?php echo $row['Name']; ?></td> <td align="center"><?php echo $row['Message']; ?></td> <td align="center"><a href="/admin/testimonial_files/<?php echo $row['Download']; ?>">Download</a></td> <td align="center"><?php echo $row['Modified']; ?></td> </tr> <?php } while ($row = mysql_fetch_assoc($result)); ?> <tr> <td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> </table> </form> </td> </tr> </table><?php I hope that's what you wanted. I removed some variables as it seems like they arnt being used like the delete id from the submit button.
  10. Can you give a full description of all tables involved? i.e the tables used by the Flash survey script and its records. Any other tables you intend to use. This will make writing example code more accurate and also provide us a better understanding of the database.
  11. Do you have an example link to show some examples of how it is done? I am asking because I dont have time to search for it maybe if I can see a direct example I can help you out but at this stage I have no idea how the Flash survey works with php.
  12. Yeah I thought that's what you wanted but I wasn't too sure so I had to ask. all the code for the part where you delete needs to go in the correct if block in your statement. The part where you query for your result and use it in the mysql_fetch_assoc() needs to go in the else block. Try this: <?php// Set Global Vars$HOST = "XXXXXXX";$USERNAME = "XXXX";$PASSWORD = "XXXXX";$DATABASE = "XXXXX";$TABLE = "Testimonials";// Establish a connectionmysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());mysql_select_db($DATABASE) or die(mysql_error());if (isset($_POST['delete'])) { // delete sql here $DELETE_ID = mysql_real_escape_string($_POST['delete']); unlink('../admin/testimonial_files/' . $row['Download']); $sql = ("delete from $TABLE where "); for ($i = 0; $i < count($_POST['checkbox']); $i++) { if ($i != 0) { $sql.= "AND "; } $sql .= " id='" . $_POST['checkbox'][$i] . "'"; } $result = mysql_query($sql); header('Location: index.php'); exit;} else { // select sql here $sql = "select * from `$TABLE` order by `id`;"; $result = mysql_query($sql);}?><table align="center" width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <table width="400" border="1" cellpadding="3" cellspacing="1"> <tr> <td colspan="6" align="center"><strong>Testimonials</strong> </td> </tr> <tr> <td align="center"><strong>Select</strong></td> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>Description</strong></td> <td align="center"><strong>Download</strong></td> <td align="center"><strong>Last Modified</strong></td> </tr><?php $row = mysql_fetch_assoc($result); ?><?php do { ?> <tr> <td align="center"> <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>"> </td> <td align="center"><?php echo $row['id']; ?></td> <td align="center"><?php echo $row['Name']; ?></td> <td align="center"><?php echo $row['Message']; ?></td> <td align="center"><a href="/admin/testimonial_files/<?php echo $row['Download']; ?>">Download</a></td> <td align="center"><?php echo $row['Modified']; ?></td> </tr> <tr> <td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> </table> </form> </td> </tr> </table><?php } while ($row = mysql_fetch_assoc($result)); ?>
  13. What is your page suppose to be doing exactly? From the looks of it you are checking if there are any submissions for delete. If there are none which is mostly the case when you frist visit the page then that block is always going to execute. Which explains why the rest of the code fails because the block of code that assigns the $result1 variable never gets executed. You might want to change your if statements around appropriately. if(!isset($_POST['delete'])) {$sql = "select * from `$TABLE` order by `id`;";} else {$DELETE_ID = mysql_real_escape_string($_POST['delete']);echo("select * from `$TABLE` where `id` = '$DELETE_ID';");die();// Delete the file on the diskunlink('../admin/testimonial_files/'.$row['Download']);// Build your query, kind of weird but alright.$sql = ("delete from $TABLE where ");for($i=0;$i<count($_POST['checkbox']);$i++){if($i != 0) { $sql.= "AND "; }$sql .= " id='" . $_POST['checkbox'][$i] . "'";} if you do if(!isset($_POST['delete'])) {$sql = "select * from `$TABLE` order by `id`;";die("post delete not set");} else {$DELETE_ID = mysql_real_escape_string($_POST['delete']);echo("select * from `$TABLE` where `id` = '$DELETE_ID';");die("result should be set here");// Delete the file on the diskunlink('../admin/testimonial_files/'.$row['Download']);// Build your query, kind of weird but alright.$sql = ("delete from $TABLE where ");for($i=0;$i<count($_POST['checkbox']);$i++){if($i != 0) { $sql.= "AND "; }$sql .= " id='" . $_POST['checkbox'][$i] . "'";} that should tell you where its executing.
  14. That's very strange. Can you post your entire script again if its changed a lot? There should be some kind of output or error if something is wrong. Is anything being reported? The only other way to figure it out is to keep going back up a line and outing echo statements to make sure it the code actually reaches that point. You need to figure out exactly where it dying before you can resolve any issues.
  15. Try it here. $DELETE_ID = mysql_real_escape_string($_POST['delete']);$result1 = mysql_query("select * from `$TABLE` where `id` = '$DELETE_ID';");$row = mysql_fetch_assoc($result1);mysql_close($result1);// change to $DELETE_ID = mysql_real_escape_string($_POST['delete']);echo("select * from `$TABLE` where `id` = '$DELETE_ID';");die();
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.