Jump to content

Bopo

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Bopo's Achievements

Member

Member (2/5)

0

Reputation

  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.
×
×
  • 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.