|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Unknown Column
<?php
$conn = mysql_connect("", "", "") or die(mysql_error()); mysql_select_db("falserraj",$conn) or die(mysql_error()); $get_topics = "select topic_id, topic_title, date_format(topic_create_time, '%b %e %Y at %r') as fmt_topic_create_time, topic_owner from forum_topics order by topic_create_time desc"; $get_topics_res = mysql_query($get_topics,$conn) or die(mysql_error()); if (mysql_num_rows($get_topics_res) < 1) { $display_block = "<p><em>No Topics Exist.</em></p>"; } else { $display_block = " <table cellpadding=3 cellspacing=1 border=1> <tr> <th>TOPIC TITLE</th> <th># of POSTS</th> </tr>"; while ($topic_info = mysql_fetch_array($get_topics_res)) { $topic_id = $topic_info['topic_id']; $topic_title = stripslashes($topic_info['topic_title']); $topic_create_time = $topic_info['fmt_topic_create_time']; $topic_owner = stripslashes($topic_info['topic_owner']); $get_num_posts = "select count(post_id) from forum_posts where topic_id = $topic_id"; $get_num_posts_res = mysql_query($get_num_posts,$conn) or die(mysql_error()); $num_posts = mysql_result($get_num_posts_res,0,'count(post_id)' ); $display_block .= " <tr> <td><a href=\"showtopic.php?topic_id=$topic_id\");> <strong>$topic_title</strong></a><br /> Created on $topic_create_time by $topic_owner</td> <td align=center>$num_posts</td> </tr>"; } $display_block .= "</table>"; } ?> I am getting the following problem with my code - Unknown column 'topic_create_time' in 'field list' any help would be appreciated, thanks |
|
#2
|
|||
|
|||
|
Stupid me, i had a spelling mistake in the mysql table.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Unknown Column |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|