Jump to content

eliZZZa

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

eliZZZa's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh my, I did it!!! Thank you so much for your help! Hugs & kisses >;o) eliZZZa
  2. I think I need some "for letters a through z... and then my code...", right? Could you please help me with the "for letters a through z"-part? Thank you in advance eliZZZa
  3. Okay, I managed to generate the A-Z index with PHP. Now I am trying to do the listing task >;o)
  4. Thanks for your answers, yes, what I want, is to create a loop, which generates each div including the listings. I think I will be able to manage it according to your advice. I try it and let you know! Meantime - Thanxalot! eliZZZa
  5. Hi Freaks! I'm a beginner on PHP and mySQL and I need your help with writing a query more efficiently. I am querying data from a mySQL database resulting in alphabetical lists of persons. What I do (and I am sure, there is a more elegant way for it) is repeating the following query for every list. Is there a way to write the query only once? Your help is very much appreciated! The page with the query can be found under crimezzz dot net slash avis slash index dot php =====START CODE===== <?php $db = mysql_connect("localhost", "dbxxxxx", "xxxxx"); mysql_select_db("xxxxx",$db); # How many entries $result = mysql_query("SELECT * FROM person WHERE 0100_lastname LIKE \"A%\" ORDER BY 0100_lastname ASC",$db); $num = mysql_num_rows($result); echo "<h4>$num Entries</h4>\n"; # Ende Wieviele Einträge # Start query if ($myrow = mysql_fetch_array($result)) { do { $forwardid = $myrow["forward_noyes"]; # IF forward if ($forwardid == 2) { $string = $myrow["0120_case_code"]; $folderv = $string{0}; printf ("<li><span class=\"fwd\">></span> %s %s =><br /><a class=\"forward\" href=\"http://www.crimeZZZ.net/serialkillers/%s/%s.php\">%s</a></li>\n", $myrow["0100_lastname"], $myrow["0110_firstname"], $folderv, $myrow["0120_case_code"], $myrow["0120_case_code"]); } # STANDARD Eintry else { //Query Color Gender aus source_gender, in Übereinstimmung mit Ziffer aus 0300_gender $genderid = $myrow["0300_gender"]; $gender = mysql_query("SELECT * FROM source_gender WHERE id = $genderid"); if ($rowgender = mysql_fetch_array($gender)) { do { printf ("<li><span class=\"%s\">\n", $rowgender["gender"]); } while ($rowgender = mysql_fetch_array($gender)); } else { printf (""); } # Query recent_status $statusid = $myrow["0600_recent_status"]; $status = mysql_query("SELECT * FROM recent_status WHERE id = $statusid"); $rowstatus = mysql_fetch_array($status); $string = $rowstatus["name"]; $stringfirst = $string{0}; printf ("%s</span>\n", $stringfirst); $string = $myrow["0120_case_code"]; $folderv = $string{0}; $string = $myrow["0300_gender"]; $genderv = $string{0}; printf ("<a href=\"http://www.crimeZZZ.net/serialkillers/%s/%s.php\" class=\"gender%s\">%s %s</a> <img src=\"images/flags/%s.png\" alt=\"%s\" /> \n", $folderv, $myrow["0120_case_code"], $genderv, $myrow["0100_lastname"], $myrow["0110_firstname"], $myrow["1601_crcounty1"], $myrow["1601_crcounty1"]); printf ("<span class=\"suspected\">%s</span></li>\n", $myrow["1830_victims_suspected"]); } } while ($myrow = mysql_fetch_array($result)); } else { echo ""; } ?> =====END OF CODE===== added code tags ~ CV
  6. WOW - I´m overwhelmed by all of your replies! Many thanks, I am right now going, if I get it to work. Everything runs out of a huge MySQL database anyway, I even managed to set up lookup tables and to query them (I have no idea about PHP, but I am good in copy-paste+logic >;o)) I will give feedback, if I succeeded >;o) eliZZZa
  7. Don´t know, if the title is correct for my request. What I want to achieve: A select list in a form should grow with every data entry. Example: I have a list of towns to choose from for a single entry. If there is a town, not in the list, I would like to have the option to enter one in a text field. Next time I approch the input form, the newly entered town shows up in the select list. What do I have to do, to expand the select list (resp. the table behind)? Thanks in advance and kind regards from Austria eliZZZa
  8. Hi Barrand, thank you for your reply too - it sounds promising, but I don´t know, how to use your comment ??? eliZZZa
  9. Hi Shamilton, first of all, great thanks for your prompt reply. I don´t get it running (sorry for being sooo dummy :'( I wrote the following (did I get it right?): $personid = $myrow["id"]; $countryshort = mysql_query(" SELECT crimeC.destinationid, allC.shortname FROM crime_countries crimeC JOIN countries_all allC ON crimeC.destinationid = allC.ID WHERE crimeC.sourceid = $personid"); if ($countryshort != NULL) { printf ("<div id=\"flag\"><img src=\"http://www.crimeZZZ.net/images/flags/%s.gif\" /></div>\n", $countryshort["shortname"]); } else { printf ("\n"); }
  10. Hi php freaks, I am addicted, but unfortunately no pro yet. So I kindly ask for your help. I wrote a mySQL statement, which works, but I am sure, there is a more efficient way to write this. Could you please help? //Request crime_country $personid = $myrow["id"]; $countryid = mysql_query("SELECT destinationid FROM crime_countries WHERE sourceid = $personid"); $country = mysql_fetch_array($countryid); $countryshort = mysql_query("SELECT shortname FROM countries_all WHERE id = $country[destinationid]"); if ($countryshort != NULL) { $countryshortarr = mysql_fetch_array($countryshort); printf ("<div id=\"flag\"><img src=\"http://www.crimeZZZ.net/images/flags/%s.gif\" /></div>\n", $countryshortarr["shortname"]); } //Ende Request Thank you in advance and kind regards from Austria eliZZZa http://www.crimeZZZ.net/ A sample listing using the above statement can be viewed under http://www.crimeZZZ.net/serialkiller_index/xtemplate_a.php
×
×
  • 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.