Mysql recordset inconsistent returns
I am developing a php site using mysql and apache.
I have finally managed to get a database connection and am
trying now to create some recordsets.
This is where the difficulties lie.....
I have 14 tables, the majority of which are for drop down
menus. - All these (Single columns) return recordsets with no
problems.
The two main relational tables have multiple columns.
If I select a the majority of single selected columns, I have
no problem but there are two columns where no recordset is
returned. I have tried renaming these columns with no effect. The
sql query seems fine and does work with all but two columns.
Can ayone explain this inconsistency?
Is it something to do with field definition?
I am really dying for any help here.
Show us some that work and some that don't, please. And tell
us what the
result of each is.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"RichardOMarketing" <[email protected]>
wrote in message
news:ejfclu$q4e$[email protected]..
> DW has made this relatively easy as it provides the
column names in a drop
> down
> menu once you have connected successfully to the Mysql
database.
>
> I did try a general query with * but this didn't work so
I tried a more
> specific query with the relevant column name.
>
> As I have mentioned, some select queries work and some
don't.
>
Similar Messages
-
Inconsistent Return Code from exec on RedHat Linux
I am calling a simple command from the RunTime exec.
/bin/cp file1 file2 file3
This should fail and it returns a two line stderr output. The problem is that it also returns an exitValue of 0. When run from the shell, it always returns 1. Any idea where the "1" is going to under Java?
I have seen it return the 1 on about 2 of 10 tries. The inconsistent return is also curious to me.I did use waitFor. After searching through the bug reports, I found that it is an actual bug that was in 1.4.1_02. I downloaded 1.4.2 beta and they have fixed the problem there.
Thanks for you input -
Hoping one of you mySQL gurus can help me with a bit of a pickle.
I have two tables:
1: Dogs
2: Litters
What I need to do is pull the male and female dog from the list of dogs.
Example in brief form:
Table One (Litters)
litters_id
litters_male
litters_female
Table two (Dogs)
parent_id
parent_name
parent_picture
parent_notes
etc ....
My input form would have two drop down fields listing the dogs ..
Male: (Dropdown Menu 1)
Famale (Dropdown Menu 2)
Each of these drops successfully put the parent_id value into the litters_male and litters_female respectively.
What I need to do is to display on a page from the litters recordest the dog names and other info related to each dog within the same recordset.
So I need to write a JOIN to join both the litters_male and litters_female to the parent_id field.
Is this possible?
Thanks in advance
BradMaybe if you see the actuall data structure ... ?
CREATE TABLE `litters` (
`litter_id` tinyint(3) NOT NULL auto_increment,
`litter_breed` tinyint(2) default NULL,
`litter_male` tinyint(3) default NULL,
`litter_female` tinyint(3) default NULL,
`litter_bred` varchar(32) collate latin1_german2_ci default NULL,
`litter_due` varchar(32) collate latin1_german2_ci default NULL,
`litter_notes` varchar(255) collate latin1_german2_ci default NULL,
PRIMARY KEY (`litter_id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci AUTO_INCREMENT=5 ;
-- Dumping data for table `litters`
INSERT INTO `litters` VALUES (1, 1, 11, 9, 'December 4, 2009', 'February 5, 2010', '');
INSERT INTO `litters` VALUES (2, 1, 12, 7, 'January 2010', 'March 2010', '');
INSERT INTO `litters` VALUES (3, 1, 12, 5, 'January 2010', 'March 2010', '');
INSERT INTO `litters` VALUES (4, 2, 1, 2, 'January 2010', 'March 2010', '');
-- Table structure for table `parents`
CREATE TABLE `parents` (
`parents_id` tinyint(3) NOT NULL auto_increment,
`parents_name` varchar(32) collate latin1_german2_ci default NULL,
`parents_sex` varchar(10) collate latin1_german2_ci default NULL,
`parents_breed` tinyint(2) default NULL,
`parents_notes` text collate latin1_german2_ci,
`parents_picture` varchar(64) collate latin1_german2_ci default NULL,
`parents_thumb` varchar(64) collate latin1_german2_ci default NULL,
PRIMARY KEY (`parents_id`)
) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci COMMENT='parent profiles' AUTO_INCREMENT=19 ;
-- Dumping data for table `parents`
INSERT INTO `parents` VALUES (1, 'Kremlin', 'Male', 2, '<p><span class="bodytext"><p>Where do I start...Kremlin has got to be one of the most georgeous Dogue De Bordeaux''s you will ever lay eyes on!  He has the pedigree to match as well!!  Kremlin is 2 years old, was born at Riverbend Bordeaux Kennel in Kettle Falls Washington.  Thanks you so much Jody for allowing us to make him part of our family as well as the foundation of our breeding program.  We are extremely lucky!! </p> <p>Kremlin''s father was the famous Champion Riverbend''s Beefsteak.  He weighed 166 pounds of solid male Dogue De Bordeaux!  He is also world famous for his offspring producing many champions.  Beefsteak''s father was Champion Beefy T. Bad Boy.  Kremlin''s mother is Ella Van De Paterhoek who came straight from the world famous Van De Paterhoek Kennel in Belgium!  She was out of their most famous breeding pair International Champion Emberez Apollo and Bintje De Paterhoek.  His mother is also full sister to Champion Dillen Van De Paterhoek, Champion Effje Van De Paterhoek and the famous Champion Enferno Van De Paterhoek!!</p></span></p>', 'kremlin.jpg', NULL);
INSERT INTO `parents` VALUES (2, 'Sako', 'Female', 2, '<p><span class="bodytext">Sako is a Dogue De Bordeaux a.k.a French Mastiff.  She was born in Washington on December 8, 2008.  She has a very impressive background!! <br></span></p>', 'sako.jpg', NULL);
INSERT INTO `parents` VALUES (3, 'Anna Belle', 'Female', 1, '<p>"The Paw Palace Anna Supreme"<br><br> Anna is a beautiful and outstanding black and tan merle female! She was born in Louisiana on September 7, 2007. She weighs 4 lbs. Anna is a loving, playful and beautiful little girl with a very soft and vivid colored coat! <br><br>Anna is AKC and CKC registered!!</p>', 'annabelle.jpg', NULL);
INSERT INTO `parents` VALUES (4, 'Daisy', 'Female', 1, '<p>"Oneway Back From Iraq"<br><br> Daisy is white with cream colored markings. She was born in Wisconsin on July 27, 2006 . Daisy has the coby style body and weighs approx. 6 lbs. She is small but stocky! She also has a perfect little apple head and very loving personality! Daisy likes to mother and has taken on the responsibility of mothering all my other chi''s! <br><br> Daisy is Akc and CKC registered.<br><br>ONEWAY BACK FROM IRAQ Champions include<br><br>(4 generation): CH MT View''s Lil'' General</p>', 'daisy.jpg', NULL);
INSERT INTO `parents` VALUES (5, 'Journey', 'Female', 1, '<p><span class="bodytext"><p style="text-align: left;">"Journey Reins Supreme"</p> <p style="text-align: left;">This little sweetie comes to us from Missouri, She is AKC and CKC Registered.  Her Father is AKC Champion Rebound Black Russian.  He has 47 Champions out of 62 in his 5 generation pedigree!!!  Amazing!!  Her Mother is Davishall Lamars Wild Rose and almost every dog in her pedigree is Davishall bred so she is mostly stong Davishall foundation bloodlines.  She should be show quality and should turn out to be a dream!!! ...</p></span></p>', 'journey.jpg', NULL);
INSERT INTO `parents` VALUES (7, 'Oakie', 'Female', 1, '<p><span class="bodytext"><p style="text-align: left;"><em>"Felina''s Oakie Supreme"</em></p> <p style="text-align: left;">Oakie is a blue and tan female. Her Birthday is January 16, 2007 and she was born in Oklahoma. She is approx 8 lbs, she looks irredescant in the sun! She is a short coat and has the cutest little deerhead. She is so laid back and easy going, loves letting the pups chew on her!</p> <p style="text-align: left;">She is AKC and CKC registered. </p></span></p>', 'oakie.jpg', NULL);
INSERT INTO `parents` VALUES (8, 'Tikka', 'Female', 2, '<p><span class="bodytext">Tikka is our newest addition...thanks again to Jody of Riverbend Bordeaux for this georgeous girl!! She was born July 8,2009 in Washington. Her mother is Mitzi and her father is Kid. Kid''s mother is Junior Champion Amy and his father is Champion/Junior Champion Debonaire. They are from Kennel Z Orisku from the Czech Republic.  </span></p>', 'tikka.jpg', NULL);
INSERT INTO `parents` VALUES (9, 'Wistie', 'Female', 1, '', 'wistie.jpg', NULL);
INSERT INTO `parents` VALUES (10, 'Chico', 'Male', 1, '', 'chico.jpg', NULL);
INSERT INTO `parents` VALUES (11, 'Timber', 'Male', 1, '<p><span class="bodytext"><p style="text-align: left;">"Journey''s Supreme Tiny Timber Wolf"</p> <p style="text-align: left;">This tiny little man comes from Missouri and is AKC and CKC Registered! His Father is AKC Champion Rebound Black Russian.He has 47 Champions out of 62 in his 5 generation pedigree!!! Amazing!! His Mother is Ka-Lynn''s Pixie Dust at Lamar and has 5 champions out of 14 in her 3 generation pedigree.  He is super TINY and should do a tremendous job as our next stud!!</p></span></p>', 'timber.jpg', NULL);
INSERT INTO `parents` VALUES (12, 'Yogi', 'Male', 1, '<p style="text-align: left;"><em>"JK Littlesbugs Yogi Nobody Did Nothin"</em><strong><span class="bodytext"> </span></strong><span class="bodytext"><p style="text-align: left;">We at Supreme Chihuahua proudly present to you our newest addition Yogi! He was born in Pennsylvania on June 18, 2006, and later moved to Orlando, Florida. From there he came to make his permanent home here with us at Supreme Chihuahua! We consider ourselves very fortunate to have aquired this beautiful and tiny one of a kind extreme applehead chihuahua stud! Yogi is a 2 lb 6 oz teeny tiny blue fawn with white markings.<span style="font-style: italic;"> </span><em>He has 55 CHAMPIONS in his 6 generation pedigree...WOW!! </em>We are very excited to see what he will produce here at Supreme Chihuahua...I know his pups will be tiny and awesome! You will have a hard time finding these perfect qualities anywhere else!</p><p style="text-align: left;">Yogi is AKC and CKC registered.</p><p style="text-align: left;"></p><p style="text-align: left;"><em>JK LITTLESBUGS YOGI NOBODY DID NOTHIN</em></p> <p style="text-align: left;"></p><p style="text-align: left;"><em>CHAMPIONS INCLUDE (4 GENERATION):</em></p> <p style="text-align: left;"></p><p style="text-align: left;"><em>CH Ostreet Twenty-Four Seven</em><br><em>CH Cam''s Buttontop Beau</em><br><em>CH Durbin''s Atom</em><br><em>CH Davishall Black Bark O''BK</em></p> </span></p>', 'yogi.jpg', NULL); -
[php+mysql] recordsets inside recordset?
Hi all,
is there a way to use a recordset result inside the SELECT
statement of
another recordset?
Something similar to:
SELECT myotherrecordsetresult FROM mytable WHERE
myfield=mycondition ORDER
BY mysortfield ASC
The variable "myotherrecordsetresult" would be text similar
to this:
"myotherrecordsetresult"="mycolumn1, mycolumn2, mycolumn...n"
I'm searching a way to display only columns specified by
another recordset.
Is this possible in dreamweaver or only by hand?
Thanks in advance.
tonyLook into the subquery syntax:
http://dev.mysql.com/doc/refman/5.0/en/subqueries.html
It lets you do things like this:
SELECT * FROM t1 WHERE column1 = (SELECT column1 FROM t2);
Sonjay
On 9/11/08 3:42 AM, "sweetman" wrote:
> Hi all,
> is there a way to use a recordset result inside the
SELECT statement of
> another recordset?
>
> Something similar to:
>
> SELECT myotherrecordsetresult FROM mytable WHERE
myfield=mycondition ORDER
> BY mysortfield ASC
>
> ?
>
> The variable "myotherrecordsetresult" would be text
similar to this:
>
> "myotherrecordsetresult"="mycolumn1, mycolumn2,
mycolumn...n"
>
> I'm searching a way to display only columns specified by
another recordset.
>
> Is this possible in dreamweaver or only by hand?
>
> Thanks in advance.
>
> tony -
MySql Selecting Database returns HTTP 500 Internal Server Error
The Test returns success and my database is displayed in the Bindings section but there are still errors when selecting the 'Select' Button
The most likely cause is that MMHTTPDB.php and mysql.php scripts are not created inside the _mmServerScripts folder. Have a look here Using the Server Behaviors extension to enable Server Behaviors & DB features in Dreamweaver CC - YouTube
-
Dreamweaver MySQL recordset connection problem
Hi,
I'm trying to create a recordset for the first time in
Dreamweaver MX but am having problems getting the connection with
the database to work.
I have set up a MySQL database on my server (which I have
checked and is OK), checked that PHP is running and have connected
Dreamweaver to the server successfully ( in "Edit Sites" the
"remote info" & "testing server" tests show a successful
connection).
When I try to connect to the database I get this sequence of
events:
1. Dialigue box: "Retrieving information from public_html"
2. Dialigue box: "Waiting for server" (with progress bar)
3. Dialigue box: "Dreamweaver cannot determine the remote
server time. The Select Newer and Synchronise commands will not be
available."
4. Spinning ball for a few minutes (I'm using Mac OSX)
5. back to "Waiting for server" dialogue box which remains
for ages, eventually I click "cancel"
6. "An unexpected error occurred"
If anyone can shed any light on what I might be missing I
would appreciate it greatly.
Thanks - ZaphodzI am a newby to databases and am having a similar problem
with asp and my remote sql database. My hosting provider told me to
use this script:
<%
Dim DBName,DBUser,DBPass,objRS,objConn
DBName="cham_members"
DBUser="cham_member"
DBPass="mypassword"
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DRIVER={MySQL ODBC 3.51
Driver};Server=localhost;Database="&DBName&";UID="&DBUser&";pwd="&DBPass&";"
objConn.Open
Set objRS=Server.CreateObject("ADODB.Recordset")
%>
Since that code doesn't work with DreamWeaver's Databases
panel Custom Connection String dialogue box I came up with this
one:
DRIVER={MySQL ODBC 3.51
Driver};Server=localhost;Database=cham_members;UID=cham_member;PWD=mypassword;objConn.Ope n
Set objRS=Server.CreateObject(ADODB.Recordset)
It connected but doesn't show my tables. I followed all the
advice I found here;
1. Connect using the "Use passive FTP"
2. Corrected a few illegal hyphens in my database.
3. Tried MySQL 127.0.0.1:3306 which would not connect at all
4. Remove Connection Scripts. No change.
5. I have been running DreamWeaver 7.01 update.
I noticed the database connection names come up in the
"Connections" folder so I opened the file it had just created and
pasted in the script my hosting company gave me. Still no luck. I
am determined to learn to create dynamic websites so I really
appreciate your help.
Thanks, Ann Y. -
Using PHP variable inside MySQL recordset
Can someone let me know if this is possible? I'm trying to
use a variable inside a recordset. The code below is what I have at
present but it white screens me when I try open it the page in the
browser. $qualificationchoice is the variable (line 3)
mysql_select_db($database_con_rsca, $con_rsca);
$query_rs_Instructorsearch = sprintf("SELECT * FROM
rsca_users WHERE rsca_public_region = %s AND
rsca_public_"$qualificationchoice" = %s",
GetSQLValueString($colname_rs_Instructorsearch,
"text"),GetSQLValueString($colname2_rs_Instructorsearch, "int"));
$rs_Instructorsearch =
mysql_query($query_rs_Instructorsearch, $con_rsca) or
die(mysql_error());
$row_rs_Instructorsearch =
mysql_fetch_assoc($rs_Instructorsearch);
$totalRows_rs_Instructorsearch =
mysql_num_rows($rs_Instructorsearch);Any chance you can help me with phase 2.
I'm trying to get determine $qualificationchoice by the
setting of a form menu $_POST['qualification']
I know I'm close but it just won't quite work
Here's what I have right now:
if (isset($_POST['qualification'])) {
$colname2_rs_Instructorsearch = (get_magic_quotes_gpc()) ?
$_POST['qualification'] : addslashes($_POST['qualification']);
//code to set qualification choice
if($_POST['qualification']==1) {$qualificationchoice="CWA";}
elseif ($_POST['qualification']==2)
{$qualificationchoice="SPA";}
elseif ($_POST['qualification']==3)
{$qualificationchoice="WGL";}
elseif ($_POST['qualification']==4)
{$qualificationchoice="ML";}
elseif ($_POST['qualification']==5)
{$qualificationchoice="MLW";}
elseif ($_POST['qualification']==6)
{$qualificationchoice="MIA";}
elseif ($_POST['qualification']==7)
{$qualificationchoice="MIC";}
elseif ($_POST['qualification']==8)
{$qualificationchoice="guide";}
// code to set qualification choice ends
$colname_rs_Instructorsearch = "-1";
if (isset($_POST['region'])) {
$colname_rs_Instructorsearch = (get_magic_quotes_gpc()) ?
$_POST['region'] : addslashes($_POST['region']);
mysql_select_db($database_con_rsca, $con_rsca);
$query_rs_Instructorsearch = sprintf("SELECT * FROM
rsca_users WHERE rsca_public_region = %s AND
rsca_public_{$qualificationchoice} = 1 AND rsca_public_listme =1
AND expired =0", GetSQLValueString($colname_rs_Instructorsearch,
"text"));
$rs_Instructorsearch =
mysql_query($query_rs_Instructorsearch, $con_rsca) or
die(mysql_error());
$row_rs_Instructorsearch =
mysql_fetch_assoc($rs_Instructorsearch);
$totalRows_rs_Instructorsearch =
mysql_num_rows($rs_Instructorsearch);
?>
Any suggestion would be great
Thanks
Dave -
Forum - php/mysql - recordset
Current Recordset:
SELECT id, threadid, postersname, topic, message, dateposted,
threadstarter, mypicurl FROM forum WHERE threadstarter = '1' ORDER
BY id DESC
repeat region displays results. Since the where clause limits
to only those that started threads, there are no duplicate topics.
Now I want to add two things to the results:
1. display the number of replies to the topic (i.e. all the
records that match the same threadid as the above recordset in the
repeat region, but where threadstarter = '0' )
I would also like to display the last person to enter a reply
(i.e. threadid matches the threadid of the recordset repeat region
and is the last entry in database).
How can I do this. I want to minimize my calls / recordsets
to accomplish this.jsteinmann wrote:
> Current Recordset:
> SELECT id, threadid, postersname, topic, message,
dateposted, threadstarter,
> mypicurl FROM forum WHERE threadstarter = '1' ORDER BY
id DESC
>
> repeat region displays results. Since the where clause
limits to only those
> that started threads, there are no duplicate topics.
>
> Now I want to add two things to the results:
>
> 1. display the number of replies to the topic (i.e. all
the records that match
> the same threadid as the above recordset in the repeat
region, but where
> threadstarter = '0' )
>
> I would also like to display the last person to enter a
reply (i.e. threadid
> matches the threadid of the recordset repeat region and
is the last entry in
> database).
>
> How can I do this. I want to minimize my calls /
recordsets to accomplish
> this.
You want a sub-query in your SQL, you basically put another
select
statement in brackets followed by AS ColumnName where
ColumnName is the
new name of that column. Make sense? If not I will try to
explain a
little more.
Dooza
Posting Guidelines
http://www.adobe.com/support/forums/guidelines.html
How To Ask Smart Questions
http://www.catb.org/esr/faqs/smart-questions.html
How To Report A Bug To Adobe
http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform -
Use MySQL recordset with JCheckbox
hi.. i am working on a simple java application that run on the user pc locally... the application is some sort of bill management.. when the user click customer the program will get the list from the database and display on the JTextField with checkboxes beside every record in Frame A.. the user could select those check boxes and click on example status.. the program will go to Frame B with all the data being selected at Frame A??
i am trying to find out how do i link the recordset with the check box so that the i got do the transfer from frame A to frame B?The records will probably have a unique ID value bound to them. A simple hack is to set that ID as the name property of the checkbox (setName()). Then in frame B you can investigate which checkboxes were selected in frame A, get the ID values from the names and fetch the (more complete?) data from the database again.
A slightly cleaner solution would be to maintain the checkboxes and ID values in a simple datastructure you create yourself. It can be as simple as a storage bean with two properties which you store in a List collection. -
Can anyone help me sort this out.
This code should spit out only the records that match a URK parameter $courscode but whatever I do it returns every record. I just can't figure out why?
$query_rs_dates = sprintf("SELECT * FROM dates09 UNION SELECT * FROM dates10 WHERE coursecode = '$coursecode' ORDER BY id", GetSQLValueString($colname_rs_dates, "text"));
$rs_dates = mysql_query($query_rs_dates, $con_tyf) or die(mysql_error());
$row_rs_dates = mysql_fetch_assoc($rs_dates);
$totalRows_rs_dates = mysql_num_rows($rs_dates);
Can anyone tell me where I am going wrong.
Cheers
DaveDon't worry, I have fixed it.
Seems you have to have the WHERE bit first for each table. Like this:
SELECT * FROM dates09 WHERE coursecode = '$coursecode') UNION (SELECT * FROM dates10 WHERE coursecode = '$coursecode')
Sorry if I put anyone to any trouble. But maybe this will help someone with the same problem in the future
Cheers
Dave -
Recordset.updateString returns SQL exception?
Hi,
I have the following code:
statement2 = connection2.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
System.out.println(queryString);
rset = statement2.executeQuery(queryString);
for (i=1; i <= totalRecords; i++){
rset.next();
rset.absolute(i);
//...more conditional logic...
rset.absolute(i);
rset.updateString("CLLI", theoreticalClli); //theoreticalClli already has a value
rset.updateRow();
} I get an SQL exception at the rset.updateString part, does anyone know how I can resolve this?
Thanks very much in advance for your time and help.What is the advantage of using the recordset modify functions? Isn't it more understandable to keep it as pure SQL? It seems like once you start mucking with your own copy of information that mutual exclusion problems would become a nightmare- that is the point of transactions on a database, to keep things unified. But what do I know? Is it actually modifying the database itself, or a copy of it?
-
DW8 Recordset behavior returns empty TEXT type values
So I have DW8 generating a recordset (ASP/VBScript from SQL
Server) using
just the basic behavior. If I don't set any criteria and it
retrieves all
records, it shows all data for each record, including the
values contained
within the "Text" type field.
If I specify a unique identifier value (to retrieve only one
specific
record), the DW recordset shows all details EXCEPT the text
found in the
"text" type field. Doing a TEST of the recordset this way
shows "undefined"
in that field, and of course, on the page, its blank. I could
workaround
this by using a "varchar" type or some other, but I'm then
more limited on
amount of text alotted.
Anyone run into this before and have an idea on what I need
to do so that
the text blob is pulled into the unique recordset like it
does for all of
the other field types?Don't use SELECT *.
List the columns you're retrieving. Put all TEXT, NTEXT, and
IMAGE columns
at the end of your select list. If you have more than one,
list them from
left to right in the same order in which they're defined in
your table.
If you're using SQL Server 2005, use VARCHAR(MAX) instead of
TEXT.
"_adrian" <test@ test.com> wrote in message
news:ekinf4$71$[email protected]..
> So I have DW8 generating a recordset (ASP/VBScript from
SQL Server) using
> just the basic behavior. If I don't set any criteria and
it retrieves all
> records, it shows all data for each record, including
the values contained
> within the "Text" type field.
>
> If I specify a unique identifier value (to retrieve only
one specific
> record), the DW recordset shows all details EXCEPT the
text found in the
> "text" type field. Doing a TEST of the recordset this
way shows
> "undefined" in that field, and of course, on the page,
its blank. I could
> workaround this by using a "varchar" type or some other,
but I'm then more
> limited on amount of text alotted.
>
> Anyone run into this before and have an idea on what I
need to do so that
> the text blob is pulled into the unique recordset like
it does for all of
> the other field types?
> -
PHP & MySQL recordset question
Hello all,
I've been searching for a while, and I can't seem to find an
answer, so sorry if this has been asked a lot.
I've got 5 tables that have similar information (id,
firstname, lastname, topic, thread, and date).
What I'm trying to do is have one search box where the user
types in a keyword. Then it searches all 5 tables in both the topic
and thread collumns. Then it displays the results from all 5 tables
and orders them by date.
I'm using dreamweaver 8, PHP, and MySQL.
I've tried to use this format:
SELECT column1 column 2
FROM table1
WHERE thread OR topic LIKE %variable%
UNION
SELECT column 1 column2
FROM table 2
WHERE thread OR topic LIKE %variable%
ORDER by date DESC
but keep getting error messages.
Is this possible? If so, can anyone help me figure out how to
do this, or where I can find a good tutorial?
Thanks.Thanks for your reply.
Sorry, here is the entire SQL statement:
SELECT eventforum.FirstName, eventforum.LastName,
eventforum.topic, eventforum.Thread, eventforum.`Date`
FROM eventforum
WHERE Thread or topic LIKE %colname%
UNION
SELECT fundforum.FirstName, fundforum.LastName,
fundforum.topic, fundforum.Thread, fundforum.`Date`
FROM fundforum
WHERE Thread OR topic LIKE %colname%
UNION
SELECT generalforum.FirstName, generalforum.LastName,
generalforum.topic, generalforum.Thread, generalforum.`Date`
FROM generalforum
WHERE Thread OR topic LIKE %colname%
UNION
SELECT persupport.FirstName, persupport.LastName,
persupport.topic, persupport.Thread, persupport.`Date`
FROM persupport
WHERE Thread OR topic LIKE %colname%
UNION
SELECT prosupport.FirstName, prosupport.LastName,
prosupport.topic, prosupport.Thread, prosupport.`Date`
FROM prosupport
WHERE Thread OR topic LIKE %colname%
UNION
SELECT soldier.FirstName, soldier.LastName, soldier.topic,
soldier.Thread, soldier.`Date`
FROM soldier
WHERE Thread OR topic LIKE %colname%
ORDER BY 'Date' DESC
the variable colname is defined as:
Name: colname
Type: Text
Default Value: -1
Runtime value: $_POST['searchbox']
here is the error message that I get with this setup:
Missing type for variable:colname
If I remove the variable and the WHERE statements, I get this
error message:
MySQL Error #: 1271
Illegal mix of collations for operation 'UNION'
If I remove the variable, the WHERE staements, and the ORDER
BY statement, I get the following error message:
MySQL Error #: 1271
Illegal mix of collations for operation 'UNION' -
Mysql query returns different number of records from coldfusion and navicat
Hi
I'm hoping that someone can suggest a basic strategy to debug this.
I have a fairly large and complicated query that is executed by a function in a cfc.
It returns (for example) 100 rows.
If I use cfdump and then copy and paste the SQL of the query (with the variables, of course) into Navicat and execute exactly the same query on the same mySQL database, it returns 130 rows.
Same SQL string, same database, same data - the only difference is that in one instance Navicat submits the query and in the other, Coldfusion does.
Has anyone ever had anything like this happen before?Ok I found my own bug. Of *course* the sql queries were not identical.. they could not possibly have been. My mistake was thinking that they were.
The problem was part of the WHERE clause:
AND orderid in (500,503,505)
In the coldfusion code this was
AND orderid in (<cfqueryparam cfsqltype="cf_sql_varchar" value="#lstOrderID#">)
which of course rendered in mySQL as AND orderid in ('500,503,505')
This was not immediately apparent as the cfdump returns this as AND orderid in (?) with the variable in the array below. -
Hi,
Scenario: I loop through a recordset, and at each iteration I pass the data to a dataBean, that I then pass to a thread that is then started.
For some reason whether it is the speed of the box, the second iteration of the loop contains data that is somehow populated into what has been passed to the first thread. Is something screwed with the recordset - altho this has not happened before and cannot be replicated except in production env!! - I am wondering whether it could be the speed of the box (as it works perfectly well on other unix/xp env).
I am not sure whether it is really JDBC, I return the recordset, then return the connection to a connection pool.
Any suggested solutions would be appreciated, thanks.
<code>
public ResultSet myData() throws Exception
Connection conn = getConnection();
try
CallableStatement stmt = conn.prepareCall( mySql );
return stmt.executeQuery();
catch (Exception e)
throw new Exception( e.toString() );
finally
returnConnection( conn );
public myMethod()
RecordSet rs = myData();
while rs.Next()
dataBean.setA(rs[1]);
myThread me = new myThread(dataBean);
me.start();
</code>Ok, that is sound advice, I have altered the code so that it does not close and return the connection until the recordset has been iterated through.
Hopefully, this was the cause as I was unable to replicate and have now promoted to production this code change which I hope is the answer.
Maybe you are looking for
-
For a couple months now, every movie purchase through iTunes fails to transfer to my iPhone or iPad giving me the error: "some of the items in the iTunes library, including were not copied to the iPad because you are not authorized for them on this c
-
X2100 M2 how to use a virtual CDROM
Hi, I just got 5 new X2100 M2 servers. One of the nice features of our X4200 is the ability to mount a CDROM or iso image from your workstation on the server using the builtin ip-kvm. The X2100 M2 should be able to do this too according to the manual
-
PDF links open numerous pages in Firefox instead of saving file or opening it in preview
I changed by mistake an application opening PDF links from preview to firefox. Now it's a catastrophe as when I click on those they open thousands of new windows and everything stops working. I changed default program for PDF files to preview, but it
-
To send an email from outlook to SAP user in SAP
Hi, Is it possible to send an email from outlook to SAP user in SAP? Regards, Mizan
-
Hi there, I'm updating an old website made in GoLive CS2 to the new 5.1 version of JW player (coming from 4). The player now has to play mp4's instead of flv's in v4. Since it's been a while now I'm a bit puzzled where to put what, as v4 uses a diffe