Jump to content

Getting error and i cant see why?


deansaddigh

Recommended Posts

$dateSQL = "SELECT arrival_date, departure_date
                    	FROM bookings WHERE client_id = $clientresults('client_id')
                    	Order BY id DESC LIMIT 1";
					$dateResults = $db->query($dateSQL);	
                        ?>                 	
					<td><?= $dateresults('arrival_date'); ?></td>
					<td><?= $dateresults('departure_date');?></td>

Link to comment
https://forums.phpfreaks.com/topic/187112-getting-error-and-i-cant-see-why/
Share on other sites

$dateSQL = "SELECT arrival_date, departure_date
                       FROM bookings WHERE client_id = '$clientresults('client_id')'
                       Order BY id DESC LIMIT 1";
                  $dateResults = $db->query($dateSQL);   
                        ?>                    
                  <td><?= $dateresults('arrival_date'); ?></td>
                  <td><?= $dateresults('departure_date');?></td>

 

I think thats it. From experience i've found that the WHERE something = something else the something else should be in 'something else'

 

Sorry changed to ' i just checked

I'm guessing your db class has an error reporting feature

echo mysql_error();

might do it. If not, check if the class has an error reporting feature

echo $db->mysql_error();

Also, might be worth you echoing your sql statement and seeing what it actually says when it's run

echo $dateSQL;

i cant see why

 

We could probably see the problem easier as well if you actually posted the error message(s.)

 

However, I'll guess it is a php parse error because your array syntax is incorrect. Arrays use [] around the index.

 

You also need to put {} around an array variable when it is inside of a double-quoted string (I also recommend only using full opening <?php tags) -

 

$dateSQL = "SELECT arrival_date, departure_date
                       FROM bookings WHERE client_id = {$clientresults['client_id']}
                       Order BY id DESC LIMIT 1";
                  $dateResults = $db->query($dateSQL);   
                        ?>                    
                  <td><?php echo $dateresults['arrival_date']; ?></td>
                  <td><?php echo $dateresults['departure_date'];?></td>

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.