honkmaster
Members-
Posts
49 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
honkmaster's Achievements
-
Thank you so much, removed and it worked perfect. Thanks
-
Thanks, yes we are going update soon Below is the code but no fetch() mysql_select_db($database_workflow, $workflow); $query_rsB2Indigo = "SELECT * FROM stock_material WHERE stock_material.material_catagory = 'B2 Indigo' AND stock_material.material_status = 'Active'"; $rsB2Indigo = mysql_query($query_rsB2Indigo, $workflow) or die(mysql_error()); $row_rsB2Indigo = mysql_fetch_assoc($rsB2Indigo); $totalRows_rsB2Indigo = mysql_num_rows($rsB2Indigo); ob_end_clean(); $pdf = new TCPDF(); // add a page $resolution= array(210, 297); // set margins $pdf->SetAutoPageBreak(true, 20); $pdf->setCellMargins(0, 0, 0, 0); $pdf->setCellPaddings(0, 0, 0, 0); // Set default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // set default font subsetting mode $pdf->setFontSubsetting(true); $pdf->AddPage(); // Set some content to print $pdf->SetFont('Helvetica', 'B', 32); $pdf->SetTextColor(0, 0, 0); $pdf->Text(10,10, "Stock Check"); $pdf->SetXY(10, 30); $pdf->SetFont('helvetica', '', 9); $totalRows_rsB2Indigo > mysql_num_rows($rsB2Indigo); { $tbl = '<table style="width: 650px;" cellpadding="3" cellspacing="0">'; $tbl = $tbl . '<tr bgcolor="#CCCCCC"> <td style="border: 1px solid #000000; width: 60px; text-align:center"><strong>Id</strong></td> <td style="border: 1px solid #000000; width: 120px; text-align:center"><strong>Name</strong></td> <td style="border: 1px solid #000000; width: 60px;"><strong>Stock</strong></td> <td style="border: 1px solid #000000; width: 60px;"><strong>Allocated</strong></td> </tr>'; while($row_rsB2Indigo = mysql_fetch_assoc($rsB2Indigo,MYSQL_ASSOC)){ $id = $row_rsB2Indigo['material_id']; $name = $row_rsB2Indigo['material_name']; $Stock = $row_rsB2Indigo['material_stock']; $allocation = $row_rsB2Indigo['materia_allocated']; $tbl = $tbl . '<tr> <td style="border: 1px solid #000000; width: 60px; text-align:center"><strong>'.$id.'</strong></td> <td style="border: 1px solid #000000; width: 120px; text-align:center"><strong>'.$name.'</strong></td> <td style="border: 1px solid #000000; width: 60px;">'.$Stock.'</td> <td style="border: 1px solid #000000; width: 60px;">'.$allocation.'</td> </tr>'; } $tbl = $tbl . '</table>'; } // Print text using writeHTMLCell() $pdf->writeHTML($tbl, true, true, true, false, '');
-
Hi have a simple query which should retrieve 4 lines from database and display in HTML table but only 3 lines displaying??? This is the query which when I test works SELECT * FROM stock_material WHERE stock_material.material_catagory = 'B2 Indigo' AND stock_material.material_status = 'Active' See Screen shot from mySQL Database When the pdf is output it returns 3 results not 4 missing the first 1 This is the part generating the table $pdf->SetFont('Helvetica', 'B', 32); $pdf->SetTextColor(0, 0, 0); $pdf->Text(10,10, "Stock Check"); $pdf->SetXY(10, 30); $pdf->SetFont('helvetica', '', 9); $totalRows_rsB2Indigo > mysql_num_rows($rsB2Indigo); { $tbl = '<table style="width: 650px;" cellpadding="3" cellspacing="0">'; $tbl = $tbl . '<tr bgcolor="#CCCCCC"> <td style="border: 1px solid #000000; width: 60px; text-align:center"><strong>Id</strong></td> <td style="border: 1px solid #000000; width: 120px; text-align:center"><strong>Name</strong></td> <td style="border: 1px solid #000000; width: 60px;"><strong>Stock</strong></td> <td style="border: 1px solid #000000; width: 60px;"><strong>Allocated</strong></td> </tr>'; while($row_rsB2Indigo = mysql_fetch_assoc($rsB2Indigo,MYSQL_ASSOC)){ $id = $row_rsB2Indigo['material_id']; $name = $row_rsB2Indigo['material_name']; $Stock = $row_rsB2Indigo['material_stock']; $allocation = $row_rsB2Indigo['materia_allocated']; $tbl = $tbl . '<tr> <td style="border: 1px solid #000000; width: 60px; text-align:center"><strong>'.$id.'</strong></td> <td style="border: 1px solid #000000; width: 120px; text-align:center"><strong>'.$name.'</strong></td> <td style="border: 1px solid #000000; width: 60px;">'.$Stock.'</td> <td style="border: 1px solid #000000; width: 60px;">'.$allocation.'</td> </tr>'; } $tbl = $tbl . '</table>'; } // Print text using writeHTMLCell() $pdf->writeHTML($tbl, true, true, true, false, ''); I'm not sure where i'm going wrong, any help would be great
-
Hi, I running a query that groups merge.Description where the StoreId is the same, and replacing the comma with a line break. The problem I'm getting is the string only returns 1023 character's and I need it to return more? Any help would be great Cheers $rows = mysql_query("SELECT REPLACE(GROUP_CONCAT(merge.Description), ',', CHAR(13)) FROM merge GROUP BY merge.StoreId");
-
Hi thanks for help, i fixed this by group concat in the sql REPLACE(GROUP_CONCAT(merge.Description), ',', CHAR(13))
-
I added $data = []; and only this error now Connected successfully Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/workflow/mergetest.php on line 19
-
Hi Thank you so much for help, the connection is working now but I get the following errors Connected successfully Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/workflow/mergetest.php on line 18 Notice: Undefined variable: data in /Applications/XAMPP/xamppfiles/htdocs/workflow/mergetest.php on line 23 Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/workflow/mergetest.php on line 23 <?php require_once('Connections/workflow-new.php'); ?> <?php error_reporting(E_ALL); ?> <?php ini_set('display_errors', '1'); ?> <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Untitled Document</title> </head> <body> <?php $res = $conn->query("SELECT StoreId , Description FROM merge ORDER BY StoreId "); foreach ($res as $r) { $data[$r['StoreId']][] = $r['Description']; } echo "<table>\n"; foreach ($data as $store =>$prods) { echo "<tr style='vertical-align: top;'><td>$store</td><td>" . join('<br>', $prods) . "</td></tr>\n"; } echo "</table>\n"; ?> </body> </html>
-
Hi Sorry for delay had to deal with couple of issues!! Thanks for response, below is the connection script. <?php $servername = "localhost"; $database = "workflow"; $username = ""; $password = ""; try { $conn = new PDO("mysql:host=$servername;$database=myDB", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?>
-
Hi Thanks for that I connect using require_once('../Connections/workflow.php'); <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_workflow = "localhost"; $database_workflow = "workflow"; $username_workflow = " "; $password_workflow = " "; $workflow = mysql_pconnect($hostname_workflow, $username_workflow, $password_workflow) or trigger_error(mysql_error(),E_USER_ERROR); ?> Below is my database query mysql_select_db($database_workflow, $workflow); $query_rsTest = "SELECT merge.`Description`, merge.StoreId FROM merge GROUP BY merge.StoreId"; $rsTest = mysql_query($query_rsTest, $workflow) or die(mysql_error()); $row_rsTest = mysql_fetch_assoc($rsTest); $totalRows_rsTest = mysql_num_rows($rsTest);
-
Hi thank for response, I tried suggestion an I get the following errors Notice: Undefined variable: pdo in /Applications/XAMPP/xamppfiles/htdocs/workflow/mergetest.php on line 11 Fatal error: Call to a member function query() on null in /Applications/XAMPP/xamppfiles/htdocs/workflow/mergetest.php on line 11
-
Hi looking for some help with below issue I'm facing, any help would be great I have an SQL table call Merge with the below data in Id StoreId Description 1 B013 Alana 2 B013 Sleepmotion 3 B013 Sleepmotion 4 B013 Sleepmotion 5 B013 Hyde & Sleep 6 B017 Alana 7 B017 Isabella 8 B017 Sleepmotion 9 B017 Sleepmotion 10 B017 Sleepmotion 11 B017 Hyde & Sleep I'm trying to get the data to display as a table with description concatenated as below B013 Alana Sleepmotion Sleepmotion Sleepmotion Hyde & Sleep B017 Alana Isabella Sleepmotion Sleepmotion Sleepmotion Hyde & Sleep
-
Hi I'm trying to record the status of a user when they log out but I can't work out where I'm going wrong. Any help would be fantastic Cheers Chris Button <a href="<?php echo $logoutAction ?>">Log out</a> Log Out <?php //initialize the session if (!isset($_SESSION)) { session_start(); } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); //Record log in and out Status $query=("UPDATE authorise SET authorise.authorise_status = 'Logged Out' WHERE authorise.authorise_username = '$_SESSION[MM_Username]'"); $result=mysql_query($query); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; $_SESSION["skill"] = NULL; $_SESSION["email"] = NULL; $_SESSION["firstname"] = NULL; $_SESSION["department"] = NULL; $_SESSION["fullname"] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); unset($_SESSION['skill']); unset($_SESSION['email']); unset($_SESSION['firstname']); unset($_SESSION['department']); unset($_SESSION['fullname']); $logoutGoTo = "../index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?>
-
Thank you so much, that was great and worked perfectly, is there any way of getting the Year in there as well? Cheers Chris
-
Hi, I'm trying to Select all records in my database based on month and count them. The dates are store as unix timestamp as below. So if I wanted to return all records for November 2019 the result would be 5 based on below. I have started the query as below but I'm not sure if DATEPART() is there correct way to finish. SELECT COUNT(Target) FROM production WHERE DATE(FROM_UNIXTIME(production.Target)) = Target ---------- 1574701200 1574701200 1574701200 1574701200 1574701200 1572436800 1572436800 1572436800 Cheers Chris (PHP/SQL Novice)
-
Ok that worked perfectly, thanks for help, if I wanted to use a date in the passed or future do use DATE_ADD() and DATE_SUB() instead of CURDATE() ? Once again thanks for help Cheers Chris