abs0lut Posted June 2, 2008 Share Posted June 2, 2008 database structure I need to display this http://img301.imageshack.us/my.php?image=g1copydp0.jpg then, next page the iqids are the same with the first page the only difference is the userid(the one who post) and the cost he posted.. http://img219.imageshack.us/my.php?image=g2copysi2.jpg then next page iqids are the same.. cost userid3 and so on... could you please help me?? Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/ Share on other sites More sharing options...
LooieENG Posted June 2, 2008 Share Posted June 2, 2008 mysql_query("SELECT * FROM table WHERE where=something ORDER BY cid DESC") (or ASC for ascending order) Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-555298 Share on other sites More sharing options...
abs0lut Posted June 2, 2008 Author Share Posted June 2, 2008 I need to display the userid together with iqids and the cost he posted in every page.. 1 userid in every page.. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-555420 Share on other sites More sharing options...
abs0lut Posted June 6, 2008 Author Share Posted June 6, 2008 please help me.. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-558975 Share on other sites More sharing options...
Daniel0 Posted June 6, 2008 Share Posted June 6, 2008 Something like this? <?php $db = new PDO('mysql:host=localhost;dbname=something', 'username', 'password'); $stmt = $db->prepare('SELECT iqid, cost, stotal FROM table WHERE userid = :userid ORDER BY stotal'); $stmt->execute(array('userid' => $_GET['userid'])); echo <<<EOF <table> <tr> <th>iqid</th> <th>cost</th> <th>stotal</th> </tr> EOF; foreach ($stmt->fetchAll() as $item) { echo <<<EOF <tr> <td>{$item['iqid']}</td> <td>{$item['cost']}</td> <td>{$item['stotal']}</td> </tr> EOF; } echo '</table> '; ?> Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-558988 Share on other sites More sharing options...
abs0lut Posted July 6, 2008 Author Share Posted July 6, 2008 Something like this? <?php $db = new PDO('mysql:host=localhost;dbname=something', 'username', 'password'); $stmt = $db->prepare('SELECT iqid, cost, stotal FROM table WHERE userid = :userid ORDER BY stotal'); $stmt->execute(array('userid' => $_GET['userid'])); echo <<<EOF <table> <tr> <th>iqid</th> <th>cost</th> <th>stotal</th> </tr> EOF; foreach ($stmt->fetchAll() as $item) { echo <<<EOF <tr> <td>{$item['iqid']}</td> <td>{$item['cost']}</td> <td>{$item['stotal']}</td> </tr> EOF; } echo '</table> '; ?> whats the use of EOF? I couldn't understand OOP.. please help me. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-582661 Share on other sites More sharing options...
Daniel0 Posted July 6, 2008 Share Posted July 6, 2008 It's the heredoc syntax. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-582761 Share on other sites More sharing options...
abs0lut Posted July 8, 2008 Author Share Posted July 8, 2008 is execute a predefined function? Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-584207 Share on other sites More sharing options...
abs0lut Posted July 14, 2008 Author Share Posted July 14, 2008 whats the use of this symbol -> ?? Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-589199 Share on other sites More sharing options...
abs0lut Posted July 17, 2008 Author Share Posted July 17, 2008 bump.. please help me.. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-592260 Share on other sites More sharing options...
mmarif4u Posted July 17, 2008 Share Posted July 17, 2008 It represents Classes and objects in OOP. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-592263 Share on other sites More sharing options...
abs0lut Posted July 24, 2008 Author Share Posted July 24, 2008 Something like this? <?php $db = new PDO('mysql:host=localhost;dbname=something', 'username', 'password'); $stmt = $db->prepare('SELECT iqid, cost, stotal FROM table WHERE userid = :userid ORDER BY stotal'); $stmt->execute(array('userid' => $_GET['userid'])); echo <<<EOF <table> <tr> <th>iqid</th> <th>cost</th> <th>stotal</th> </tr> EOF; foreach ($stmt->fetchAll() as $item) { echo <<<EOF <tr> <td>{$item['iqid']}</td> <td>{$item['cost']}</td> <td>{$item['stotal']}</td> </tr> EOF; } echo '</table> '; ?> I entered http://domain.com/file.php?userid=5 in the address bar of browser the output is only the table header iqid cost total please help me.. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-598137 Share on other sites More sharing options...
abs0lut Posted July 25, 2008 Author Share Posted July 25, 2008 I already solved it.. Quote Link to comment https://forums.phpfreaks.com/topic/108310-solved-display-by-userid/#findComment-599816 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.