Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. you need to change the sesion name, to what ever the name of your session is. Also check your table names, etc. and include your database connection. If this doesn't solve it, post the code here. Also removing the else won't work either.
  2. would another way to do it, be by using define??
  3. this is what i think you are looking for, you will need to change it for your needs, but this is what i use as my member page. it lists the members , and then gives each one a dynamic link (?id=11) and this is it's profile page <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname<br>"; $show_email = $row['show_email']; if ($show_email == 1) { echo 'Email:<a href="mailto:'.$profemail.'"> Email Me</a>'; } elseif ($show_email == 0) { echo "Email: Hidden"; } exit(); } else { echo "Invalid user! <br />"; echo "<a href=\"members.php\">Return to Members</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?> if you need more help, just ask
  4. database, but i don't want it to change the stuff in the database, just to change the language on the screen, if the user wants
  5. how can i change the sites language with one PHP file do i need to use preg replace, and write down every letter in each language?
  6. https://www.paypal.com/uk/cgi-bin/webscr?cmd=xpt/Marketing/general/ProductsandServices-outside&nav=3
  7. you will have to read more into there site, unless you have a PHP related question
  8. go to the paypal website and have a look, this is a PHP help forum, about coding
  9. change steve jobs to steve_jobs
  10. sorry, i am refering back to my opening post with the pagination
  11. if this isn't possible please tell me
  12. why not use an uplaod form to insert the themes into the correct folder then on the upload form insert the details into the mysql database
  13. would that not be a maths problem,
  14. save the theme details in a mysql database
  15. with the code you provided , you removed the pagination which is what i want to add to it
  16. that bit of code, was written by someone to break line every 3 entrys
  17. it still only echoes the first letter of the word, what i am trying to do is paginate this <?php require_once 'header.php'; $pageid = "2"; $sq1 = "SELECT * FROM hayleyedit WHERE page_id ='{$pageid}' LIMIT 0,1;"; $result1 = mysql_query($sq1) or die("Error:" . mysql_error()); $rom = mysql_fetch_assoc($result1); $content_port = $rom['content']; if (isset($_GET['image_id'])) { if ((int) $_GET['image_id'] > 0) { $imageid = $_GET['image_id']; $sql = "SELECT * FROM hayleyimages WHERE image_id=$imageid"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $imageprofname = $row['image_name']; $imageprofcaption = $row['image_caption']; $imageproflink = $row['image_link']; if(mysql_num_rows($result) > 0) { ?> <div id="prof_img"> <table id="portfolio_image"> <tr><th><?php echo "$imageprofname"; ?></th></tr><tr><td><?php echo '<a href="'.$row['image_link'].'" rel="lightbox" title="'.$row['image_caption']. '" ><img src="'.$row['image_link'].'"width="200px" /></a>'; ?></td><td width="200px"><?php echo 'Image ID :'.$row['image_id'].''; ?></td></tr><tr><td><?php echo ' '.$row['image_caption']. ' </a>'; ?></td></tr><tr><td><a href="portfolio.php">Return To Gallery</a></td></tr></table></div> <?php } if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"index.php\">Return to Image Page</a>"; exit(); } exit(); } else { echo "Unknown Image ID! <br />"; echo "<a href=\"index.php\">Return to Image Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT image_id, image_name, image_link, image_caption FROM `hayleyimages`"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { ?> <table class="welcome_port"><tr><td><?php echo"$content_port"; ?> <?php if ($_SESSION['logged_in'] == true) { ?> <td><a href="live_edit.php?editpageid=<?php echo $_SESSION['page_name'] ?>">Edit</a></td></tr></table> <?php } else { ?> </td></tr></table> <?php } ?> <table id="portfolio"> <?php $loop = 3; $loop1 = 3; while($row=mysql_fetch_array($result)){ // Start looping table row if ($loop == 3) { echo "<tr>"; } $toecho1 .= '<td><a href="?image_id='.$row['image_id'].'">Details</a></td><td> </td>'; $toecho .= '<td><a href="'.$row['image_link'].'" rel="lightbox [main]" title="'.$row['image_caption']. '" ><img src="'.$row['image_link'].'"width="150px" /></a></td><td> </td>'; if ($loop == 3) { echo "</tr>"; $loop=0; } } if (substr($toecho, -5) != "</tr>") { $toecho .= "</tr>"; } echo $toecho; echo $toecho1; } ?> </table> <?php if (mysql_num_rows($result) < 1) { echo "No Images To Display"; } ?> </div> <?php require_once 'footer.php'; ?>
  18. how can this work <?php // how many rows to show per page $rowsPerPage = 1; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT image_link, image_name, image_id, image_caption FROM hayleyimages LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); // print the random numbers while(list($val) = mysql_fetch_array($result)) { echo "$val"; ?> <table id="portfolio_image"> <tr><th><?php echo .$val['image_name'].; ?></th></tr><tr><td><?php echo '<a href="'.$val['image_link'].'" rel="lightbox" title="'.$val['image_caption']. '" ><img src="'.$val['image_link'].'"width="200px" /></a>'; ?></td><td width="200px"><?php echo 'Image ID :'.$val['image_id'].''; ?></td></tr><tr><td><?php echo ' '.$val['image_caption']. ' </a>'; ?></td></tr><tr><td><a href="portfolio.php">Return To Gallery</a></td></tr></table><br> <?php } echo '<br>'; // how many rows we have in database $query = "SELECT COUNT(image_id) AS numrows FROM hayleyimages"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); $self = $_SERVER['PHP_SELF']; // creating 'previous' and 'next' link // plus 'first page' and 'last page' link // print 'previous' link only if we're not // on page one if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' [Prev] '; // we're on page one, don't enable 'previous' link $first = ' [First Page] '; // nor 'first page' link } // print 'next' link only if we're not // on the last page if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' [Next] '; // we're on the last page, don't enable 'next' link $last = ' [Last Page] '; // nor 'last page' link } // print the page navigation link echo $first . $prev . " Showing page <strong>$pageNum</strong> of <strong>$maxPage</strong>" . $next . $last; ?> this bit inparticular <?php $query = "SELECT image_link, image_name, image_id, image_caption FROM hayleyimages LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or die('Error, query failed'); // print the random numbers while(list($val) = mysql_fetch_array($result)) { echo "$val"; ?> <table id="portfolio_image"> <tr><th><?php echo .$val['image_name'].; ?></th></tr><tr><td><?php echo '<a href="'.$val['image_link'].'" rel="lightbox" title="'.$val['image_caption']. '" ><img src="'.$val['image_link'].'"width="200px" /></a>'; ?></td><td width="200px"><?php echo 'Image ID :'.$val['image_id'].''; ?></td></tr><tr><td><?php echo ' '.$val['image_caption']. ' </a>'; ?></td></tr><tr><td><a href="portfolio.php">Return To Gallery</a></td></tr></table><br> <?php } it echoes the letter i but i know that the database has information and that it is connected and that all the words are right(i think), a similar code is working on my site, and i need to add pagination to it. I've found out that the i is the first letter of the image_link
  19. edited for easier reading, but still have a problem. is it my update statement? "UPDATE hayleyedit SET content = '{$update}' WHERE page_id = '{$page_id}'";
  20. i am connecting to the database before the code you can see, this is my whole code (without connection details) <?php if(isset($_POST['save'])) { $update =mysql_real_escape_string($_POST['content']); $query_update = "UPDATE hayleyedit SET content = '{$update}' WHERE page_id = '{$page_id}'"; mysql_query ($query_update) or die("Error:" . mysql_error()); } if ($_SESSION['logged_in'] == true) { if (isset($_GET['editpageid'])) { if ((int) $_GET['editpageid'] > 0) { $page_id = $_GET['editpageid']; $sql = "SELECT * FROM hayleyedit WHERE page_id ='{$page_id}' LIMIT 0,1;"; $result = mysql_query($sql) or die("Error:" . mysql_error()); $row = mysql_fetch_assoc($result); $welcome = $row['content']; $name = $row['page_name']; ?> <p>Editing <?php echo "$name"; ?></p> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"><textarea name="content" cols="60" rows="20" title="Edit Site Content"><?php echo "$welcome"; ?></textarea><br /><input type="submit" value="Change" title="Save Changes" name="save"/></form> <?php if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"live_edit.php\">Return to Page List</a>"; exit(); } exit(); } else { echo "Unknown Page ID! <br />"; echo "<a href=\"live_edit.php\">Return to Page List</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT page_name, content, page_id FROM hayleyedit ORDER BY page_id"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "Page List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<table border="1"><tr><td><a href="?editpageid=' . $row['page_id'] . '">' . $row['page_name'] . '</a></td></tr></table>'; } } } else { header("Location:http://".$_SERVER[HTTP_HOST]); } mysql_close(); ?> </div> </div> I need the update to update the content with the page ID it has, that is in the URL as ?editpageid=(whatever id)
  21. if's it JS shouldn't it be enclosed in script tags? <script></script> (there should be more stuff in the tags like language, someone might be able to help there)
  22. this is my code <?php if ($_SESSION['logged_in'] == true) { if (isset($_GET['editpageid'])) { if ((int) $_GET['editpageid'] > 0) { $page_id = $_GET['editpageid']; $sql = "SELECT * FROM hayleyedit WHERE page_id ='{$page_id}' LIMIT 0,1;"; $result = mysql_query($sql) or die("Error:" . mysql_error()); $row = mysql_fetch_assoc($result); $welcome = $row['content']; $name = $row['page_name']; ?> <p>Editing <?php echo "$name"; ?></p> <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post"><textarea name="content" cols="60" rows="20" title="Edit Site Content"><?php echo "$welcome"; ?></textarea><br /><input type="submit" value="Change" title="Save Changes" name="save"/></form> <?php if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"live_edit.php\">Return to Page List</a>"; exit(); } exit(); } else { echo "Unknown Page ID! <br />"; echo "<a href=\"live_edit.php\">Return to Page List</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT page_name, content, page_id FROM hayleyedit ORDER BY page_id"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "Page List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<table border="1"><tr><td><a href="?editpageid=' . $row['page_id'] . '">' . $row['page_name'] . '</a></td></tr></table>'; } } } else { header("Location:http://".$_SERVER[HTTP_HOST]); } if(isset($_POST['save'])) { $update =mysql_real_escape_string($_POST['content']); $query_update = "UPDATE hayleyedit SET content = '{$update}' WHERE page_id = '{$page_id}'"; mysql_query ($query_update) or die("Error:" . mysql_error()); } mysql_close(); ?> there are no errors , it reloads the page after i submit it and my changes aren't made, and they are not changed in th DB either. anyone help?
  23. yep, forgot to mention that , you need to change some of it for yourself.
×
×
  • 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.