calvinschools
Members-
Posts
100 -
Joined
-
Last visited
Never
About calvinschools
- Birthday 06/27/1985
Profile Information
-
Gender
Male
-
Location
NY
calvinschools's Achievements
Member (2/5)
0
Reputation
-
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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 -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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. -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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()); ?> -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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 -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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> -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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 . ' ' . ' ' . ' ' . ' ' . $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 -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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     <a href="delete.php?id=55">Delete User</a><br /><br /><hr size="5px" width="500px" -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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. -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
no database selected -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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. -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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']}"); ?> -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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 -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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 ?> -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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'];?>" -
linking comment systen to template page
calvinschools replied to calvinschools's topic in PHP Coding Help
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.