Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About SalientAnimal

  • Rank
    Advanced Member

Profile Information

  • Gender
  1. $result = mysqli_query($link,$sqlsearch)or die(mysqli_error()); while($row = mysqli_fetch_array($result)) { $store_code = $row['store_code']; $outlet_name = $row['outlet_name']; $address_0 = $row['address_0']; $address_1 = $row['address_1']; $address_2 = $row['address_2']; $address_3 = $row['address_3']; $address_4 = $row['address_4']; $contact_number_1 = $row['contact_number_1']; $contact_number_2 = $row['contact_number_2']; $license = $row['scanned_license']; $permit_renewal = $row['scanned_permit_renewal']; $identity_document = $row['scanned_identity_document']; $other
  2. Hi All, I'm trying to get my head wrapped around how to create a Table from a DB. I have no issues getting the information, and all the data is pulling through as expected. I just cant seem to get my layout of my table right. I have tried to draw a diagram of how I would like my table to be displayed. The left hand side of the table is pretty much static with the amount of rows always being static. Here there are 5 rows with headings, the 3 row / nested table returning an address section with 5 address rows, and the last row will return the contact number row with 2 contact numbers
  3. Somehow with my brain working overtime and not being a seasoned php script writer I didn't even think of doing this, although I know I have done it in the past. Thanks...
  4. Hi All, I am running a PHP script on a daily basis to import data into my database. THe PHP file is executed by my Windows Services. The PHP file is a LOAD DATA IN FILE script and looks like the below: LOAD DATA LOCAL INFILE '\master_import\\myfilename.csv' IGNORE INTO TABLE mydatabase.mytable CHARACTER SET latin1 FIELDS TERMINATED BY ',' ENCLOSED BY '"' IGNORE 1 LINES ( record_number , name , action_date , location , type_of_outlet .... ) ; The ENCLOSED BY '"' is where my problem lies, as I do not know how to use the '"' without PHP reading it as a " to close the script. Any help
  5. I've made some changes to this now and I have managed to get the entity code from the previous page to echo correctly. But what I can seem to get right is to now use this entity number that is passed to query my database and populate the form: $link = mysqli_connect("localhost", "username", "password", "db"); if(isset($_GET['entity_number'])) { $store_code = $_GET['entity_number'];} echo $entity_number; $sql = mysqli_query ($link,"SELECT id , username , entity_number , entity_name , address_0 , address_1 , address_2 , address_3 , address_4 , contact_number_1 , contact
  6. Hi all, I have a pretty basic front end system where specific details are displayed. There is also and edit button next to each record that is displayed however not all info about this record is displayed. When I click edit, I want a query to run on my next page, which will pre-populate the form with information from a query using the reference from the previous page. A basic example is: if(isset($_GET['entity_code'])) echo $entity_code; $sql = "SELECT id , username , region , entity_code , address_0 , address_1 , address_2 , address_3 , address_4 , contact_
  7. Thanks Jacques1, really appreciate the help. And it eliminates having to use the prepared statements and then dropping them after one use.
  8. The prepare statement is to compile the CSV file with a datestamp. I used it this way in MySQL Workbench to compile the export file with the datestamp. From my understanding on the research I did, this was the only way to add a datestamp to a file in MySQL Workbench.
  9. I can't say I am experienced at all in doing out files when it comes to PHP. Doing it under MySQL Workbench is a lot easier, so my question is really the principle of applying it. My understanding in PHP is that the actual query needs to be within Double quotation marks, however this becomes a challenge when taking the existing file / script directly from MySQL Workbench and trying to plug it into PHP. I'm unsure of how to apply this. That said, I'm going to attempt a change based on what you have said, let me see what the outcome is.
  10. The single quote you are referring to has a corresponding single quote after the .csv Although, this does work when run directly on MySQL Workbench, I'm not sure what needs to change for plugging it into PHP. This is what the working script in MySQL Workbench looks like: SET @exportfile = CONCAT("SELECT 'FILED_1' , 'FIELD_2' , .... UNION ALL SELECT * FROM mydatabasetable INTO OUTFILE 'E:/Data/exports/DailyExport/myoutputfile" , DATE_FORMAT( NOW(), '%Y%m%d') , ".csv' FIELDS TERMINATED BY ',' ENCLOSED BY '''' LINES TERMINATED BY '\r\n'" )
  11. Hi All, This is part of a PHP script that I am wanting to use to automate some daily data exports. The problem I am having, is adding a datestamp to my export file. The script itself works when executed in MySQL but not under PHP. Does anyone have any insight into how I can get this working? The error message I am currently getting is, and the part of php script I am running can be seen below. $sql1 = "SET @exportfile = CONCAT(SELECT 'FIELD_1' , 'FIELD_2' , .... UNION ALL SELECT * FROM mydatabasetable INTO OUTFILE 'E:/Data/exports/DailyExport/myexportfile" , DATE_FORMAT( NO
  12. Thanks guys, you answers really add a lot of value. And definitely help me in knowing where I need to do a lot more learning. @requinix The scripts would be just about exactly the same in each scenario yes, with the only difference being the column counts and the destination tables as mentioned. The party/s whom need to be notified of a failed / successful script in some instances may also differ, but this would not be often. @Jacques1 I was actually not aware of TWIG, so will be looking into making use of this and learning more about it. I broke the TSL certification, as I could not
  13. Thanks for your answer here requinix. Basically what I mean by a cleaner script really comes down to understand how to use and populate a mail and then send it via PHP mailer. My current script is made up of a lot of code from various sources, meaning I don't always fully understand what it is doing, and secondly, I have quite a bit of code repetition. Another problem would be that I am possibly using outdated source code. Here is an example of what I have / am using: <?php $sql1 = "USE mydatabase"; $sql2 = "TRUNCATE TABLE mytable"; $sql3 = "LOAD DATA LOCAL INFILE 'DataIm
  14. Hi All, I haven't made use of PHPMailer for quite sometime, as I had been in a different environment. I have noticed that the has been quite a few changes since I last used it, and after struggling the whole day to eventually get it working I am not entirely satisfied with the solution. Some background of what I am doing and will be using it for: I have a number of PHP Scripts that are executing through the use of *.bat files through windows Task Manager. The scripts execute running a number of tasks, and at the end of the task I need a mail to be sent with the results of the task i.
  • 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.