Jump to content

calvinschools

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Everything posted by calvinschools

  1. thats a good idea. Im going to try that. Again thanks so much for all the help. You have no idea how much i appreciate it. If anything else and hopefully there wont be, I'll save it for tomorrow. I think I need to take a break than look at everything again because its all become one big mess of code to me. I'll talk to you later. Thanks
  2. I think it may be time to stop. Either that or I'm going to smash my computer. BAD PHOTO ID. I have no idea what else to do. First it was the header changed that than it's back to Bad photo id.
  3. im sorry man but I'm just way too confused right now. My brain feels like it gonna ooze out through my ears. I put this in still bad photo id but I'm pretty sure the query is wrong. I'm not fully grasping this part. Sorry for being a pain. We've been on this for so long <?php header("Location: image_show.php?id={$row_Recordset1['id']}"); require('connect.php'); mysql_select_db($database_con, $con); $query= mysql_query( "SELECT `id` FROM photo"); $row_id = mysql_fetch_assoc($query); $deleteid=$_GET['id']; mysql_query("DELETE FROM comment WHERE id='$deleteid'") or die(mysql_error()); ?>
  4. now i'm confused. rewrite which query? my head is starting to hurt.Are you saying put another query in delete.php or re-write the main one? Sorry
  5. from here: Irealized im using to different connect scripts myconn.php and connect.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>The List</title> <style type="text/css"> #a { text-decoration: none; } </style> </head> <body> <div id="header"></div> <?php require_once('myconn.php'); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_Recordset1 = 40; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; mysql_select_db($database_myconn, $myconn); //Added ID $query_Recordset1 = "SELECT `id`, `name`, `photopath`, `state` FROM photo ORDER BY `name` ASC"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $myconn) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?> <div id="photos"> <table border="1" bordercolor="#000000"> <?php $i=0; $numperpage=10; ?> <?php do { ?> <?php if ($i%$numperpage==0) echo "<tr>"; ?> <td align="center"> <a href="image_show.php?id=<?php echo $row_Recordset1['id'];?>"><img src='<?php echo $row_Recordset1['photopath'] ;?>' height="100" width="100"/></a> <br/> <?php echo $row_Recordset1['name']; ?><br/> <?php echo $row_Recordset1['state']; ?></td> <?php $i++; if ($i%$numperpage==0) echo "</tr>"; ?> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> </table> </div> </body> </html> <?php mysql_free_result($Recordset1); ?> </body> </html>
  6. here's the image_show.php where the thumbnail is dragged into: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>What do you know about.......</title> <style type="text/css"> #What { text-align: center; } </style> </head> <body> <?php $hostname='g $username='g29'; $password='gw1!'; $dbname='yg $usertable='g mysql_connect('g!') or die(mysql_error()); mysql_select_db("g") or die(mysql_error()); $id = (int)$_GET['id']; if( $id > 0 ) { $result = mysql_query("SELECT `name`, `photopath`, `state` FROM `photo` WHERE `id` = $id") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo " <img src=\"{$row['photopath']}\" height=\"400px\" width=\"350px\" />". "<br /> "; echo $row['name']. "\n". "<br/>"; echo $row['state']. "\n"; } else { echo 'BAD PHOTO ID'; } ?> <?php $hostname='gm'; $username='yg; $password='g; $dbname='g'; $usertable='g $myconn=mysql_connect('your17iue.com', 'yi9', 'Ai!') or die(mysql_error()); mysql_select_db("iu") or die(mysql_error()); $name=$_POST['name']; $comment=$_POST['comment']; $submit=$_POST['submit']; if($submit) { if($name&&$comment) { $query=mysql_query("INSERT INTO comment (id,name,comment) VALUES ('','$name','$comment')"); } else { echo "Please fill out all the fields."; } } $query_Recordset1 = "SELECT * FROM photo WHERE id=$id"; $Recordset1 = mysql_query($query_Recordset1) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); ?> <body> <div id="comments"> <form method="POST" action="image_show.php?id=<?php echo $row_Recordset1['id'];?>"> <label>Name: </label><br /><input type="text" name="name" value="<?php echo "$name" ?>" /><br /><br /> <label>Comment: </label><br /><textarea name="comment" cols="25" rows="7"></textarea><br /><br /><br /> <input type="submit" name="submit" value="Comment" /><br /> </form></div> <?php $query=mysql_query("SELECT * FROM comment ORDER BY id DESC"); while($rows=mysql_fetch_assoc($query)) { $id=$rows['id']; $name=$rows['name']; $comment=$rows['comment']; $linkdel="<a href=\"delete.php?id=" . $rows['id'] . "\">Delete User</a>"; echo '<font color="red">Name:</font> ' . $name . '<br />' . '<br />' . '<font color="red">Comments:</font> ' . '<br />' . $comment . '&nbsp' . '&nbsp' . '&nbsp' . '&nbsp' . $linkdel . '<br />' . '<br />' . '<hr size="5px" width="500px" color="blue" />' ; } ?> </body> </html> and heres the delete.php <?php header("Location: image_show.php?id={$row_Recordset1['id']}"); require('connect.php'); $deleteid=$_GET['id']; mysql_query("DELETE FROM comment WHERE id='$deleteid'") or die(mysql_error()); ?> i was thinking of putting something like this in delete.php "<img src={$row_Recordset1['photopath']}"; not sure
  7. this is the view source. or do you want other code? The bad photo id comes after the comment is deleted. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>What do you know about.......</title> <style type="text/css"> #What { text-align: center; } </style> </head> <body> BAD PHOTO ID<body> <div id="comments"> <form method="POST" action="image_show.php?id="> <label>Name: </label><br /><input type="text" name="name" value="" /><br /><br /> <label>Comment: </label><br /><textarea name="comment" cols="25" rows="7"></textarea><br /><br /><br /> <input type="submit" name="submit" value="Comment" /><br /> </form></div> <font color="red">Name:</font> andrew<br /><br /><font color="red">Comments:</font> <br />asshole &nbsp&nbsp&nbsp&nbsp<a href="delete.php?id=55">Delete User</a><br /><br /><hr size="5px" width="500px"
  8. ok the messages are deleting. the header was below everything. completely forgot it has to be above before anything gets sent. but still get a bad photo id. The messages are deleting now though. One more thing and we can put this to rest.
  9. no database selected but here is my connect.php include <? $con = mysql_connect('a','a','a'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('a'); ?> i feel i'm insulting you when i take out the db info especially after all the times you've helped.
  10. i added {} around row syntax error is gone but when i delete no deletion and back to bad photo id. <?php require('connect.php'); $deleteid=$_GET['id']; mysql_query("DELETE FROM comment WHERE id='$deleteid'"); header("Location: image_show.php?id={$row_Recordset1['id']}"); ?>
  11. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/20/7812420/html/delete.php on line 5
  12. thats how i wrote it as well but keep getting syntax errors <?php require('connect.php'); $deleteid=$_GET['id']; mysql_query("DELETE FROM comment WHERE id='$deleteid'"); header("Location: image_show.php?id=$row_Recordset1['id']"); // dont know what syntax error ?>
  13. should i be putting this in a header? header because I'm getting syntax errors when I add "image_show.php?id=<?php echo $row_Recordset1['id'];?>"
  14. no problem. as for the delete function. the redirect needs to be changed to this page? [code] "image_show.php?id=<?php echo $row_Recordset1['id'];?>" is that correct because I can't get the syntax right.
  15. ok i got it. had to change the query. added "WHERE id=$id $query_Recordset1 = "SELECT * FROM photo WHERE id=$id"; now to just get the delete function working.
  16. i just saw that in the view source the id=32 when the url reads id=46 on same page.
  17. ok im back I had to run out. the ids are coming from the db. but why default to that certain photo? Im gonna try a few things.
  18. hey man. Thanks for coming back. SO i changed that code ran it posted a comment and now instead of getting bad photo id when publishing a comment the url defaults back. example: before php?id=46 after posting: php?id=32 defaults to this photo regardless of the thumbnail clicked but at least there's a photo,right? when you click delete thats when you get a bad photo id
  19. thanks for the help fugix. I'll see if I can get this working tomorrow. Later
  20. it would probably be faster for you to google "contact forms php" then for someone to write one for you. There are a million forms you can copy and paste and tutorials on youtube.
  21. did you want me to change all this: $query_Recordset1 = "SELECT `id`, `name`, `photopath`, `state` FROM photo ORDER BY `name` ASC"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $myconn) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = $_GET['totalRows_Recordset1']; } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?> or just this part: $query_Recordset1 = "SELECT `id`, `name`, `photopath`, `state` FROM photo ORDER BY `name` ASC"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $myconn) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); tried it and same old bad photo id but thats with only changing the 5 lines of code above
  22. this could be another problem: this is the comment success page <?php header("Location: image_show.php"); ?>
  23. its the original post: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>What do you know about.......</title> <style type="text/css"> #What { text-align: center; } </style> </head> <body> <?php $hostname='yoddce.com'; $username='yd29'; $password='Ad1!'; $dbname='d9'; $usertable='do'; mysql_connect('yourdddd!') or die(mysql_error()); mysql_select_db("d") or die(mysql_error()); $id = (int)$_GET['id']; if( $id > 0 ) { $result = mysql_query("SELECT `name`, `photopath`, `state` FROM `photo` WHERE `id` = $id") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo " <img src=\"/{$row['photopath']}\" height=\"400px\" width=\"350px\" />". "<br /> "; echo $row['name']. "\n". "<br/>"; echo $row['state']. "\n"; } else { echo 'BAD PHOTO ID'; } ?> <?php $hostname='dm'; $username='yd'; $password='d1!'; $dbname='d9'; $usertable='dto'; $myconn=mysql_connect('yddd!') or die(mysql_error()); mysql_select_db("dd") or die(mysql_error()); $name=$_POST['name']; $comment=$_POST['comment']; $submit=$_POST['submit']; if($submit) { if($name&&$comment) { $query=mysql_query("INSERT INTO comment (id,name,comment) VALUES ('','$name','$comment')"); } else { echo "Please fill out all the fields."; } } $query_Recordset1 = "SELECT `id`, `name`, `photopath`, `state` FROM photo ORDER BY `name` ASC"; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $myconn) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); ?> <body> <div id="comments"> <form action="image_show.php?id=<?php echo $row_Recordset1['id'];?>" method="POST"> <label>Name: </label><br /><input type="text" name="name" input id="name"value="<?php echo "$name" ?>" /><br /><br /> <label>Comment: </label><br /><input type="text" input id="comment"/><textarea name="comment" "cols="25" rows="7"></textarea><br /><br /><br /> <input type="submit" name="submit" value="Comment" /><br /> </form></div> <hr width="1100px" size="5px" /> </body> <?php $query=mysql_query("SELECT * FROM comment ORDER BY id DESC"); while($rows=mysql_fetch_assoc($query)) { $id=$rows['id']; $name=$rows['name']; $comment=$rows['comment']; $linkdel="<a href=\"delete.php?id=" . $rows['id'] . "\">Delete User</a>"; echo '<font color="red">Name:</font> ' . $name . '<br />' . '<br />' . '<font color="red">Comments:</font> ' . '<br />' . $comment . '&nbsp' . '&nbsp' . '&nbsp' . '&nbsp' . $linkdel . '<br />' . '<br />' . '<hr size="5px" width="500px" color="blue" />' ; } ?> </html> </body> </html>
  24. I haven't looked at this in a bit probably should've I think I see some problems. <?php require('connect.php'); $deleteid=$_GET['id']; mysql_query("DELETE FROM comment WHERE id='$deleteid'"); header("location: success.php"); ?>
×
×
  • 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.