Jump to content

One query works, one doesn't. Need a second set of eyes


beanfair

Recommended Posts

I have tested both of these queries in PHPMyAdmin and they work great. When I try to call those queries and data bind, one works and one doesn't. I can't see where the problem is.

This works

<?php $meeting = $wpdb->get_row("SELECT *, date_FORMAT(startDate, '%M %e, %Y') as newDate FROM sfa_meetings WHERE meetingID = 163");?>

<h3><?php echo $meeting->newDate; ?></h3>
<h2><?php echo $meeting->title; ?></h2>

This does not

<?php $location =$wpdb->get_row("SELECT locID, locName, address, city, zip, drive, locDesc, comments FROM locations WHERE locID =7 ");?>
<h3><?php echo $loc->locName; ?> </h3>

I am stumped.  :confused:

Both code blocks appear on this page http://174.123.219.170/~romancew/meeting-test but I have also tried the code blocks on separate pages to make sure they weren't interfering. The first code block works whereever I put it but not the second.

Any assistance is appreciated!

That was a typo after too many hours staring at the code. Here is the code as it appears on the test page

This works

[/<?php $meeting = $wpdb->get_row("SELECT *, date_FORMAT(startDate, '%M %e, %Y') as newDate FROM sfa_meetings WHERE meetingID = 163");?>

<h3><?php echo $meeting->newDate; ?></h3>
<h2><?php echo $meeting->title; ?></h2>php]
This does not 
[code=php:0]<?php $location =$wpdb->get_row("SELECT locID, locName, address, city, zip, drive, locDesc, comments FROM locations WHERE locID =7 ");?>
<h3><?php echo $location->locName; ?> </h3>

 

Here is subsequent code on that page

<table>
<tr><td>Registration Begins</td><td><?php echo $meeting->regTime; ?></td></tr>
<tr><td>Business Meeting Begins</td><td><?php echo $meeting->busTime; ?></td></tr>
<tr><td>Feature Begins</td><td><?php echo $meeting->featureTime; ?></td></tr>
<tr><td>Adjourn</td><td><?php echo $meeting->adjournTime; ?></td></tr>
<tr><td>Location</td><td><?php echo $location->locName; ?></td></tr>
<tr><td>Address</td><td><?php echo $location->address; ?></td></tr>
<tr><td></td><td><?php echo $location->city; ?>, CA  <?php echo $location->zip; ?></td></tr>
<tr><td>Directions</td><td><?php echo $location->drive; ?></td></tr>
<tr><td>Questions?</td><td><?php echo $meeting->email; ?></td></tr>
</table>

The test page is at http://174.123.219.170/~romancew/meeting-test

Thank you!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.