Jump to content

son.of.the.morning

Members
  • Posts

    292
  • Joined

  • Last visited

    Never

Posts posted by son.of.the.morning

  1. Here is the full php/html code

     

    <?php 
    				$rowNum = "0";
    				while($record_rows = mysql_fetch_array($records_returned)){
    					if(++$rowNum % 2 == 1 ) {
    
    
    			?>
                    <div class="Record">
                    	<div class="Thumbnail"><img src="../img/articles/thums/<?php echo $record_rows['img_url']; ?>" class="RecordThumbnail"/></div>
                        <div class="RecordContent">
                        	<div class="PostTitle"><?php echo $record_rows['title']; ?></div>
                            <div class="PostSnipit"><?php echo substr($record_rows['post'], 0,50)."..."; ?></div>
                        </div>
                        <div class="SelectOptions">
                            <div class="DeleteRecord">Delete Article</div>
                            <div id="VeiwRecord">More Details</div>
                        </div>
                    </div>
                    <div id="ViewMoreHidden"><?php echo substr($record_rows['post'], 0,500)."..."; ?></div>
                    <?php } else {?>
                    <div class="Record_i">
                    	<div class="Thumbnail"><img src="../img/articles/thums/<?php echo $record_rows['img_url']; ?>" class="RecordThumbnail"/></div>
                        <div class="RecordContent">
                        	<div class="PostTitle"><?php echo $record_rows['title']; ?></div>
                            <div class="PostSnipit"><?php echo substr($record_rows['post'], 0,50)."..."; ?></div>
                        </div>
                        <div class="SelectOptions">
                            <div class="DeleteRecord">Delete Article</div>
                            <div id="VeiwRecord">More Details</div>
                        </div>
                    </div>
                    <div id="ViewMoreHidden"><?php echo substr($record_rows['post'], 0,500)."..."; ?></div>
                    <?php }} mysql_close();?>
                </div>
    
    

  2. I am actauly mind blank on this one...

     

    PHP & HTML

    <?php 
    				$rowNum = "0";
    				while($record_rows = mysql_fetch_array($records_returned)){
    					if(++$rowNum % 2 == 1 ) {
    
    
    			?>
                    <div class="Record">
                         <div id="VeiwRecord">More Details</div>
                   </div>
                    </div>
                     //THE HIDDEN DIV
                    <div id="ViewMoreHidden"><?php echo substr($record_rows['post'], 0,500)."..."; ?></div>
                    <?php } else {?>
                    <div class="Record_i">
                        <div id="VeiwRecord">More Details</div>
                   </div>
                    //THE HIDDEN DIV
                    <div id="ViewMoreHidden"><?php echo substr($record_rows['post'], 0,500)."..."; ?></div>
                    <?php }} mysql_close();?>
    

     

    JQUERY

    $('document').ready(function() {
    
    	$('#VeiwRecord').click(function() {
    		$('#ViewMoreHidden').slideToggle(2000);
    
    	});
    
    });
    
    

  3. I have a while loop fucntion displaying a list of records, each while records contains a hidden div with additional infomation and a button that will call JQuery slideToggle() function. each button on each record toggles alll the hidden divs. Does anyone have any ideas on how to sort this issue?

  4. alright guys, i am having a little trouble trying to get atl styles within a while loop and wondered if anyone could help?

     

    <?php 
    				$rowNum = "0";
    				while($record_rows = mysql_fetch_array($records_returned)){
    					if(++$rowNum % 2 == 1 ) {
    
    
    			?>
                    <div class="Record-style1">	
                    </div>
                    <?php } else {?>
                    <div class="Record-style2">
                    	
                    </div>
                    <?php }} mysql_close();?>
    
    

  5. I have a class built for an INSERT query but it is passing two sets of records into the database rather than one.

     

    class DatabaseInsert {
    
    	function DatabaseConnectionRequire() {
    		include("../scrips/php/database.connection.class.php");
    		include("../scrips/php/database.settings.php");	
    		include("../scrips/php/database.connection.class.invoke.php");	
    
    	}
    
    	function ArticleInsert($values,$fields,$table) {
    
    		$values_imploded = implode("   ",$values);
    		$fields_imploded = implode("   ",$fields);
    		$i = "INSERT INTO $table ($fields_imploded) VALUES ($values_imploded)";
    		mysql_query($i) or die(mysql_error());
    
    		if (!mysql_query($i)) {
    
    	    	echo "Sorry, something whent wrong there...";
    		}
    
    		else {
    			echo "<strong><p style='color:green;'>Content added sucessfully!!!</p></strong>";
    		}
    
    	}
    }
    
    

  6. Alright guys got a but of a issue here, i keep geting a 'Call to class error undefined $obj' and i cant seem to see the problem.

     

    my class

    <?php
    
    class DatabaseInsert {
    
    	function ArticleInsert($table,$fields,$values) {
    
    		$values_imploded = implode("','",$values);
    		$fields_imploded = implode(",",$fields);
    		$i = "INSERT INTO $table ($fields_imploded) VALUES ($values_imploded)";
    
    		mysql_query($i) or die( "<br>Query string: <br>Produced error: " . mysql_error() );;
    		//$table,$fields,$values
    
    	}
    }
    
    
    
    ?>
    

     

    The call

    if(isset($_POST['sub'])) {
    
    					include("../scrips/php/cms/database.insert.class.php");
    					$table = "blog_posts";
    					$title = "'".$_POST['ArticleTitle']."'";
    					$img = "'2'";
    					$post = "'".$_POST['ArticleBody']."'";
    					$aurthor_id = "'1'";
    					$category_id = "'4'";
    					$date_posted = "NOW()";
    
    					$values = array("$title","$img","$post","$aurthor_id","$category_id","$date_posted");
    					$fields = array('title','img','post','aurthor_id','category_id','date_posted'); 
    					//echo $values['0']."<br/>".$fields['0'];
    
    					echo $values['0']."<br/>".$values['1']."<br/>".$values['2']."<br/>".$values['3']."<br/>".$values['4']."<br/>".$values['5'];
    					$obj->ArticleInsert($table,$fields,$values);
    
    

  7. I am trying to insert into my database and it's just not having non of it. No errors are comming up at all, but no data is getting passed through.

     

    if(isset($_POST['sub'])) {
    
    					include("../scrips/php/cms/database.insert.class.php");
    					$table = "blog_posts";
    					$title = $_POST['ArticleTitle'];
    					$img = "2";
    					$post = $_POST['ArticleBody'];
    					$aurthor_id = "1";
    					$category_id = "4";
    					$date_posted = "NOW()";
    					$values = array("$title","$img","$post","$aurthor_id","$category_id","$date_posted");
    					$fields = array('title','img','post','aurthor_id','category_id','date_posted'); 
    					//echo $values['0']."<br/>".$fields['0'];
    					//$obj->ArticleInsert($table,$fields,$tvalues);
    
    								$values_imploded = implode("','",$values);
    								$fields_imploded = implode(",",$fields);
    								$i = "INSERT INTO $table ($values_imploded) VALUES ($fields_imploded)";
    								mysql_query($i) or die( "<br>Query string: <br>Produced error: " . mysql_error() );;
    
    				}
    
    
    

  8. Hey guys I want to create a class containing a SELECT statment in order to make in re-usable though out my entire applicion. Any one no a good way to go about this?

     

    This is the native way i have done it. I want to be able to make this into a class becuase i have more than one database with the same tables.

                                    $articles = "SELECT * FROM blog_posts INNER JOIN users ON blog_posts.aurthor_id=users.user_id
    						 INNER JOIN post_categories ON blog_posts.category_id=post_categories.id";
    			$articles_results = mysql_query($articles)or die(mysql_error());;
    
    

  9. I keep getting a Error "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\matts_blog\articles.php on line 56"

     

    
    <?php 
    	$articles = ("SELECT * FROM blog_posts INNER JOIN users ON blog_posts.author_id=users.id");
    	$articles_results = mysql_query($articles);
    ?>
                
            <?php
    
    	  while($article_rows = mysql_fetch_array($articles_results)){		
    ?>
    

  10. Hey guys, am am creating a blog and i need a little help with some SQL querys. I have a table called "Posts" and there are to coloums that i nees to be related to other tables

     

    i.e.

    Posts (table)

    - Id

    - title

    - aurthor_id  ---> AUTHORS_TABLE

    - category_id  ----> CATEGORY_TABLE

    - datePosted

     

    I know that i have to use joins but i am unshure on how to create them correctly.

  11. Having some odd issues with a simple query :S. The first problem is that i have selected all records but it miss's out records in a pattern (the first, fifth, ninth and so on). The second issue is i am trying to select by ascending order but it's just not doing it.

     

    The QUERY

                    $comments = "SELECT * FROM  $commentsTable LIMIT $start, $per_page ";
    	$commentResults = mysql_query($comments);
    	$commentRows = mysql_fetch_array($commentResults);
    

     

    The while loop displaying the records

    <?php while($commentRows = mysql_fetch_array($commentResults)){?>
        <div id="comments">
        	<div id="CommentWrapper">
                <div id="comment">
                    <div id="UserName"><? echo $commentRows['id']." "; ?><? echo $commentRows['name'];?></div>
                    <div id="UserComment"><? echo $commentRows['comment'];?></div>
                    <div id="UserEmail"><a href="<? echo $commentRows['email'];?>"><? echo $commentRows['email'];?></a></div>
                    <div id="PostDateTime"><i>Posted: </i><? echo $commentRows['datatime'];?></div>
                </div>
            </div>
        </div>
    <?php } mysql_close(); ?>
    

     

    http://dvplus.webuda.com/oophptest/database.query.php <<< the project

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