Jump to content

Molson31

Members
  • Posts

    12
  • Joined

  • Last visited

Molson31's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks. I am also wondering, does this have anything to do with character sets/collation? Also mysqldump only exports locally so it is still not useable for me. I need the file to go somewhere.
  2. There are two database dumps in question A) Local MySQL - When it exports blobs, it inserts escape character "\" before many characters such as LF, TAB and NUL B) Webhost MySQL - Using a custom PHP function, when it exports a blob, it does not have these escape characters I am trying to understand what this means and how to make either one like the either. At this point I am thinking the best way is to insert escape characters in the Webhost dump, so I guess the next question is which ones. I am wondering as well if this is something built-in somewhere that someone may know of.
  3. I can't do something like that. This is on typical business web hosting.
  4. Because I need the file to be saved to the user's PC, not where the MySQL database is located.
  5. Hello. My client and I are trying to figure out a strange issue with exporting blobs. We are trying to sync a WAMP based databse and local MySQL database. The problem is with blob columns. The issue: When exporting a blob, the local MySQL dump command inserts an escape character "\" before characters such as NUL, TAB and LF, and I am assuming a lot more. My PHP export function (opens a file, SELECT * FROM tbl, writes to the file) does not do this. The main issue is that my client cannot import my PHP dump files when there are blobs, which I suppose is because they are missing these escape characters. He can however re-import his own MySQL dumps. I know I could remedy by using PHP string replace functions to find each character and insert a '\' before it, but I don't know which characters will need to be escaped. I also feel like there is a more simple solution. For example this is what I have and it worked for a tiny 1 pixel image, but not for something complex: $val = str_replace(chr('NUL'), '\0', $val); $val = str_replace(chr(0x9), chr(0x5c).chr(0x9), $val); $val = str_replace(chr(0xa), chr(0x5c).chr(0xa), $val); Thanks
  6. Thanks for the reply. I was hoping to not change anything in project.php because there are tons of internal links all over the place in the js and php files and it would be a nightmare to add filepaths to them. I was hoping that I could have changed something in the index.php. Alas I will simply do this another way.
  7. I know what my problem is, but I'm not sure how to go about it. I am trying to include a php file with many includes (js, css, php) in another php file in a higher directory. I am using apache and run off localhost (this is an internal website). I have my main index /htdocs/index.php and the file I want to include. /htdocs/tables/php/projects.php When I include /php/projects.php in my index.php, as expected, all my links are broken to my js and css files, and even further nested php files (within js files). I believe I am supposed to DEFINE some kind of ROOT or DIR or something, but I am not having success Googling these things. Here is my code to look at: Index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>BLST</title> </head> <body> <?php $projectsPage = "/tables/php/projects.php"?> <li><a href="index.php?page=<?php echo $projectsPage;?>">Projects</a></li> <?php if(is_null($_GET["page"])) { $page = ""; }else{ $page = $_GET["page"]; } include($page); ?> </body> </html> projects.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Projects</title> <style type="text/css"> @import "css/test.css"; @import "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.23/themes/smoothness/jquery-ui.css"; </style> <script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.min.js"></script> </head> The error being that any css, js or php file in projects.php is not found, as the browser reports it is looking for these files from the main root. I want to be able to alter this without trying to add something to projects.php.
  8. I've got a new project which involves using a local MySQL database, something I've never had to do. What I need to accomplish is having a very typical online MySQL database that can communicate with another MySQL database on a local machine. This is what the flow chart would look like. Local PC <--> Local MySQL DB <--> Internet <--> Online MySQL DB <--> Website The local PC will only occasionally be online, to POST and GET new information to and from the Online MySQL DB. My questions are: Does the Local DB need a third-party application to POST and GET from the online DB? Does the Local PC have to be a server? Ie does MySQL need to be a service? I have learned about master-master replication but someone told me the Local PC would always have to be online, which I disagree; it could just poll occasionally. But I need to understand how a Local MySQL DB works; how can it connect to one on the web? Thanks and I hope this makes sense.
  9. Hello. I am having a disaster of a time trying to solve this. I am trying to update a PHP variable by using AJAX within a jQuery function. It's been two days and I am having no luck. I am also using jQgrid with is a jQuery API. Here is my situation: jQgrid is a jQuery API that looks like an excel sheet table (rows and columns, etc). I have a button that creates a PDF based on the row chosen. The rowID is determined based on a jQuery/jQgrid function from the API. I want to get that result out of the jQuery function and store it within the original page in a variable called $resultId. Main PHP page //------Custom PDF button------------// $getUnitID = <<<getUnitID //The jQuery function is created like this so that it can be called from another function in the API as seen at the end function(rowid, selected) { var selr= null; if(rowid != null){ selr = jQuery('#grid').jqGrid('getGridParam','selrow'); //This is the API telling me what row I have selected $.ajax({ type: "POST", url: "getId.php", //Supposedly I should be posting the result to another php page dataType: "json", data: {selr:selr}, success: function(data) { alert (selr) //This will accurately tell me what row I selected. But instead of an alert, I want it stored as a variable } }); getUnitID; //end of Jquery function $grid->setGridEvent('onSelectRow',$getUnitID); //From the jQgrid API, this is how the jQuery function is called (using the custom OnSelectRow function) //$resultId =0; //This is the var I want t o set $pdfButton = array("#pager",array("caption"=>"Create PDF", "onClickButton"=>"js: function(){parent.location='/pdftkphp/example/download.php?id=' ". $resultId ."}")); //This is the button, which is just a link and concats the $resultId $grid->callGridMethod("#grid", "navButtonAdd", $pdfButton); //Simply how the button is added to the jqGrid //-------------------------------------// getId.php <?php if (isset($_POST["selr"])) { $rId = $_POST["selr"]; echo $rId; } ?> So all this does is execute the script, sends it to the other php page, and returns the result as an alert. Instead of an alert, I wish to have the result stored as a variable. Then that variable can be passed to the button link. The problem, I think, is that once the PHP page is loaded, it's done, right? I cannot change $resultId.. but, there must be a way. I am thinking, does the whole entire main PHP page need to be loaded in an AJAX function? Basically, the variable I want is stuck inside that JQuery function to (getUnitId). I just want the result of the function to be passed back to the same page I am in or use some work-around to do so. Thank you so much.
  10. well I figured it out. At least I made a dirty code that works. But Typing this out did help! So check it out. For whatever reason (probably old/lazy design, because the rest of the stuff is fantastic) you have to set a paramater in jqform (and jqgrid) that points to the url/filename of the file itself. Kind of redundant but it does not work with out it. So if you had Form.php included in your Main.php, in Form.php you must set this variable: $newForm->setUrl('Form.php'); The problem was, after this is called, my query becomes useless as it no longer is looking at the query run in Main.php (such as Main.php?value=1235) So my workaround: first I have to GET the value passed from the URL, then post that in to the setUrl, the GET that again and post it in the SELECT command. Here is the solution I will keep for the records. $firstVal = $_GET['RealValue']; $newForm->setUrl('Form.php?val='. $firstVal .''); $value = $_GET['val']; $newForm->SelectCommand = 'SELECT OrderID, ShipName FROM orders WHERE OrderID = '. $value .'';
  11. I am using jqforms to create simple forms and populate them from SQL data. This works fine when hard coded (eg search for ID with value x). However when I try to populate from $_GET values, it does not work, and I am going insane trying to understand why. First there is a simple PHP with my website menu (Main.php). Then it php-includes the php file (Form.php) containing my form. <?php include ("Form.php");?> This works and the forms work 100%. The URL accessed: www.website.com/Main.php?val=10254 In Form.php there is a simple SQL Select command. 'SELECT OrderID, ShipName FROM orders WHERE OrderID = '. $value .''; Above this, as a test, the $value is simply hardcoded. $value = 10254; This loads the database perfectly to the correct ID. It echoes this exact line (I realize echo will break the rest of the code, but just to test the output): SELECT OrderID, ShipName FROM orders WHERE OrderID = 10254 Okay. So everything is fine. Now here is the problem. Replace the hard-coded $value with: $value = $_GET['val']; It will echo this: SELECT OrderID, ShipName FROM orders WHERE OrderID = 10254 Which as you can see is the exact same thing as hard coded. And yet, remove the echo, and it will not load. What the hell is going on? I have lost 2 days so far because of this! It is literally echoing the same thing so why does it do nothing? My only guesses are how the value is being passed, and something to do with including the Form.php in the Main.php. The only reason I do that is that is how the jqform works (it for some reason does not work if you copy-paste the Form.php contents into Main.php... weird). Thank you for any help.
×
×
  • 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.