Jump to content

Bopo

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Everything posted by Bopo

  1. Thanks for the suggestions, didn't work however. Also something I noticed, it clears the page without me visiting through a web browser, simple uploading it and refreshing my FTP shows 0KB as the file size. Guess it's a hosting issue, seem to have problems when it coems to PHP <?php $cartype = "Alfa Romeo 147"; include("../coding/scripts/specs.php") ?>
  2. Hey All It seemed that an inlcude statement wasn't working for some reason, so I tried a more absolute file path: include("home/username/public_html/coding/scripts/carspecs.php") However this simply returned a blank page, so I change it back to what it was: include("../coding/scripts/carspecs.php") However I still got a blank page, so I cleared my cache, ensured I'd uploaded the page and so on, and still blank. However every time I access the newly uploaded page, and then check in on the FTP, it's 0KB in size (9KB orginally). So everytime I reupload and access the page, it just changes to, well, nothing. Any ideas?
  3. Thanks for the great information, ill start working on it
  4. Hey Well I'm just about to start on a CMS, and I was wondering if this is possible by just using the .htaccess file: www.website.com/cars/viewarticle.php?id=123 To www.website.com/cars/ford-fiesta.php To generate the keywords, I would pull them from a column within the database, such as heading or title column, please could I get some opinions of whether something like this would work? Cheers.
  5. Hi Well basically I think there's something wrong with the following code, even if a row is returned, I am still getting a new record with no data appearing in my mysql database, wondering if anyone can see anything: <?php $date = date('Y/m/d'); date('F, Y',strtotime($date)); include("admin/blogconnect.php"); $breakdate = explode(" ", date('F, Y',strtotime($date))); $removecomma = substr($breakdate[0], 0, -1); $sql = "SELECT * FROM months where month = '$storemonth' AND year = '$storeyear'"; $query = mysql_query($sql, $connect); if(mysql_num_rows($query)== 0) { $sql1 = "INSERT INTO months (month, year) VALUES ('$storemonth', '$storeyear')"; if(!mysql_query($sql1, $connect)) { die('Error' . mysql_error()); } } else { exit (); } mysql_close($connect); ?>
  6. Hi This has had me pulling my hair out, I can't see any problems, I tried testing by echoing out my variables and the result is always blank, I have a very similar piece of code on another page and this is almost identical apart from form elements and table names. The problem is that nothing is being stored in $fname $lname and $title, I have tried many different approaches but the outcome is always the same, blank. <?php $idvalue = $_GET['id']; if(isset($_POST['save'])) { if(empty($_POST['fname']) && empty($_POST['lname']) && empty($_POST['title']) && empty($_POST['FCKeditor1'])) { die('Please fill in all required fields'); } $fname = ($_POST['fname']); $lname = ($_POST['lname']); $title = ($_POST['title']); $post = ($_POST['FCKeditor1']); echo $fname; echo $lname; echo $title; exit(); include("blogconnect.php"); $sql = "UPDATE blogposts SET firstname = '$fname', lastname = '$lname', title = '$title', post = '$post' WHERE id = '$idvalue'"; if(!mysql_query($sql, $connect)) { die('Error' . mysql_error()); } echo '<p>Record sucesfully updated, <a href="http://www.koicarpadvice.com/admin/posts.php">Return to posts</a></p>'; mysql_close($connect); } ?> <?php $idvalue = $_GET['id']; include("blogconnect.php"); $sql = "SELECT * FROM blogposts WHERE id = '$idvalue'"; $query = mysql_query($sql, $connect); while ($row = mysql_fetch_assoc($query)) { echo '<form id="form1" name="form1" method="post" action="" class="form"> <label for="author">First Name:</label> <input name="author" type="text" class="inputbox" id="fname" value="' . $row['firstname'] . '" /><br /><br /> <label for="author">Last Name:</label> <input name="author" type="text" class="inputbox" id="lname" value="' . $row['lastname'] . '" /><br /><br /> <label for="author">Title:</label> <input name="author" type="text" class="inputbox" name="title" id="title" value="' . $row['title'] . '" /><br /><br />'; $oFCKeditor = new FCKeditor('FCKeditor1') ; $oFCKeditor->BasePath = '/fckeditor/' ; $oFCKeditor->Value = $row['post']; $oFCKeditor->Create() ; } ?>
  7. Thanks for the suggestions, it seems that putting single quotes around the $minus and $storemultiply variable were causing it.
  8. Hi Basically I keep getting the following error, I definitely know the query is causing the error due to testing: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource Below is the query: <?php $sql = "SELECT * FROM blogposts WHERE date >= '$firstdate' AND date <= '$seconddate' ORDER BY id DESC LIMIT '$minus', '$storemultiply'";?> The part that is giving me an error is: ORDER BY id DESC LIMIT '$minus', '$storemultiply' both variables store a number. Help appreciated.
  9. Hi Basically I have a very simple query for now (just testing( <?php $sql = "SELECT * FROM blogposts WHERE date >= '2009-04-14' AND date <='2009-04-18'"; ?> This query will be executed when a hyperlink is clicked, the script will have access to two pieces of data from the URL as so: www.website.com/archive?month=April&year=2009 I would like to know if there is some function out there that could convert April for example into 04, I'm quite confident with the days and years aspect of the date, however it would be really useful if I could convert the month name into it's numerical format.
  10. Hi Well basically I have build a archive category for months, (e.g. jan, feb, mar display in navigation, when clicked articles within jan for example are listed), everything was going great, however I decided to limit the amount of articles to 5 per page, and I started writing code to do this, until I spotted a BIG flaw in what I'm doing, basically I'm retrieving everything, because using dates within queries never, ever works for me, therefore I decided to do the work manually, however doing this approach I can't limit the amount of articles for e.g. jan because I'm retrieving everything and if I used the LIMIT clause and set it to 5 for example, it would retrieve 5 articles but none of these might not be jan, so that's not practical either. <?php $month = $_GET['month']; $year = $_GET['year']; $pageno = $_GET['page']; $one = 1; $page = ($one + $pageno); include("admin/blogconnect.php"); $sql = "SELECT * FROM blogposts ORDER BY id DESC"; $query = mysql_query($sql, $connect); while ($row = mysql_fetch_assoc($query)) { $breakdate = explode(" ", date('F, Y',strtotime($row['date']))); $removecomma = substr($breakdate[0], 0, -1); $storemonth = $removecomma; $storeyear = $breakdate[1]; if($storemonth == $month && $storeyear == $year) { print '<div id="articleblock"><a href="viewpost.php?postid=' . $row['id'] . '">' . '<h1 class="frontpageheader">' . $row['title'] . '</h1></a>'; // error due to h2 tags // echo $row['id'].'<br />'; echo '<p class="author_date">' . '<em>Posted By</em>' . '<span class="author"> ' . $row['author'].'</span> <em> On </em>' . date('F d, Y',strtotime($row['date'])) . '</p>'; $countcharacters = (strlen($row['post'])); if($countcharacters >= 450) { $trimpost = substr($row['post'],0,450); echo '<p>' . $trimpost . '...' . '<a href="viewpost.php?postid=' . $row['id'] . '">' . $moreinfo . '</a></p></div>'; } else { $trimpost = substr($row['post'],0,399); echo '<p>' . $trimpost . '</p></div>'; } } } echo'<a href="archive.php?month=' . $row['month'] . '&year=' . $row['year'] . '&page=' . $page . '">' . 'Next' . '</a>'; ?> Does anyone have any idea what I can do with this, if you can produce a query using dates that works ill use it, but I have had 2 threads on here about dates within queries, and none have worked.
  11. Hi Thanks for the reply, however my post must be misleading, I'm fine with GET, I just need to include the '&year' as a second parameter in my URL, currently as you can see I only have month (achieve.php?month=) well I want achieve.php?month=text&year=text EDIT: Nvm, I was just a case of adding the text, I didn't think that would work <?php <a href="achieve.php?month=' . $row['month'] . '&year=' . $row['year'] . '">' . $row['month'] . ' ' . substr($row['year'], 2) . '</a> ?>
  12. Hi Just need a bit of advice really, basically I need to pass two pieces of data from a url, now I know how to do one, like so <?php include("admin/blogconnect.php"); $sql = "SELECT * FROM months ORDER BY id DESC"; $query = mysql_query($sql, $connect); while ($row = mysql_fetch_assoc($query)) { echo '<li><a href="achieve.php?month=' . $row['month'] . '">' . $row['month'] . ' ' . substr($row['year'], 2) . '</a></li>'; } ?> ?> Basically I want the URL to look like website.com/achieve.php?=March&=2009 something along those lines that allows both the month and year in the URL to be stored using GET. I'm guessing its something similar to what I have done to create the alt tag, it's just the '&=' or 'someword=' bit I'm not too sure on.
  13. Hi I should really be able to see where it's going wrong, but I'm having one of those moments where I just can't figure it out Parse error: syntax error, unexpected T_ELSE <?php $sql = "SELECT * FROM months where month = '$storemonth' AND year = '$storeyear'"; $query = mysql_query($sql, $connect); while($row = mysql_fetch_assoc($query)){ $month = $row['month']; $year = $row['year']; } else { //this is the line that is being highlighted. $sql = "INSERT INTO months (month, year) VALUES ('$storemonth', '$storeyear')"; if(!mysql_query($sql, $connect)) { die('Error' . mysql_error()); } mysql_close($connect); } ?>
  14. Yeah I do The only method I can think of, is to have an if statement which basicallys evaluates if today is the first of May, June, July etc. If it is a sql query is executed which adds the month's name to the DB, and then some code works out a query based on the month
  15. Hey Well basically I have created something very similar to the standard blog CMS's of there, however I would really like to generate archive categories (months, jan, feb, march, april etc), but the problem I'm having is how would I write it in such a way that when the 1st of May appears, May appears in the achive section, obviously it would be very easy to hard code all 12 months, but this would be very messy.
  16. Your using the wrong field, I think value used to display text in your editor by default If you haven't renamed the editor (presuming you haven't) use $post = ($_POST['FCKeditor1']) Then do whatever with the variable
  17. Okay well I guess there isn't, I thought of a work around so it won't be an issue now.
  18. I can't use headers because I'm already using them for verifications purposes, and the meta tags I have found only re-direct after a certain amount of time.
  19. Hi Basically after a $_POST statement has been executed, I need to forward users to a specific page, the page is already using sessions therefore I can't use location, I'm looking for any method, meta refresh or whatever, I just need to re-direct to another page after the post has happened, help appreciated.
  20. Hi Well every example I find is always about collecting text from textboxes etc, basically I have a query and a would like to insert text from the query into textboxes, however I'm unsure on how to do this, help appreciated.
  21. Awesome idea, that's something I definitely implement without much problem, also allowing the admin to modify the comment and save the changes wouldn't be too much trouble either . Thanks.
  22. Hi Well this more of an advice question really, basically I have build a simple CMS, users can comment on articles, and obviously I have an admin section which allows the administrator to view all comments, which are output into a table. Naturally I want to allow the administrator to remove comments, however from a technical view the only method I could actually think of & implement right now would be to have a textbox, the admin types the comment id into it and clicks a button which deletes the comments, I know this solution has many flaws but I'm looking for a better method, I can think of dozens however I don't know how to implement them from a coding point of view. Here is the code I'm currently using <?php include("blogconnect.php"); $sql = "SELECT * FROM comments ORDER BY id DESC LIMIT 0, 10"; echo '<table width="250" border="1">'; echo '<tr> <td class="bh">ID</td> <td class="bh">Name</td> <td class="bh">Comment</td> <td class="bh">Date</td> </tr>'; $query = mysql_query($sql, $connect) or die (mysql_error()); while ($row = mysql_fetch_assoc($query)) { //this is where the error is highlighted echo '<tr>'; echo '<td>' . $row['id'] . '</td>'; echo '<td>' . $row['author'] . '</td>'; echo '<td>' . $row['comments']. '</td>'; echo '<td>' . $row['date']. '</td>'; echo '</tr>'; } echo '</table>'; ?>
  23. Okay either I'm a retard (probably) or MySQL hates me, but I'm getting another error with the query above $sql = "SELECT * FROM comments WHERE date BETWEEN CURDATE() AND CURDATE() - INTERVAL 7 DAYS"; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DAYS' at line 1
  24. Thanks for that, however I'm getting an error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1
×
×
  • 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.