Jump to content

HELP PLEASE! selecting rows using multiple sql statements


Recommended Posts

Hi all

 

I am developing a mysql/php database using Dreamweaver MX.

 

I have a page which selects rows from a number of recordsets. One of these recordsets selects from a table named notetaker. the criteria for selecting appropriate records are: a) from URL \"CustomerID\" and B) if field catagory = \"maintenance\". in dreamweaver mx this works:

 

SELECT *

FROM notetaker

WHERE CustomerID = colname

ORDER BY CtelNoteID ASC (see also below for full code)

 

BUT THIS DOES NOT:

 

SELECT *

FROM notetaker

WHERE CustomerID = colname AND notetaker.Catagory=\"maintenance\"

ORDER BY CtelNoteID ASC

 

I need to sort this sharpish, so quick help really appreciated.

 

cheers

 

***************** code **************************************

$colname_RSnotes = \"1\";

if (isset($HTTP_GET_VARS[\'CustomerID\'])) {

$colname_RSnotes = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS[\'CustomerID\'] : addslashes($HTTP_GET_VARS[\'CustomerID\']);

}

mysql_select_db($database_connDiamond, $connDiamond);

$query_RSnotes = sprintf(\"SELECT * FROM notetaker WHERE CustomerID = %s ORDER BY CtelNoteID ASC\", $colname_RSnotes);

$RSnotes = mysql_query($query_RSnotes, $connDiamond) or die(mysql_error());

$row_RSnotes = mysql_fetch_assoc($RSnotes);

$totalRows_RSnotes = mysql_num_rows($RSnotes);

 

*********************************************************

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.