Jump to content

cactus

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cactus's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm sorry I really don't understand that, I have tried the commands but they didn't work. Is there any way to do this without using the command prompt?
  2. Hi, I have created a php website with a database back end and need to put it on my section of my university's web server. I know where to put it and have had websites working on this before however I have never tried it with a database. I have exported my database into a .sql file in phpmyadmin and really don't know where to go from there. I tried just copying this file into the folder with the web code but it didn't work. I need to get it working on the university network but don't know how this is possible. Please can sombody help me? Hope to hear from someone soon
  3. Hi, Currently on my website I have a section where you can select an article held within a database, I still want this to happen but I wouldn't a different word to be linked to the article. Currently it reads 'Click here to view this entry' underneath the title of the article, I want he title of all the different articles to link to the right article is there anyway to do this? My code currently reads: <?php $blog_postnumber = 5; if(!isset($_GET['page'])) { $page = 1; } else { $page = (int)$_GET['page']; } $from = (($page * $blog_postnumber) - $blog_postnumber); $sql = "SELECT * FROM cms_article ORDER BY timestamp DESC LIMIT $from, $blog_postnumber"; $result = mysql_query($sql) or print ("Can't select entries from table cms_article.<br />" . $sql . "<br />" . mysql_error()); while($row = mysql_fetch_array($result)) { $date = date("l F d Y", $row['timestamp']); $title = stripslashes($row['title']); $entry = stripslashes($row['entry']); $id = $row['id']; if (strlen($entry) > 0) { $entry = substr($entry, 0, 0); $entry = "$entry<a href=\"journal.php?id=" . $id . "\">Click here to view this entry.</a>"; } ?>
  4. hello, sorry for constantly replying in my own post but I need to know how to get the menu that is generated from my database on every page. Is there even a way to do this? or link the current menu icon image to one of the posts from the database? Any ideas?? I can't figure it out. Thanks in anticipation
  5. I am creating a cms to update the pages so the menu needs to be on each page to access the updated page, if that makes sense? I'm really sorry but I don't understand what you mean with the post you have just sent i'm a beginner at php and mysql and am finding it difficult to figure out this problem. It's the last section of my website that I'm having problems with and just need the error messages fixed. So is there any way that I can fix these problems to get the menu working on each page? I really hope someone can help. I'm really struggling, please
  6. Can someone please help me with the errors I am getting I don't understand how to fix them? Please. Thanks in anticipation
  7. I tried to add in the following code to another page <div id="menu"> <ul id="headlines"> <?php foreach ( $results['articles'] as $article ) { ?> //THIS LINE <li> <a href=".?action=viewArticle&articleId=<?php echo $article->id?>"><?php echo htmlspecialchars( $article->title )?></a> </li> <?php } ?> </ul> </div> However I keep getting the following errors: Undefined index: articles and Invalid argument supplied for foreach() they appear on the line highlighted above can anybody help? Thanks
  8. I was going to do that once i'd figured out which section of the code would be duplicated on each page. Do you know which bit it would be, i've tried various ways and none of them are working? Thanks
  9. Hi, I have a menu that is generated from my mysql database and I want it on every page of my website as the main menu. However I can''t figure out how to do this. I managed to get it on the view article page by duplicating the my query like this: function viewArticle() { if ( !isset($_GET["articleId"]) || !$_GET["articleId"] ) { homepage(); return; } $result['article'] = Article::getById( (int)$_GET["articleId"] ); //single record $result['pageTitle'] = $result['article']->title . " | Widget News"; $results = array(); $all_data = Article::getList( HOMEPAGE_NUM_ARTICLES ); //multiple record $results['articles'] = $all_data['results']; $results['totalRows'] = $all_data['totalRows']; require( TEMPLATE_PATH . "/viewArticle.php" ); } However I can't figure out how to place it on for example the new article page. function newArticle() { $results = array(); $results['pageTitle'] = "New Article"; $results['formAction'] = "newArticle"; if ( isset( $_POST['saveChanges'] ) ) { // User has posted the article edit form: save the new article $article = new Article; $article->storeFormValues( $_POST ); $article->insert(); header( "Location: admin.php?status=changesSaved" ); } elseif ( isset( $_POST['cancel'] ) ) { // User has cancelled their edits: return to the article list header( "Location: admin.php" ); } else { // User has not posted the article edit form yet: display the form $results['article'] = new Article; require( TEMPLATE_PATH . "/admin/editArticle.php" ); } } Can anybody help me out i'm really struggling? Thanks
  10. Thank you that got rid of the bullet points is there anyway to make a bigger gap between the points like you would normally do with a <br> sign? There a bit too squished together for what I want. Thanks for the help
  11. That's going to give it bullet points though is there any other way of doing it than that? Thanks for replying
  12. Hi My problem is that text that is in my database are showing up next to each other in a line rather than on seperate lines, normally I would have just used <br> but as it's generated from my sql I don't know how to do it. <ul id="headlines"> <?php foreach ( $results['articles'] as $article ) { ?> <a href=".?action=viewArticle&articleId=<?php echo $article->id?>"><?php echo htmlspecialchars( $article->title )?></a> <?php } ?> </ul> Anyone have any idea? Thanks
×
×
  • 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.