Forum Moderators: coopster
The trouble is the select statement, as it is below it will not echo any results, but if I just ask for products1 only, the results will echo perfect.
Can you cast your i's over my code and see if I am missing a bit.
I have only put some of the code, the rest is the echo.
limit = 5;//Limit of results here
$page = $_GET['page'];//Gets the page
$totalrows = @mysql_num_rows(mysql_query("SELECT * FROM products1, products2, products3 WHERE offer = 1 "));//Get the total rows of the table
if(empty($page))//If the page is empty
{
$page = '1';//sets the page to 1
};
$start = ($page-1)*$limit;//set the start page
$start = round($start,0);//rounds it
$result = @mysql_query("SELECT * FROM products1, products2, products3 WHERE offer = 1 ORDER BY STOCKCODE LIMIT $start, $limit");//makes the query, here you can add for example
//WHERE something='somethingelse'
while ($r = @mysql_fetch_array($result))
{
echo statement here, (if you need this i can post complete.)
Thanks in advance
Ski
Thanks for your reply, but I have confused myself by changing some of the text, this is what it should be, as not sure if I could post the table names.
"SELECT * FROM construction, socketry, automotive WHERE offer= 1 ORDER BY STOCKCODE LIMIT $start, $limit"
construction, socketry, automotive being my table names, as i am selecting a number of feilds from the tables.
My echo is,
echo "<h4> $r[title] $r[stockcode]<br> <p class=offertext> $r[offertext] </p> </h4>";
echo " $r[nail] ";
$length = 255;
$shortdiscription = substr_replace($r["discription"], "....", $length);
echo "<p> $shortdiscription </p>";
echo "<ul><li><p class=more><span class=box> TV $r[price] </span></li> ";
echo "<li><span class=box> SALE $r[onoffer] </span></li> ";
echo "<li><span class=box> $r[morelink] </span></p> </li></ul>";
I am a new b so please forgive me as this pagination is a massive step for me.
Thanks for your help
Ski
The construction is the same
<<<<<
p1.products1, p2.products2, p3.products3
FROM
products1 p1, products2 p2, products3 p3
WHERE
p1.offer=1 AND p2.offer=1 AND p3.offer=1
>>>>>>
1)You find an abbreviation that you makes sense to you usually one, two or three letters coming from each table you need querying, add a “dot” followed by the table full name, add a comma and space (space’s not mandatory) after each table but the last one.
2)So it looks like the above p1.products etc...
3)Then you supply data for the FROM section which calls the tables and define their “JOIN” name; here p1 p2 etc…
4)From there any clause needs to mention how they are related to any tables such as: WHERE p1.offer=1 it could be p1.offer=$whatever or p1.offer=p2.my_stuff
Try this and post how you are doing with it
If you are going nowhere post in plain English your tables and columns name
And what you really need achieving
You do not need posting “REAL NAME” just use a synonym that makes sense for you and for us :)