| | |
Why won't work?
![]() |
•
•
Join Date: Oct 2009
Posts: 57
Reputation:
Solved Threads: 0
When i put in this code WHERE to='$username' won't work?
PHP Syntax (Toggle Plain Text)
<?php $connect = mysql_connect ("localhost","root","") or die (mysql_error()); mysql_select_db ("login4") or die (mysql_error()); session_start(); $_SESSION['username']; $username = $_SESSION['username']; $query = mysql_query("SELECT * FROM pm ORDER BY id DESC"); $message = '' ; while ($row = mysql_fetch_array($query)){ $id = $row['id']; $to = $row['to']; $from = $row['from']; $title = $row['title']; $date = $row['date']; $message .= "<tr><td><a href='viewpm.php?&id=".$id."'>".$title."</a><br /></td><td>".$date."<br /></td></tr>"; } ?> <table width="100%"> <tr><td>Title</td><td>Date</td></tr> <?php print $message; ?>
•
•
Join Date: Sep 2009
Posts: 607
Reputation:
Solved Threads: 70
0
#3 Oct 23rd, 2009
It should be this way, thats why -
provided your column name is 'to' in the pm table
PHP Syntax (Toggle Plain Text)
<?php $connect = mysql_connect ("localhost","root","") or die (mysql_error()); mysql_select_db ("login4") or die (mysql_error()); session_start(); $_SESSION['username']; $username = $_SESSION['username']; $query = mysql_query("SELECT * FROM pm where to='".$username."' ORDER BY id DESC"); $message = '' ; while ($row = mysql_fetch_array($query)){ $id = $row['id']; $to = $row['to']; $from = $row['from']; $title = $row['title']; $date = $row['date']; $message .= "<tr><td><a href='viewpm.php?&id=".$id."'>".$title."</a><br /></td><td>".$date."<br /></td></tr>"; } ?> <table width="100%"> <tr><td>Title</td><td>Date</td></tr> <?php print $message; ?>
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
![]() |
Similar Threads
- Need 2 techies for tech-support, work from home (Tech / IT Consultant Job Offers)
- Requesting shadowing work at home job (Software Development Job Offers)
- 3D Engine Developer Needed from India - Work from home (Web Development Job Offers)
Other Threads in the PHP Forum
- Previous Thread: Sorting an multidimensional array
- Next Thread: php mysql and pdo
Views: 240 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for PHP
access ajax apache archive array arrays auto beginner binary box broken buttons cakephp cart check checkbox class cms code curl database date directory display download dropdown drupal dynamic echo email error file files folder form forms functions header href htaccess html image images include insert ip java javascript joomla jquery limit link list login loop mail menu mlm mod_rewrite multiple mysql order output parse password paypal pdf php problem query radio redirect regex remote results script search security select server session sort source sql string table tutorial update updates upload url user validation validator variable video web website wordpress xml






