Ok. Here is what I'm trying to accomplish. I am saving the changes to a forms textarea so that all the changes that have been made to that textarea can be viewed. Like a string of comments. I've gotten the data into the two tables. I need help getting it back out.
İki "worklog" tabloları ve "worklognotes" veri var.
worklog bir textarea olan bir formdan iş emirleri bir dizi $ spec denir
worklognotes textarea $ spec yapılan değişikliklerin bir çalışan listesi
Değişiklikler veriler doğru iş düzene uyumlu olacak yapılır, böylece worklognotes ben worklog_id olarak kaydedilir worklog gelen kimliği var.
Ben sadece iyi worklog gelen bilgileri görüntüleyebilirsiniz. Ama ben worklognotes gelen bilgi göremiyorum. Amacım worklognotes gelen verileri görüntülemek ve worklognotes.worklog_id = worklog.id worklognotes kayıtları görüntülemek için
Bu mantıklı umuyoruz. Bu gibi yazma yardımcı olmuştur.
İşte kullanıyorum sorgu ifadeleri olduğunu. Yardımlarınız için teşekkürler.
$connection=mysql_connect ("localhost", "foo", "bar") or die ("I cannot connect to the database.");
$db=mysql_select_db ("database", $connection) or die (mysql_error());
$query = "SELECT * FROM worklog WHERE id=$id LIMIT 0,1";
$sql_result = mysql_query($query, $connection) or die (mysql_error());
$connection2=mysql_connect ("localhost", "foo", "bar") or die ("I cannot connect to the database.");
$db=mysql_select_db ("database", $connection2) or die (mysql_error());
$query2 = "SELECT * FROM worklognotes,worklog WHERE worklognotes.worklog_id=worklog.id ORDER BY worklog_id DESC";
$sql_result2 = mysql_query($query2, $connection2) or die (mysql_error());
- Devam - 09-13-10
Tamam burada değiştirilmiş sorgu
$connection = mysql_connect ("localhost", "adsites_seth", "callie") or die ("I cannot connect to the database.");
$db = mysql_select_db ("adsites_cerebra", $connection) or die (mysql_error());
$query = "SELECT * FROM worklog ";
$query .= "LEFT JOIN worklognotes ON worklog_id = worklognotes.worklog_id ";
$query .= "WHERE worklog.id=worklognotes.worklog_id ORDER BY worklognotes.worklog_id ASC";
$sql_result = mysql_query($query, $connection) or die (mysql_error());
I have four entries in the worklognotes table and all four are displaying on one page. I only need the one entry that belong to the worklog I'm viewing and if the is no entry. Display nothing.