
moosey_man1988
Members-
Posts
75 -
Joined
-
Last visited
Everything posted by moosey_man1988
-
okay muddy i think you might have gone a little over my head with that one :| I'll try google what you said in some fashion Thanks for your help though, this wouldn't have been possible for me without your input
-
Hi, I've got the code working I used ViewerJS, here's my code <?php if(mysql_num_rows($note_query)!=0) { do { // if($note_rs['method'] == "note"){ // $method= "images/icons/blue_circle_pen.png"; // } // elseif($note_rs['method'] == "PlainText") // $method= "images/icons/blue_circle_notepad.png"; if($note_rs['method'] == "note"){ $noteLink= "<td><img src='images/icons/blue_circle_pen.png' alt='pen' style='width:30px'></td>"; } elseif($note_rs['method'] == "PlainText"){ $noteLink= "<td><a href=".$note_rs['location']."/".$note_rs['fileName']."><img src='images/icons/blue_circle_notepad.png' alt='notepad' style='width:30px'></a></td>"; } elseif($note_rs['method'] == "PDF"){ $noteLink= "<td><a href=js/ViewerJS/#/".$note_rs['location']."/".$note_rs['fileName']."><img src='images/icons/blue_circle_pdf.png' alt='notepad' style='width:30px'></a></td>"; } elseif($note_rs['method'] == "MsDoc"){ $noteLink= "<td><a href=".$note_rs['location']."/".$note_rs['fileName']."><img src='images/icons/blue_circle_msword.png' alt='notepad' style='width:30px'></a></td>"; } ?> <tr><td><?php echo $note_rs['customerId']; ?></td> <td><?php echo $note_rs['note']; ?></td> <td><?php echo $note_rs['user']; ?></td> <td><?php echo date("d-m-Y H:i:s", strtotime($note_rs['Date']));?></td> <?php echo $noteLink;?></tr> <?php } while ($note_rs=mysql_fetch_assoc($note_query)); } else { echo "No results found"; } ?> But I need to make this hover, and display over the top of the current page, not a new link, how can i achieve this?
-
Muddy Thank you so much for your comment, I will get working on this and on completion i'll send a picture I actually spotted a jquery one that looks really nice, and also you can buy it for £6.... worth it? I very much prefer jquery as i find its lightning fast.
-
Hi Everyone I'm quite new to php, and im currently doing a learn as i go project, I've created a kind of customer portal, where you can add notes and documents for that specific customer on the file upload i defines which file i have uploaded and puts it as a note, and displays all the notes and files for that customer on the customers page. On the notes table I have icons defined by the file type e.g a pdf upload will have a pdf icon. when clicking on the icon it will download the file, but i want to go one better than that, I want to be able to hover over the icon with my mouse and this views the document in an overlay when clicking either side of that document it will hide that middle viewer. I've attached an image of what i currently have, any help is greatly appreciated in advance, I am a little baffled with this one and don't know where to start but i know it can be achieved, can any one advise me how this can be achieved and if there are specific things i require e.g this needs to be done in javascript? Would i need something like php magik?
-
Hi everyone I have created an upload page which it working very well it uploads data to a database, but im having trouble with phone numbers say I have 7788991100 as a phone number when uploading the phone number from the csv I get the result of 778899110 (its taking off the last 0) Does anyone know how i can stop this? I know i could set the max length to 10 and have the column as zero autofill but that seems to me like a very dodgy way of uploading the phone numbers? here is the layout of my table Thanks in advance for any help given
-
nevermind, I done it with mysqli instead, was MUCH easier.
-
Hi Everyone I'm currently trying to learn PHP whilst writing my own custom control panel I had a working import csv page but I got told its not really good to use mysql_* anymore, so I've started again with trying to do it with pdo, but i think I'm well over my head with this one, my page says is successfully uploaded but there is nothing in the Leads table I created so its not putting the data into the table. here's my code so far <?php $used=0; error_reporting(E_ALL); ini_set('display_errors', '1'); if (isset($_POST['submit'])) { require "database/pdo_connection.php"; //upload file if (is_uploaded_file($_FILES['fileName']['tmp_name'])) { echo "<h1>" . "File " . $_FILES['fileName']['name'] . " uploaded Successfully." . "</h1>"; } $filename = $_FILES['fileName']['name']; //Now Lets import the file to the database/connection $handle = fopen($_FILES['fileName']['tmp_name'],"r"); $import=$pdo_connection->prepare( "INSERT IGNORE into Leads(number,date,used,fileName) values(?,?,?,?)" ); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $import->bindParam(1, $data[0], PDO::PARAM_STR); $import->bindParam(2, $data[1], PDO::PARAM_STR); $import->bindParam(3, $used, PDO::PARAM_INT); $import->bindParam(4, $filename, PDO::PARAM_INT); $import->execute(); } fclose($handle); } else { print "<div id='box'>"; print "Upload new csv by browsing to file and clicking on Upload<br/>\n"; print "<form enctype='multipart/form-data' action='Leads2.php' method='post'>"; print "File name to import:<br/>\n"; print "<input id='test' size='10' type='file' name='fileName' ><br/>\n"; print "<input type='submit' name='submit' value='Upload'></form>"; print "</div>"; } ?> Thanks in advance for any help given
-
Ah thanks for the advice! I now have a new issue, I need to make sure there is a filename and to make sure that the file is a CSV otherwise, It gets stuck in an infinate loop :|
-
ah sorry I have mysqli functions also, are they much better or just updated? what actually are the benefits? oh also just to add to that, it was the double else stopping it from telling me how many dups.
-
apologies $used is defined as 0 above, so if I import 300 rows from a CSV, it will say 300 imported, 0 duplicates because i told it to echo $upload_amount and $duplicates, but when i upload the same again it doesn't say 300 duplicates what would i use rather than mysql_* functions?
-
Hi There I'm trying to create an upload csv page which detects duplicates and tells me how many are duplicates, but i just cant my head around it, this is my code so far //Upload File if (isset($_POST['submit'])) { if (is_uploaded_file($_FILES['fileName']['tmp_name'])) { echo "<h1>" . "File ". $_FILES['fileName']['name'] ." uploaded successfully." . "</h1>"; //echo "<h2>Displaying contents:</h2>"; //readfile($_FILES['fileName']['tmp_name']); $upload_amount = 0; $duplicates = 0; } //Import uploaded file to Database $handle = fopen($_FILES['fileName']['tmp_name'], "r"); $filename = $_FILES['fileName']['name']; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $import="INSERT IGNORE into Leads(number,date,used,fileName) values('$data[0]','$data[1]','$used','$filename')"; $query= mysql_query($import); //mysql_query($import) or die(mysql_error()); if ($query){ if (mysql_affected_rows() > 0){ $upload_amount++; } else { $duplicates++; } } else { die (mysql_error()); } } if ($upload_amount > 1){ $todays_date= date ('Y-m-d H:i:s'); $sql_status="INSERT INTO LeadsStatus (filename,imported,user,Date) VALUES ('$filename','$upload_amount','$login_session','$todays_date')"; mysql_query($sql_status) or die (mysql_error()); } fclose($handle); print "Import done </br>"; print $upload_amount." Imported"; echo "</br>"; print $duplicates." Duplicates Not Imported"; print "<a href='Leads.php'> Upload More</a>"; any help is greatly appreciated thank you
-
HAHA got I hate == LMAO thank you let me try that out <3
-
Hi Everyone, I'm quite new to php, I was getting along just fine until I hit this really annoying problem with a table, the table is a notes table and basically When i upload a file It writes to this table, I just want to get the basic functionality of it working first on the right side of the table there should be a an icon based on what is in the row for example if the column has a note it will display a blue pen logo and if the column has an upload I want it to display a blue notepad logo with a link to the notepad file like so at the moment if I do "if followed by if" I get ONLY the notepad, if I do "if followed by elseif" I only get the blue pen, please help <div class="notestable"> <?php if($note_rs['method']= "note"){ $method= "images/icons/blue_circle_pen.png"; } elseif($note_rs['method']= "PlainText") $method= "images/icons/blue_circle_notepad.png"; ?> <table> <?php if(mysql_num_rows($note_query)!=0) { do { ?> <tr><td><?php echo $note_rs['customerId']; ?></td> <td><?php echo $note_rs['note']; ?></td> <td><?php echo $note_rs['user']; ?></td> <td><?php echo date("d-m-Y H:i:s", strtotime($note_rs['Date']));?></td> <td><a href="<?php echo $note_rs['location']."/".$note_rs['fileName'];?>"><img src="<?php echo $method;?>" style="width:30px;"></a> <?php } while ($note_rs=mysql_fetch_assoc($note_query)); } else { echo "No results found"; } ?> </table></div>
-
Hey very sorry i fixed, the issue was i was trying to makdir 2 directories (face palm)! creates another variable with the first directory and then another with both and told the php script to mkdir the first directory THEN the second one, so all along it wasnt that line. Here's the result code: $directory = is_dir($path); $dateFile= date('Y-m-d'); $customerPath = "uploads/".$customernumber.""; $path = "uploads/".$customernumber."/".$dateFile.""; $extension = end(explode(".", $_FILES["file"]["name"])); if ($_FILES["file"]["size"] > 2000000 ) { die ('please provide a smaller file size.' ); } if ( !( in_array($extension, $allowedExts))) { die('Please Provide a Different File Type.'); } if ($directory == false) { mkdir($customerPath, 0777); mkdir($path, 0777); } if (in_array( $_FILES["file"]["type"], $AllowedMimeTypes) ) { $fileName=$_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "$path/" . $_FILES["file"]["name"]); } else { die ('Please Provide Another File Type'); } } ?>
-
Hi There I'm pretty New to php im trying to creat an upload page that will store the file in the customers variable (Reference number) This is what im having trouble with $path = "uploads/".$customernumber."/".$dateFile.""; getting that second / to work.. here's the full code of what im trying to achieve (upload a file to a upload/$customernumber/date/test.txt) please bear in mind this is a php page called by another php page so there may be some variables missing $directory = is_dir($path); $dateFile= date('Y-m-d'); $path = "uploads/".$customernumber."/".$dateFile.""; $extension = end(explode(".", $_FILES["file"]["name"])); if ($_FILES["file"]["size"] > 2000000 ) { die ('please provide a smaller file size.' ); } if ( !( in_array($extension, $allowedExts))) { die('Please Provide a Different File Type.'); } if ($directory == false) { mkdir($path, 0777); } the upload page itself works but i just need to get the directories right.
-
Ah so easy! i just thought that was required up there for the rest to work thank you for your help.
-
Hi Guys So basically I've got a page that displays all the notes written for a specific customer and I have managed to get it to display the "customers" date of birth in the correct format when selecting out of the database. but i need to this for a notes list and for some odd reason its displaying a random date at the top of the list but it is displaying the note dates correctly. here is my code: require('database/mysql_connection.php'); //Now Lets grab The Notes from the database using mysql $NoteSelect = "SELECT customerId, note, user, Date FROM notes WHERE customerId='$customerId' ORDER BY Date DESC"; $note_query=mysql_query($NoteSelect); if(mysql_num_rows($note_query)!=0) { $note_rs=mysql_fetch_assoc(); } ?> <!-- This is loading the stylesheet--> <link href="css/crm.css" rel="stylesheet" type="text/css"> <div class="notestable"> <table> <?php if(mysql_num_rows($note_query)!=0) { do { ?> <tr><td><?php echo $note_rs['customerId']; ?></td><td><?php echo $note_rs['note']; ?></td><td><?php echo $note_rs['user']; ?></td><td><?php echo date("d-m-Y H:i:s", strtotime($note_rs['Date']));?></td></tr> <?php } while ($note_rs=mysql_fetch_assoc($note_query)); } else { echo "No results found"; } ?> </table></div> Here is how its displaying
-
what is i wanted to select all the rows but display that with DATE_FORMAT?
-
Hi Everyone I need to change the way my dates are put into mysql and also displayed at the moment i have a javascript timepicker with validator that sets the date in the form as dd-mm-yy which displays as 25-05-2015 for example and i have it attached to POST like so : $dob = $_POST['dateofbirth']; and then finally once the form is entered it does this $sqlinsert = "INSERT INTO customers (prefix,Title,firstName,middleName,lastName,houseNo,Address1,postCode,ContactNo,DateOfBirth) VALUES ('$customer_prefix','$sex','$fname','$mname','$lname','$houseNo','$address1','$postcode','$contactno','$dob')"; but this puts the field in to the database wrong (e.g 22-05-2015) and I need to them go into the database like yyyy-mm-dd (e.g 2015-05-22) I was thinking of doing something like this? $originalDate = $dob; $newDate = date("Y-m-d", strtotime($originalDate)); I also need to pull this information back out of the database once again in format dd-mm-yy Thank you in advance for any help given.
-
creating a Link to customers page using search
moosey_man1988 replied to moosey_man1988's topic in PHP Coding Help
Hi Guys, Thanks for this, I now have the pages the way I want -
creating a Link to customers page using search
moosey_man1988 replied to moosey_man1988's topic in PHP Coding Help
Hi Thanks that worked so well! but one last thing what am i doing wrong here if ($_GET['customerRef']) { $customer = explode('~',$_GET['customerRef']); } echo $customer[0]; //should be prefix echo $customer[1]; //should be custid $vars = $customer[1]; echo "$vars"; the echo $vars doesnt work, with or without speechmarks -
creating a Link to customers page using search
moosey_man1988 replied to moosey_man1988's topic in PHP Coding Help
well what i was thinking is at the moment I have searchresults.php in the results I have this <?php if(mysql_num_rows($search_query)!=0) { do { ?> <tr><td><a href="editCustomer.php customerRef=<?php echo $search_rs['prefix'],$search_rs['customerId'];?>"><?php echo $search_rs['prefix'],$search_rs['customerId'];?></a></td><td> but i need to pass the customer reference to the editCustomer.php for it to run a mysql query with the variable $customerRef really not sure if this is going to work, but i cant find any pages that can help me with this kind of logic. I'm doing building as i learn as I find it a much more practical way of learning the language. could i do it like this? $CustomerRef= "$search_rs['prefix'],$search_rs['customerId']"; the link having edicustomer.php -c $customerRef then in editCustomer have $arguments = getopt("c:"); and then have another variable like $customerNumber = $arguments['c']; a little confusing but i hope you get it? lol -
Hi There So I've Created a search results page, this displays as you can see attached to this post as you can see i have Joe Bloggs with a customer reference number of CRM00017 How can i make the results show the customer reference as a Link that once clicked takes them to the customers page with all information? e.g click the link this takes me to existingCustomers.php/id=00017 kinda thing :| I know its a long shot to ask on A forum for such a big thing, I am willing to accept extra help further to this if someone can guide me into building this function. Any help would be massively appreciated.
-
thank you, quickest and easiest answer ever known on a forum lol. sometimes i just takes that different head on a pair of shoulders to see something differently.
-
oh yes that sounds like a great idea! how would i generate the 0's infront so i always have 2 characters along with 5 digits (for tidiness).