Jump to content

[SOLVED] Dog Pedigree - 2 new problems with "Add Dog" form


Recommended Posts

Greetings to all!!!

 

I am now working on the final glitches on my Labrador database.  The first one is an AJAX problem - any AJAX experts out there!!

 

I have a field for the sire that uses a lookup wizard to filter all the names of the sires in the database.  It does that part fine - as you type in the name, it brings up the appropriate names.  The problem is that very often it will not let one click on the name on the list to fill the field.  The box becomes outlined in red and all one can do is see if the sire is there.  You cannot add the sire just by typing in his name - whether he is already there or not.

 

The second glitch is with the same field - sort of.  Once the sire's name is enteded [if one is lucky enough to get that far] I am wanting to find that name in the list of Labradors and get the ID for him and enter it into the SireID field.  Here is what I have so far as an event that is to run before the record is added:

 

"global $conn,$strPedigrees;

$str = "select ID from ".$strPedigrees." where RegName='".mysql_escape_string($values["Sire"])."'";

$rs = db_query($str,$conn);

if ($data = db_fetch_array($rs))

$values["SireID"] = $data["ID"];

 

 

return true;"

 

and here is the error message I get [note that the dog name in it is in fact the sire I was trying to add]:

 

"Technical information

Error type 256

Error description You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where RegName='Sandylands Gadabout'' at line 1

URL fortheloveoflabradors.com/labradors/Pedigrees_add.php? 

Error file /homepages/33/d208885282/htdocs/labradors/labradors/include/dbconnection.php

Error line 26

SQL query insert into `Pedigrees` 

Solution This is a general error. It occurs when thereis an error in event code or in SQL."

 

Help with either would be SO Appreciated!!!

 

 

 

 

Hi!  I am assuming it does.  Pedigrees is the name of the table - does that seem appropriate?  I must admit I did not understand why the $str was in front of it this time but I figured they must know [the folks that created the program that generates the database tables for me].  They seem to be a bit stumped on why it is not working.

 

Thanks!!

Hi Again!

 

.select ID from where RegName='Abbeystead Herons Court'

 

This is the result of echo string.  Note the table name is missing so I added it as plain ole Pedigrees and this is the new error message:

 

Technical information

Error type 8

Error description Use of undefined constant Pedigrees - assumed 'Pedigrees'

URL fortheloveoflabradors.com/labradors/Pedigrees_add.php? 

Error file /homepages/33/d208885282/htdocs/labradors/labradors/include/Pedigrees_events.php

Error line 1544

SQL query insert into `Pedigrees` 

 

I should have thought to do the echo myself!!  Thanks - I will remember this next time!

 

 

OMG!!  I tried this

 

global $conn;

$str = "select ID from Pedigrees where RegName='".mysql_escape_string($values["Sire"])."'";

echo $str;

$rs = db_query($str,$conn);

if ($data = db_fetch_array($rs))

$values["SireID"] = $data["ID"];

 

return true;

 

AND IT WORKED!!!!!  You are amazing!!!

 

One down and only one more to go.  I suspect the last one is going to be a toughy though!!!

If you look at the AJAX link in my sig you'll see the sample application does an incremental search similar to the one you described.

 

Enter 'A'

Displays Amsterdam, Andorra, Antwerp

 

Now add "N" so you have "An" and it displays Andorra, Antwerp

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.