Skip to main content
Known Participant
May 18, 2010
Question

Select Where (varchar) not int

  • May 18, 2010
  • 1 reply
  • 498 views

I am building a nested repeat region table.

I have a problem with my final query though.

If my table is INT - ie numbers not text this works.

  <?php do { ?>
    <tr>
      <td colspan="2" bgcolor="#00FF00"><?php echo $row_Recordset1['name']; ?></td>
    </tr>

<?php
mysql_select_db($database_sol_greyhound, $sol_greyhound);
$query_Recordset2 = "SELECT * FROM test Where sid = ".$row_Recordset1['cid'];
$Recordset2 = mysql_query($query_Recordset2, $sol_greyhound) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>

BUT

If my database is VARCHAR and not INT - they are words then it doesnt work.

It doesnt like this line

$query_Recordset2 = "SELECT * FROM test Where sid = ".$row_Recordset1['cid'];

I have tried Like instead of =.

Any ideas please.

Any great links to nesting repeat region tables

thanks

Simon

This topic has been closed for replies.

1 reply

Participating Frequently
May 18, 2010

You need to wrap quotes around any SQL text values.