Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Select Where (varchar) not int

New Here ,
May 18, 2010 May 18, 2010

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

TOPICS
Server side applications
505
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 18, 2010 May 18, 2010
LATEST

You need to wrap quotes around any SQL text values.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines