PHP - Moved: Mysql Condition (join) Help
This topic has been moved to MySQL Help.
http://www.phpfreaks.com/forums/index.php?topic=321443.0 Similar TutorialsThis topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=351625.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=348196.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=306058.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321929.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=313679.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=323935.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=308347.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=308855.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=355229.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=359434.0 hello i have a mysql table and i want to display each row in a different page with an added condition, the code: Code: [Select] if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = $page-1; $qry="SELECT * FROM ordering WHERE userid='$page' AND email='$email' LIMIT 0,1"; $result = mysql_query($qry); while($row = mysql_fetch_array($result)){ echo "<div dir='rtl' charset='utf8'><h2>"," hover cam: ",$row['hover_camera'], "<br> stills: ",$row['stills'], "<br> video_photographers: ",$row['video_photographers'], "<br> increase: ",$row['increase'], "<br> video_edit: ",$row['video_edit'], "<br> digital_album: ",$row['digital_album'], "<br> photo_album: ",$row['photo_album'], "<br> small_digital_album: ",$row['small_digital_album'], "<br> video_clip: ",$row['video_clip'], "<br> magnets: ",$row['magnets'], "<br> comments: ",$row['comments'], "<br> date: ",$row['date'], "<br><br></h2></div>"; } $sql = "SELECT COUNT(userid) FROM ordering"; $result = mysql_query($sql,$link); $row2 = mysql_fetch_row($result); $total_records = $row2[0]; $total_pages = $total_records ; for ($i=1; $i<=$total_pages; $i++) { echo "<a href='myorders.php?page=".$i."'>".$i."</a> "; }; the table is as so: Code: [Select] CREATE TABLE IF NOT EXISTS `ordering` ( `userid` int(11) unsigned NOT NULL AUTO_INCREMENT, `hover_camera` varchar(10) DEFAULT NULL, `stills` int(5) NOT NULL, `video_photographers` int(5) NOT NULL, `increase` int(5) NOT NULL, `video_edit` varchar(10) NOT NULL, `digital_album` varchar(10) DEFAULT NULL, `photo_album` varchar(10) DEFAULT NULL, `small_digital_album` varchar(20) DEFAULT NULL, `video_clip` varchar(10) DEFAULT NULL, `magnets` int(10) NOT NULL, `comments` text NOT NULL, `date` date NOT NULL, `fname` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, PRIMARY KEY (`userid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; now to the problem: this code displays all the userid as page numbers however, the email condition is good only for part of the rows it's a little hard to explain, i'll try an example: suppose the email '1@1.com' is at rows 22,25 and 30 my code displays 30 page numbers and page 22 is user 22, page 25 is user 25 etc. what i want is to display only the page numbers of the pages with the conditional email, and if possible to display them as 1,2,3 instead of 22,25,30 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=320476.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=355951.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=332358.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=308424.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=312429.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=326580.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=306275.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=352310.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=321459.0 |