View Full Version : Made New Table - How Do I Get Info?
evenmonkeys
12-24-2005, 12:04 AM
I've made a table called hamburger. This new table has three fields in it, cheese, pickles, and ketchup. I've made a very simple php file that I just want to display every single result on a custom vBulletin page. I'm using a page wrapper made by Dream, but I'm using a Plug-in right now to call for this file. I just want it to show like this...
<tr>
<td>
Field 1
</td>
<td>
Field 2
</td>
<td>
Field 3
</td>
</tr>
I just want it to display every result in the table. How can I do this?
Guest190829
12-24-2005, 02:16 AM
$query = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "tablename");
while ($fetch = $db->fetch_array($query))
{
//eval template bits
}
//eval main template
The above should give you a general idea of what is needed to be done.
HTH,
Danny
evenmonkeys
12-24-2005, 03:30 AM
w00t w00t! Perfect! Thank you.
This works:$query = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "tablename");
This doesn't work:$query = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "tablename WHERE field='yes'");
Why can't I use the WHERE command?
Marco van Herwaarden
12-24-2005, 08:25 AM
What does not work when you add the WHERE clause? Are you sure that there are rows meeting your criteria?
evenmonkeys
12-24-2005, 04:00 PM
I'm positive. My rows are:
id, date, title, desc, show
I've tried:
$query = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "tablename WHERE show='yes'");
I've tried:
$query = $db->query_read("SELECT id, date, title, desc, show FROM " . TABLE_PREFIX . "tablename WHERE show='yes'");
Nothin's workin.
Marco van Herwaarden
12-24-2005, 07:26 PM
Like i said, what is not working? You get an error? No rows returned?
Run the following query and post the results:
SELECT DISTINCT show FROM tablename
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.