Jump to content

RampantGiraffe

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

RampantGiraffe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys. I have trawled countless forums and tutorials on various websites Devnetwork, phpbuilder etc and I can't really seem to find an answer to my problem. Maybe they just haven't been explained in a way I understand yet. :/ I have already paginated my results pulled from MySQL database... it was easy I copied the tutorial in the book (I'm sure there is a better way of writing it but I'll go back and look at that when I'm a bit more proficient). I am pulling records from MySQL database which are articles with some images included. The articles are of various lengths and the images various sizes. As the result of this limiting to 5 records per page has different results depending on which articles are to be displayed. Page 1 currently has a lot of space at the bottom of the page as the articles displayed here are quite short. Page 2 has large articles and overshoots the bottom of my page template causing the /div its posted in to continue on past the bottom of the rest of my page. Is there a way of limiting results based on total number of characters contained in a specific field (if I establish how many characters could fit on the page to begin with)instead of just limiting by number of rows returned? Or is it possible to create (from the query results) a page height variable that can be posted to the other parts of my web page so that the rest of the site fits the results. If either is possible which would be the better of the two? If not any suggestions with how to deal with this? Any links to resources which might give me ideas on where to start with the coding would also be appreciated. Thanks
  2. Hello again Still having the same problem. I was concerned that it may be due to my config files for php or apache that were the problem. So to test my theory I added by scripts to my hosts webserver and was dismayed to find that I am still having the same problems. (yet pleased that it wasn't just my poor configuration skills on my home machine) So guys... can anyone make any suggestions as to why this is still happening. It is connecting to the database fine and executing the query ok (as I do get errors displayed when this has failed previously). When I load the page it is not displaying the table of results or the paragrah telling me something is wrong. From my previous example some of the variable names have been changed as these now reflect my actual database values. All of my includes are working fine but as yet contain no dynamic content. I think I may be confusing myself but do I have to define the query before any html input? if so could my <div> tags be causing this to fail? I'm feeling really miserable. [code]<body> <?php error_reporting (E_ALL);?> <?php include "leftnav.php";?> <?php include "topnav.php";?> <?php include "footer.php";?> <div id="Layer4" style="position:absolute; left:170px; top:169px; width:850px; height:594px"> <! here is this bit you fill in!>   <?php require_once ('mysql_connect.php'); $sql = 'SELECT `title`,`author`,`subdate`,`text` FROM `sitec` WHERE `category` =\'Articles\' ORDER BY `subdate`'; $result= mysql_query($sql)OR die (mysql_error()); if ($result) { echo '<table><tr><td> Title</td><td>Author</td><td>Articles</td></tr>';              while ($row=mysql_fetch_array($result)){ echo '<tr><td> '. $row['title'] .' </td><td> '. $row['author'] .' </td><td> '.$row['text'] .'</td></tr>';} echo '</table>'; }else{ echo '<p> The current query did not execute successfully</p>'; echo '<p>' .mysql_error() . '<br /> <br /> Query: '. $query .' </p>';} mysql_close(); ?> <!end of main content!> </body> </html>[/code] As usual any suggestions greatfully received. Regards
  3. Hi there, gave that a try and it still didn't work. I can't seem to get it to display anything that has been processed by php at all. I can however get phpinfo()... so its a start. lol I think I must have a problem with either the php or apache config file which is preventing this from being displayed. I will go back to the books and see if I can resolve the issue. In the meatime if you have any suugestions about where to start they would be very much appreciated. Regards
  4. Brilliant! Nope it didn't work :( Ho hum. Changed my query as advised (which was a fair comment ... what was I thinking! lol) and added OR die(mysql_error()); to the end of $result= mysql_query($query) as suggested. It still won't disaply an error or the results any suggestions? Yes I am typing it correctly . :) Have checked that the query is ok by directly typing it into MySQL prompt (results displayed are expected). Which makes me think its more likely to be a problem with this bit of code. :/ *puzzled* Cheers
  5. Morning Any chance you can give me some hints as to where I'm going wrong with this. Or at least some advice on how to get the errors to display so I can work it out for myself. Please do bear with me... I'm at the noob stage where I still need to keep the book on my lap. :) Here is my DB connection script [code] <?php DEFINE ('DB_USER', 'usertype1'); DEFINE ('DB_PASSWORD', 'password'); DEFINE ('DB_HOST', 'localhost'); DEFINE('DB_NAME','Withheld'); $dbc = @mysqlconnect(DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to mysql: ' . mysql_error()); @mysql_select_db (DB_NAME) OR die ('Could not select the database: ' . mysql_error().''); ?>[/code] I think the above is ok... I followed that one traight from the book.... Here is my query code which I had a go at myself using the code from the book and changing the relevant details for my own DB. [code] <div id="Layer4" style="position:absolute; left:170px; top:169px; width:700px; height:594px; z-index:5">   <?php require_once ('mysql_connect.php'); $query ='SELECT title AS Title, author AS Author FROM content ORDER BY author'; $result= mysql_query($query); if ($result) { echo '<table><tr><td> Title</td><td>Author</td></tr>';              while ($row=mysql_fetch_array($result, MYSQL_ASSOC)){ echo '<tr><td> '. $row['Title'] .' </td><td> '. $row['Author'] .' </td></tr>';} echo '</table>'; mysql_free_result($result); }else{ echo '<p> The current query did not execute successfully</p>'; echo '<p>' .mysql_error() . '<br /> <br /> Query: '. $query .' </p>';} mysql_close();  ?> </div>[/code] this section is in a division of my index.php file and is the only bit of dynamic code I've tried to implement. Its really driving me crazy I have the database set up and all the content but I can't get the pages to display the query results. I'm not receiving any errors at all. When I open the webpage from my htdocs folder it looks like it refreshes the page but nothing is displayed. What have I done? Thanks in advance for your assistance. Regards Giraffe
×
×
  • 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.