Jump to content

glennn.php

Newly Registered
  • Posts

    251
  • Joined

  • Last visited

Everything posted by glennn.php

  1. need results from a db search where a = 'value' AND b = 'any', if that makes sense. "WHERE id = '2' AND name = '' gives me nothing (if the 'name' search option is left empty)... thanks for your help. G
  2. is that SELECT s.petition_sig FROM Petitions p INNER JOIN Signatures s ON p.petition = s.petition WHERE p.petition_auth = 2 ?
  3. email me at glenn at glennnall dot com if you don't succeed. i'll help
  4. ok, I have two tables: Petitions +------------------+-----------------+ | petition | petition_auth +------------------+-----------------+ | 1 | 1 | 2 | 2 | 3 | 2 +------------------+-----------------+ Signatures +------------------+-----------------+ | petition | petition_sig +------------------+-----------------+ | 1 | glenn | 1 | bob | 2 | alice | 3 | jane +------------------+-----------------+ i have lost my mind and cannot figure out how to get JUST the Signatures for ALL of the petitions belonging to Author 2. i'm not very good with JOINs, but i'm not even sure that that's necessary. could someone lend a hand? thanks GN
  5. the errors are telling you that the correct data for connecting to the db are not being supplied. it thinks your username is 'myusername' and the correct db data is missing. somewhere you have a file that stores the four variables necessary: db username = 'myusername'; db password = ''; db host = 'localhost'; db = 'the name of your databse'; find that and supply the correct data, and make sure it's being included in this file, like: require_once('bookmark_fns.php'); include("db file with the variables");
  6. brilliant on both of you - this worked great for ($i=1;$i<41;++$i) { if (${'p'.$i} != '') $pagetext .= ${'p'.$i} . "<br>\n"; } lots less code. thanks both of you... see Options and Price columns at the bottom here: http://custom-shipping-cases.com/site5/item-details.php?pageid=234 http://custom-shipping-cases.com/site5/item-details.php?pageid=160
  7. ok - $o* are data retrieved from a db, so i can do $o = array(); $o[0] = '$01'; $o[1] = "$02"; ... ? looks like that's what i want instead of 40 if() statements... i'll let you know... thanks
  8. i have a LONG column of variable, only some of which contain a value, at different times, i.e. $pagetext .= $o1."<br />"; $pagetext .= $o2."<br />"; $pagetext .= $o3."<br />"; $pagetext .= $o4."<br />"; $pagetext .= $o5."<br />"; $pagetext .= $o6."<br />"; $pagetext .= $o7."<br />"; $pagetext .= $o8."<br />"; $pagetext .= $o9."<br />"; $pagetext .= $o10."<br />"; $pagetext .= $o11."<br />"; $pagetext .= $o12."<br />"; $pagetext .= $o13."<br />"; $pagetext .= $o14."<br />"; (it's much longer) - i don't think i want to apply an if($o1 != "") statement to each one, or even a switch()... i'm sure there's a way to print these ONLY if they contain a value, but i'm not good enough to know how this might be done. can someone with some exp. show me how i might accomplish this? (they go o1 through o40) i really appreciate it. GN
  9. didn't think so - i'll just do it column by column then. thanks for your help
  10. ) - no, 'any field' meant 'any field throughout the table' instead of SET 'field_name' = NULL - i'm looking for a wildcard for all the fields, because the only ones that contain 0.00 would be the ones i don't want in there. what happened is i converted an excel file to an sql file and the query turned all the empty fields into 0.00 where i had it set to decimal. i'd rather not reconvert the entire thing again.
  11. i've overlooked that checkbox for i dunno how long... thanks - i only have about fields that are 0.00 - is there an UPDATE table SET ''any field" = NULL where "any field" = '0.00'; ? thanks for your help. G
  12. "Warning: #1366 Incorrect decimal value: 'NULL' for column 'P-15' at row 1" is decimal(5,2) the reason? perhaps there's a better setting for this fieldtype? i spose i could just set it to varchar (11) and be done with it...?
  13. they're ALL NULL already - when i try to delete the fields with 0.00 the error is "#1366 Incorrect decimal value: '' for column 'P-15' at row 1" (it's set to decimal(5,2))
  14. i'm not quite up on when to apply NULL and when not to, and i really want my decimal (5,2) fields to show NO value if there's not an actual value - when i ran a large sql INSERT all my empty fields were converted to '0.00' and phpmyadmin won't let me delete those values... won't decimal allow empty fields?
  15. THAT was it! thanks shlumph! 'preciate both of ya'll responding.
  16. has nothing to do with CSS - the html, "<a href..." should be parsed in the output like page.php instead of being printed verbatim, like "<a href=\"\">page</a>" also, i'm not calling an xml file. this AJAX function is used to call all kinds of files, images, etc...
  17. here's the whole thing: function getXMLHttp() { var xmlHttp; try { xmlHttp = new XMLHttpRequest(); } catch(e) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function refreshIt(divID, MyPage) { xmlHttp = getXMLHttp(); xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4) { setInnerText(divID, xmlHttp.responseText); } } xmlHttp.open("GET", MyPage, true); xmlHttp.overrideMimeType("text/html; charset=ISO-8859-1"); xmlHttp.send(null); return false; } function setInnerText(divID, response){ var el = (document.getElementById) ? document.getElementById(divID) : document.all[divID]; if(el) { el.innerText = response; } } <LI><A href="#slide-one" onClick="return refreshIt('contentarea1', 'quotes/twain.php')">Mark Twain</A></LI> <div id="contentarea1"></div> thanks!
  18. because of the AJAX, instead of getting parsed html in the output, page.php linked, i'm getting "<a href=\"page.php\">page</a>". it's occurring to me though that this is an AJAX/xmlhttp problem and not a php problem. my apologies...
  19. ok, simple question: when i do $string = "<a href=\"page.php\">page</a>"; echo $string; i'm getting the html characters, of course. (might be because i'm using a jquery, or ajax, i dunno, function to return this echo: function refreshIt(divID, MyPage) { xmlHttp = getXMLHttp(); xmlHttp.onreadystatechange = function(){ if(xmlHttp.readyState == 4) { setInnerText(divID, xmlHttp.responseText); } } xmlHttp.open("GET", MyPage, true); xmlHttp.send(null); return false; } ) i can't figure what function parses these into html format when i call the echo... how can i get this html printed properly? thanks, whomever... G
  20. well, that's probably true, since i'm a novice in mysql as well, but what i'm describing (poorly) is a different issue. let me explain better: i have a long series of if() conditions, MOST of which will call this long query: if ($var == "A") { // the LONG mysql_query using the changing variable $querypageid >> $query = "SELECT * FROM ".$prefix."pagetops WHERE page_type='".$querypageid."'"; $mainresult = mysql_query($query); if (!$mainresult) { die(mysql_error()); } while ($row = mysql_fetch_assoc($mainresult)) {... } elseif ($var == "B") { // the LONG mysql_query using the changing variable $querypageid >> $query = "SELECT * FROM ".$prefix."pagetops WHERE page_type='".$querypageid."'"; $mainresult = mysql_query($query); if (!$mainresult) { die(mysql_error()); } while ($row = mysql_fetch_assoc($mainresult)) {... } elseif ($var == "C") { // the LONG mysql_query using the changing variable $querypageid >> $query = "SELECT * FROM ".$prefix."pagetops WHERE page_type='".$querypageid."'"; $mainresult = mysql_query($query); if (!$mainresult) { die(mysql_error()); } while ($row = mysql_fetch_assoc($mainresult)) {... } elseif ($var == "D") { ... i'm trying to prevent that LONG mysql_query from being repeated over and over MAKING THE FILE VERY LONG when i'm sure it can be written as a function or something and just called like so: if ($var == "A") { mysql_function($querypageid); } i think that makes more sense. i'm just trying to get that long query in my first post stuck into some kind of function i can call; i appreciate anyones help...
  21. i have a LOT of if statements/switches that will all run the same query but with a couple of different values, namely this: $query = "SELECT * FROM ".$prefix."pagetops WHERE page_type='".$querypageid."'"; $mainresult = mysql_query($query); if (!$mainresult) { die(mysql_error()); } while ($row = mysql_fetch_assoc($mainresult)) { $page_heading = $row['page_heading']; $page_desc = $row['page_desc']; $prod_name_head = "Part #"; $prod_dim_head = "Dimensions"; $prod_desc_head = "Description"; $prod_image_head = "Picture"; $prod_link_head = "Price"; $pagetext = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" id=\"page_table\">"; $pagetext .= "<tr><td class=\"td_top\">"; $pagetext .= $page_heading; $pagetext .= "</td></tr>"; $pagetext .= "<tr><td class=\"td_top\">"; $pagetext .= $page_desc; $pagetext .= "</td></tr></table>"; $pagetext .= "<br />"; $pagetext .= "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" id=\"page_table\">"; $pagetext .= "<tr><td class=\"td_headings\" width=\"110\">"; $pagetext .= $prod_name_head; $pagetext .= "</td><td class=\"td_headings\" width=\"110\">"; $pagetext .= $prod_dim_head; $pagetext .= "</td><td class=\"td_headings\" width=\"315\">"; $pagetext .= $prod_desc_head; $pagetext .= "</td><td class=\"td_headings\" width=\"145\">"; $pagetext .= $prod_image_head; $pagetext .= "</td><td class=\"td_headings\" width=\"100\">"; $pagetext .= $prod_link_head; $pagetext .= "</td></tr>"; } $query = "SELECT * FROM ".$prefix."prods WHERE page_type='".$querypageid."'"; $mainresult = mysql_query($query); if (!$mainresult) { die(mysql_error()); } while ($row = mysql_fetch_assoc($mainresult)) { $part_no = $row['part_no']; $prod_dim = $row['prod_dim']; $prod_desc = $row['prod_desc']; $prod_image = $row['img']; $prod_link = $row['link']; $prod_mfr = $row['mfr']; $pagetext .= "<tr><td class=\"td_left\">"; $pagetext .= $prod_mfr." <br /> ".$part_no; $pagetext .= "</td><td>"; $pagetext .= "dimensions here..."; $pagetext .= "</td><td>"; $pagetext .= $prod_desc; $pagetext .= "</td><td align=\"center\">"; $pagetext .= "<img src=\"".$prod_image."\" />"; $pagetext .= "</td><td>"; $pagetext .= "<a href=\"".$prod_link."\">Click Here</a>"; $pagetext .= "</td></tr>"; } $pagetext .= "</table>"; the only difference being the variables, of course. i don't want my file full of that long code repeated so many number of times, so i'd like to put it all in a function, or something that i can call under these conditions... does that make sense? can someone show me how i'd do that? i'd try to create a function with it, but i'm not sure how i'd get the values passed to the variables in the query as a function. i'd surely appreciate any help someone might offer... regards, gn
  22. yes, BOTH of those are awesome. thanks much guys
  23. ok. i'm sending a thanks email in html via this method (and i don't have to do it this way): $template = 'welcome.php'; $fd = fopen($template,"r"); $message = fread($fd, filesize($template)); mail($to,$message, etc...) this is so my client can edit the html. BUT. what i really need to do is stick a value (registrant's name) in the variable that will be in the welcome.php that will be sent, "Hello, $newuser...". have i made that difficult/impossible using fread() since the welcome.php is really not being opened? can someone help me with this? thanks much oh - i tried $template = 'welcome.php?name=name'; but that didn't work...
  24. you're right. damn PHP Version 4.4.9 anything i can do?
×
×
  • 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.