Jump to content

forTheDogs

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.fortheloveoflabradors.com

Profile Information

  • Gender
    Female
  • Location
    Western Washington State

forTheDogs's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks - can you tell me which type of join to use if you are working with just ONE Table. Also, can anyone point me to a sample of a Join where just one table is being used? Thanks!
  2. Hi! I hope this is the correct way to present this! Any help would really be appreciated! WAMP Server 2.0 Apache Version du serveur: 5.0.45-community-nt Version du protocole: 10 Serveur: localhost via TCP/IP Version du client MySQL: 5.0.45 Extensions PHP utilisées: mysqli Applies ONLY to the table: pedigrees ID RegName SireID Sire DamID DAM I want to update the SireID in all the records in the 'pedigrees' table that have a name in the 'Sire' field but do not have a 'SireID' For each of these records using the same table-pedigrees and the name in the Sire field Find the record : WHERE the 'RegName' is the same as the name in the 'Sire' field Then take the 'ID' from that second record UPDATE the 'SireID' with the 'ID' I am using phpMyAdmin and am working within the table. I have tried using for example pedigrees1.RegName instead of just RegName for all of the fields. MY CODE (SELECT RegName, ID FROM pedigrees1 WHERE SireID <1) UNION (SELECT Sire FROM pedigrees2 WHERE Sire != "") UPDATE pedigrees SET SireID = pedigrees1.ID WHERE pedigrees1.RegName = pedigrees2.Sire SQL ERROR Message ( SELECT RegName, ID FROM pedigrees1 WHERE SireID <1 ) UNION ( SELECT Sire FROM pedigrees2 WHERE Sire != "" ) UPDATE pedigrees SET SireID = pedigrees1.ID WHERE pedigrees1.RegName = pedigrees2.Sire LIMIT 0 , 30 MySQL a répondu: #1064 - 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 'UPDATE pedigrees SET SireID = pedigrees1.ID WHERE pedigrees1.RegName = pedigre' at line 1
  3. I was able to make this work, although I don't understand why it did not work to begin with. I deleted the $message.="" Then instead of using $message to print out the script, I used "echo". for($i=1; $i<=3; $i++) { // Start FOR if(!empty($row_rs_photos['Photo'.$i])) { //START if echo "<tr><td><div align='center'><img src='images/db_images/".$row_rs_photos['call_name']. "/".$row_rs_photos['Photo'.$i]."'></div></td></tr>"; } //end IF } //End FOR } //End Show if recordset not empty Actually I should say this now works on my wamp server but not on my website.
  4. I just tried isset but it is not working either. Thanks for the suggestion though!
  5. Thanks to you both for your help! These did not work though. Now when I load the page, the source code for this table is <table> </table> Nothing there!! I have continued to work with it for some time now. I completely started from scratch and redid the whole page to be sure there was nothing there causing a problem that I did not notice. First I just changed to !is_null. Then I used the "for" statement. This is where I am now with the same result: <?php $message=""; for($i=1; $i<=3; $i++) { // Start FOR if(!empty($row_rs_photos['Photo'.$i])) { //START if $message.= "<tr><td><div align='center'><img src='images/db_images/".$row_rs_photos['call_name']. "/".$row_rs_photos['Photo'.$i]."'></div></td></tr>"; } //end IF } //End FOR } //End Show if recordset not empty ?> I've verified that the photos are in the correct place. I moved the photo that was in Photo1 to Photo2 to make sure the script was not quitting entirely after it found the !error or !is_null in Photo1. Any other ideas? thanks!
  6. Hi! I have a dynamic photo page in my website. Each record in the database has fields for 8 photos but there is not always 8 photos. The result is a broken image link for each field with a NULL value and I am trying to get around this. My code right now is: <?php } // Show if recordset empty ?> <tr><td><?php if ($totalRows_rs_photos > 0) { // Show if recordset not empty ?> <table width="600" align="center" class="contentTable"> <?php $message=""; $photo1=$row_rs_photos['photo1']; $photo2=$row_rs_photos['photo2']; if(!empty($photo1)) { $message="<tr> <td><div align='center'><img src='images/db_images/".$row_rs_photos['call_name']."/" .$row_rs_photos['photo1']."' /></div></td> </tr>"; } if(!empty($photo2)) { $message="<tr> <td><div align='center'><img src='images/db_images/".$row_rs_photos['call_name']."/" .$row_rs_photos['photo2']."' /></div></td> </tr>"; } } ?> There is NOT a photo in $photo1 but there is one in $photo2. I know that it is properly accessing the record and the ? filter shows in the url address but the page only shows the page title which is the dog's call name from the record set but it does not show the second row which should be showing record 'photo2'. Please let me know if you can see what I am doing wrong. I am very new to php and mysql. Thanks!!!
  7. Thanks but I granted myself all permissions when I set up the database and their are read permissions for the file I am trying to load [chmod 755]. Any other ideas? Thanks!
  8. Hi: This is the code I am using to import a csv file into my mysql database: LOAD DATA INFILE 'update1.csv' INTO TABLE pedigrees FIELDS TERMINATED BY ","; The file is in my home directory on the server. The permissions code is 755 for the csv file and I have all permissions for the database. The message I am getting is user not authorized; using password - yes. Do I need to add my database user name and password? I am logged in with the id and password I use to log in to the website server, not the one I use for the database itself. If this is what I need to do, what would the proper syntax be? This is the first time I have attempted to work on my database from php on my host's server that I have received any message about passwords or user IDs or authorizations and I have been adding, deleting, editing tables and fields without problem. Thanks so much!!
  9. 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!!!
  10. 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!
  11. 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!!
  12. 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!!!
  13. Whoops! I forgot to mention: if seeing the actual site would help, you can login as a guest at www.fortheloveoflabradors.com/labradors/login.php Sorry 'bout that!!
  14. Hi All!! I think this should be easy but I have not been able to find anything that gives me the proper syntax. This is what I want the following to do: We start off by getting the Sire ID from thisDog. Now I want that SireID fixed so that no matter how many times I go back to it. that Sire will be the same dog as he was the very first time. if (is_numeric($row['SireID'])) { $SireQ = $sql . ['SireID']; $SireR = mysql_query ($SireQ); $SireRow = mysql_fetch_array ($SireR, MYSQL_ASSOC); $SireRow = array ( 'RegName' => $SireRow['RegName'], 'SireID' => $SireRow['SireID'], 'DamID' => $SireRow['DamID'], 'Title' => $SireRow['Title'], 'Addl_Titles' => $SireRow['Addl_Titles']); Wow, I hope this makes sense!!!! Thanks!!!
  15. This is what I ended up with so that it works now even if the Sire or Dam ID are blank: /////// if (isset($PatGrandSireRow['SireID'])) $message.="<td valign=middle class=shade rowspan=8 colspan=1 width=170><small><small> PatGrandsire<br /><b>".$PatGrandSireRow['RegName']."</b></small></small></td>"; else $message.="<td valign=middle class=shade rowspan=8 colspan=1 width=170><small><small>Unknown</b></small></small></td>"; ///// Thank you so much for all your help!! I am so sorry you could not find your Lab in our database! What are his parents names? I don't recognize a kennel name in his registered name. You are my heroes!!!!!!!!!!!
×
×
  • 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.