Jump to content

mikosiko

Members
  • Posts

    1,327
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by mikosiko

  1. drop the %'s and use the escape "\" default character before the dot or define your own escape character using ESCAPE
  2. the posted code seems no to be the one causing the error... is nothing called "Campout" on it
  3. @ignace: seems that we are talking exactly about the same or we missed each other point at all.. I'm not sure
  4. Ignace gave you some points... but again, the relation that you implement is going to be determined by your business model.. sometimes you want/need to have multiples users (related of course) sharing the same address or addresses ... depend on your specific needs. In the case that Ignace is explaining, if you have 2 related users sharing the same address(es) you will be duplicating information in your address table, therefore the table will be no normalized (which could be an option too). Example (as per your last post and apparently same Ignace idea): Users 1 Jhon Doe 2 Mary Doe (spouse) Address id address city zip addresstype userid 1 kitty Road 10 Atlanta 23245 1(home) 1 2 kitty Road 20 Atlanta 23248 2(comm) 1 3 kitty Road 10 Atlanta 23245 1(home) 2 instead of (using a bridge) Example (as per your last post and apparently same Ignace idea): Users 1 Jhon Doe 2 Mary Doe (spouse) Address id address city zip 1 kitty Road 10 Atlanta 23245 2 kitty Road 20 Atlanta 23248 User-Address id userid address-id type 1 1 1 1 2 1 2 2 3 2 1 1
  5. @mds1256: The method to choose depend on the kind of relationship that you want to implement in your example the bridge method will be useful if your user could have 0 or more addresses (Postal, Commercial, etc) the "same table" option that you show imply that the user will have only 1 (or 0) address.
  6. answer depends of your objectives.... - only the 14th row .. NO... - a groups of records that COULD include a 14th row... probably (if your table has 14 or more rows.) http://dev.mysql.com/doc/refman/5.0/en/select.html
  7. your code doesn't shows any sentence and/or logic to read/process the query resultset .
  8. the error is telling you that your query is wrong and didn't produce a valid result, hence mysql_fetch_array() failed too. $sql = "select * tbl_test"; and here the same topic was discussed today.. the suggestions there could help you to include improvements in your code http://www.phpfreaks.com/forums/index.php?topic=331080.0
  9. no it wasn't ... just referring you to a good source to find a lot of related topics... search for example: - php to excel export or - php to pdf and you will find hundred of examples/tools etc that will help you with your pursuit... hope that help
  10. one option: http://www.phpclasses.org/search.html?words=excel&x=0&y=0&go_search=1 and here are many more
  11. assuming that you capture your search criteria/fields in a form the process should be something along this lines (pseudo-code): - Capture your criteria/fields in a form (apply any validation that you need).. submit the form for processing. - In your processing script: //start with a NULL where clause $where_sql = NULL; // and a base sql $base_sql = "SELECT * (better if your specify the columns) FROM <your_table> "; // validate if you have at least one POSTed criteria if (// validate if nothing was posted...) { // do here what ever you need } else { // you have at least one POSTed criteria $where_sql =" WHERE "; // now validate and clean any POST value coming from the form and incorporate it to the WHERE clause pe. (very..very simplified): if (isset($_POST['domainlength'])) { $where_sql .= "tblfield_domainlength = {$_POST['domainlength']}" // adjust the operator that you need and sanitize the POST value } // etc.. etc.. etc // validate if the original WHERE was changed if ($where_sql != " WHERE ") { $final_sql = $sql . $where_sql; $query = mysql_query($final_sql); //etc.. etc } } the rest is for you to work on... lot of examples around
  12. that was my guess this select should replace ALL the select that you have (even the first one) SELECT branch, sum(if(currency = '£',absoluteTotal,0)) AS branchpound, sum(if(currency = '$',absoluteTotal,0)) AS branchdollar, sum(if(currency = '€',absoluteTotal,0)) AS brancheuro FROM invoice_out GROUP BY branch the rest is only display... try it.
  13. the basic idea is to construct your WHERE clause with whatever criteria(s) you are capturing in your search page and only then execute it with mysql_query()
  14. could you post more of your code? your SELECT looks no right to me, but I need to know what exactly are you trying to do to offer some further advice.
  15. @tommy... what fugix was trying to tell you is to enclose your code using the available tags in the editor to make it clear to read by others doing that your example code should looks like this: ... better right? mysql_select_db($database_process, $process); $result2 = mysql_query("SELECT parties.docid, GROUP_CONCAT(party SEPARATOR '<br>') AS partylist, documents.doctitle FROM parties INNER JOIN documents ON parties.docid=documents.docid WHERE parties.idcode = '$appidpassed' GROUP BY parties.docid LIMIT 1 ") or die(mysql_error()); while($row = mysql_fetch_array($result2)) { $doctitle = $row['doctitle']; $parties = $row['partylist']; } Now, you can use 2 sources to get the idea of how to solve your issue: a) this post from PFMAbisMad will show you how to work in your while loop to produce the expected results (look for the Reply#6, obviously you must adjust the code to your problem) (EDIT: I just noticed that you are using GROUP_CONTACT, therefore this part could not be necessary but good to know) and b) the TCPDF documentation and examples to produce the final result... specially take a look to the example #48 that looks appropriated for this case. In addition, you mentioned that you can see only one printed... most likely is because you are using LIMIT 1 in your select and that could be the only problem that you have. good luck
  16. this caught my attention: date/time support enabled "Olson" Timezone Database Version 2011.4 Timezone Database internal Default timezone America/Los_Angeles Directive Local Value Master Value date.default_latitude 31.7667 31.7667 date.default_longitude 35.2333 35.2333 date.sunrise_zenith 90.583333 90.583333 date.sunset_zenith 90.583333 90.583333 date.timezone no value no value the Default timezone is set but the last line date.timezone shows "no value"... I agree with Pica that most likely you have an error in your php.ini ... I'm guessing that you have a second line in some place with this (or similar): date.timezone = tested on my side and I can reproduce your issue exactly.... check that... maybe that is the problem.
  17. gizmola...you are not reading/analyzing my answers are you? .... but is ok... doesn't matter.... PBAb could be right.
  18. That is why I put the comment "assuming... etct..etc"... and "as there is no problem making multiple mysql connections"... is true only if you are not reaching the Max_connection limit defined for your installation
  19. your code is wrong... (content.php) while ($subject = mysql_fetch_array($subject_set)) { // Connect to mysql here or die $link = mysql_connect("localhost","root","OtlPHP07") or die("Unable to connect to host"); echo "$link"; echo "<li>{$subject["menu_name"]}</li>"; $page_set = mysql_query("SELECT * FROM pages WHERE subject_id = {$subject["id"]}", $connection); if (!$page_set) { die("Database query failed here: " . mysql_error()); you are creating a new connection inside of the loop (OUTCH!!!) and trying to execute a query over a connection ($connection) that not longer exist, hence the error... assuming that the posted code is the one that was failing when you started the thread
  20. a) http://www.php.net/manual/en/features.file-upload.php b) http://dev.mysql.com/doc/refman/5.0/en/load-data.html
  21. any reason why you need 2 queries? test this: (no tested on mi side but should work) $justOneQuery = "SELECT actualplanttable.id, actualplanttable.common, plantcolortable.color, plantmaintenancetable.maintenance FROM actualplanttable JOIN plantcolorlinktable ON plantcolorlinktable.plant_id = actualplanttable.id JOIN plantcolortable ON plantcolorlinktable.color_id = plantcolortable.id AND plantcolortable.color = '$color' JOIN plantmaintenancelinktable ON plantmaintenancelinktable.plant_id = actualplanttable.id JOIN plantmaintenancetable ON plantmaintenancelinktable.maintenance_id = plantmaintenancetable.id AND plantmaintenancetable.maintenance = '$maintenance'";
  22. c'mon Emonk what do you expect after a longggg weekend? that happens to all of us sometimes ... but most of the time answers are right on the spot so don't lose faith
  23. oops!! char() ... 0-255 varchar() 0-65535 main difference (other than the size limit) is the way that both are stored char() is fixed length (right-padded) and varchar() is variable length
  24. In my experience the only reasons that I've seen to do that (1-1 relationship) is to avoid null/optional columns (empty space) , to implement some kind of sub-typing, or if the table contains fields that are only used for a certain subset of the records. In case of space concerns, I would not bother and live with the empty space. I believe that the hassle it can cause to the development process simply isn't worth it (more "complex" queries/joins), space is cheaper than programming time. For sub-typing or tables with fields identified clearly as a subset most of the time split the model in 1-1 relationship make sense . But, then again, the decision to implement something like you are asking for depend of what exactly are you modeling and your business rules.
  25. no here $query = "INSERT INTO users (username, height_above, mb_diff, alternative, ppr) VALUES ('$username', '$height_above', '$mb_diff', '$alternative', '$ppr'";
×
×
  • 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.