![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
son.of.the.morning
-
Posts
292 -
Joined
-
Last visited
Never
Posts posted by son.of.the.morning
-
-
? sorry i dont understand were the problem is comming from?
-
Yes your correct, however the same method works fine with class's.
-
Got it sorted, thanks everyone for your help.
-
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>
-
Still nothing at all :S
-
Just tryied that but it didnt work.
-
would i have to change any of the php/html?
-
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); }); });
-
Yea thats it exacly, do you know a way around this?
-
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?
-
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();?>
-
Thats not an issue there is comma's set within each var. the only issue is that it insert 2 sets of records rather then one.
-
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>"; } } }
-
Is this possible? i want to create a two colored table of records. And one got any idea's?
-
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);
-
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() );; }
-
Well i want to be able to re-use all my backend design in other blogs i will creat in the futore
-
It's ok man i found the problem, like always it was a silly spelling mistake.
Thanks for you help boss!
-
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());;
-
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)){ ?>
-
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.
-
I post my query results out, it doesnt give any slight sudgestion why it's missing out records :S
-
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
-
$sql="INSERT INTO comments (name, email, comment, datatime)VALUES('$name', '$email', '$comment', NOW())";
like so..?
INSERT function not working
in PHP Coding Help
Posted
ahh i see!