I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to to a single
page entry of the article. Right now my snippets and "read more" links are dynamic and working fine, when I
click on the "read more" link it redirects to the 'single page entry' page, but it always pulls up the article
with id=1, even if the link is from id=23, and the adressbar reads articles.php?id=23.
How do I successfully pull up the corresponding id'd article?
any tips would be greatly appreciated!
Snippets:
Code: <?php
require("sources/connection.php");
$sql = "SELECT title, snippet, body_text, id FROM articles ORDER BY id DESC LIMIT 5" ;
$result = $conn->query($sql) or die(mysqli_error());
if($result){
while ($row = $result->fetch_object()){
echo "<h4>" . $row->title . "</h4>";
echo $row->snippet;
echo "</br>";
echo "<a href='/jquery/articles.php?id=" . "$row->id'";
echo ">< Read more ></a>";
}
}
?>
Articles:
Code: <?php
require("sources/connection.php");
$sql = "SELECT title, body_text, id FROM articles LIMIT 1" ;
$result = $conn->query($sql) or die(mysqli_error());
if($result){
$row = $result->fetch_object();
echo "<h4>" . $row->title . "</h4>";
echo $row->body_text;
}
?>
SQL:
Code: CREATE TABLE IF NOT EXISTS `articles` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`rel_id` int(20) NOT NULL,
`title` varchar(255) NOT NULL,
`snippet` longtext NOT NULL,
`body_text` longtext NOT NULL,
`who_id` varchar(50) NOT NULL,
`timestamp` int(20) NOT NULL,
`url` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
Thanks in advance!
Website Direction...
I recently used this code to try and make it so the page loads as http://www.domain.com/ when you type in http://domain.comI thought this code would make sense and be a solution, but just loops.Could
Php WordPress help
I am writing the following code for making a plugin<?phpheader("Content-Type: text/css");/*Plugin Name: Name of the plugin.Plugin URI: The page having information related to
Mail Form receiving emails with no content
Hi, I hope someone here can help me.I have a simple form in my website, it was working OK, after lots of trouble finding out how to make this form I managed to make it work.I had to create an
Scene graph using Direct3D?
There are several C++ scene graph based packages available for OpenGl, like say OSG,http://www.openscenegraph.org/projects/osgBut do you by any chance know about such a package based on Direct3D?Thank
Linux socket programming
Where can I find a good introduction to socket programming?
Problems with array
This code is the last lines in an upload script that uploads 4 images at the same time and writes the url to these and som other information to the database. database structure: id img1 img2 img3
Drawing Images in classes
I'm quite new to Object Oriented PHP. What I'm trying to do is draw some images but also have other content on the page.Code: include('images.php');//New Image set$im=new images();//Sends headers and
Help with forum quoting?
Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter and facebook with the @ sign to start it off, however even though im good at php coding and have
Unable to retreve the values from Mysql Query
Hi, Here is the php code that I have, Query is running properly in phpmyadmin and is resulting 5 which is correct but when i try to get tht in php its not printing the value $sql_query=
Login Control?!
I have a Web Site that uses the login control also I have set the destinationurl to the page I want to go to when logged in.