Jump to content

madjack87

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by madjack87

  1. Its very random when it does and doesnt work. Even when doing the exact same steps. The array that is being printed is always correct. I see no problem in the SQL queries that are stored in the array. When I tried to add error checking before I received no errors.. What do you mean by I should be using a prepared query?
  2. I am using jquery and ajax to have a drag and drop sortable table. My problem is that it only works about 10 percent of the time. Here is my js code. <script type="text/javascript"> // When the document is ready set up our sortable with it's inherant function(s) $(document).ready(function() { $("#test-list").sortable({ handle : '.handle', update : function () { var order = $('#test-list').sortable('serialize'); $("#info").load("tow_sort2.php?"+order); } }); }); </script> Here is the tow_sort2.php page: <?php include("../_includes/db_connection.php"); /** * This is where you would inject your sql into the database * but we're just going to format it and send it back */ $array =array(); foreach ($_GET['listItem'] as $position => $item) { $sql = "UPDATE tow SET tow_order = '$position' WHERE tow_id = '$item'"; $conn->query($sql); $array[] = $sql; } print_r($array); ?> Here is the array that is being printed: Array ( [0] => UPDATE tow SET tow_order = '0' WHERE tow_id = '5924' [1] => UPDATE tow SET tow_order = '1' WHERE tow_id = '5925' [2] => UPDATE tow SET tow_order = '2' WHERE tow_id = '5922' [3] => UPDATE tow SET tow_order = '3' WHERE tow_id = '5923' )
  3. Well in my case there are multiple users per company. They all access their companies data.. What if I want to add a completely seperate company, but I want it to be at the same URL / domain. Do I create a new folder and database for each company? I already have the system built for one company with many tables all relational. We have been using it for two years. What my question is if I want to sell this where other companies can create an account and have there own system for their company how do I go about doing that. That is where the multiple database questions come in.
  4. I am not sure what to look for to even get started. If some one could help point me in the right direction that would be appreciated. I created a customer system that tracks contracts and invoices ect. Where do I start if I would want a customer to be able to go to the website, sign up, and their own version of the system would be created. Do I just write a script that creates a new database with the correct credentials? Do all of the users access the same files but just have different database. Do I have to copy the directory of files to a specific folder for each customer? I know there must be tons of websites that once you sign up for example a calendar app that keeps your data seperate from everyone else. Any help is appreciated. Thanks Jack
  5. I am trying to find a way to save a still of live streams. I am on a shared server so I do not think it is possible that I install anything like ffmpeg. Is this even possible with PHP? or even JS or any web language? I have been searching all over the place and cannot seem to find anything that can do this. Any help would be appreciated, even if it is just pointing me in the correct dirrection.
  6. Worked Like a Charm! Also cleaned my code up a lot! JCBones I will look into preg_replace_all for future use. Thank you.
  7. What I am doing is displaying a message to another user on the company system. This is Test 1 [20345] The above data is what is stored in the database. What I want to acheive is when I echo the field for it to do this: This is Test 1 [<a href="http://mywebsite.com/system/page1.php?number=20345">20345</a>] I currently am able to make this work. However I cannot get it to work on multiple links. $message_message = $row['message_message']; preg_match("/\[(.*)\]/", $message_message , $matches); $match = $matches[1]; $parts = explode ("[", $message_message); $part1 = $parts[0]; $part2 = $parts[1]; $subparts = explode ("]", $part2); $part3 = $subparts[1]; if ($match != ""){ $new_message_text2 = $part1 . "[<a href=\"http://mywebsite.com/system/page1.php?number=$match\">$match</a>]" . $part3; }else{ $new_message_text2 = $message_message; } When I have data like this: This is Test 2 [20345] [20552] I get a result like this: This is Test 2 [<a href="http://mywebsitecom/system/page1.php?number=20345] [20552">20345] [20552</a>]
  8. Im pretty sure this can be done with mysql concat. The reason that I need it to be completed within the query is because I am searching for the terms.
  9. Below is my query: <?php if (isset($_POST['search_all_submit'])){ $search_all = strtolower($_POST['search_all']); echo "<table id='qbook'>"; echo "<tr>"; echo "<td> CID </td>"; echo "<td> Company </td>"; echo "<td> Property </td>"; echo "<td> Contact </td>"; echo "</tr>"; $sql = " SELECT contract.*, customer.*, contact.* FROM customer INNER JOIN contract ON customer.customer_id = contract.customer_id INNER JOIN contact ON customer.customer_id = contact.customer_id WHERE customer.company_name like '%".$search_all."%' or customer.billing_address like '%".$search_all."%' or contract.prop_name like '%".$search_all."%' or contract.prop_address like '%".$search_all."%' or contact.contact_fname like '%".$search_all."%' or contact.contact_lname like '%".$search_all."%' "; $results = mysql_query($sql)or die(mysql_error()); while ($row = mysql_fetch_array($results)){ $company_name = implode('<span class="high">'.$search_all.'</span>',explode($search_all,strtolower($row['company_name']))); $billing_address = implode('<span class="high">'.$search_all.'</span>',explode($search_all,strtolower($row['billing_address']))); $prop_name = implode('<span class="high">'.$search_all.'</span>',explode($search_all,strtolower($row['prop_name']))); $prop_address = implode('<span class="high">'.$search_all.'</span>',explode($search_all,strtolower($row['prop_address']))); $fname = implode('<span class="high">'.$search_all.'</span>',explode($search_all,strtolower($row['contact_fname']))); $lname = implode('<span class="high">'.$search_all.'</span>',explode($search_all,strtolower($row['contact_lname']))); $CID = $row['CID']; echo "<tr>"; echo "<td> $CID </td>"; echo "<td> $company_name <br /> $billing_address </td>"; echo "<td> $prop_name <br /> $prop_address </td>"; echo "<td> $fname $lname</td>"; echo "</tr>"; } echo "</table>"; } ?> The query above gives me results like: 10008 | jw property management | creekside crossing | mike pudelek | 4816 green bay rd | 9219 66th ave | 10008 | jw property management | creekside crossing | sam johnson | 4816 green bay rd | 9219 66th ave | 10008 | jw property management | creekside crossing | dean zierk | 4816 green bay rd | 9219 66th ave | What I would like to see is: 10008 | jw property management | creekside crossing | dean zierk | 4816 green bay rd | 9219 66th ave | mike pudelek | sam johnson I am pretty sure that I need to use some type of GROUP CONCAT and possibly a GROUP BY. However all of my attemps have failed. Any help would be appreciated.
  10. Sometimes its the simplest things that hold me up in coding. didnt even realize that you could count($_POST); I will give this a try and go from there. Thanks
  11. Current I have php create a form element for every entry found in the database that meets certain criteria. On the form submit it submits information about each form element and can be anywhere from 1-20 elements. The issue that I am having is when I try to gather the day from $_POST I do not know how many form elements are being sent over. So I end up typing something like this. $form_element_1 = $_POST['form_element_1']; $form_element_2 = $_POST['form_element_2']; $form_element_3 = $_POST['form_element_3']; And I type that out for as many as I think I need. But as soon as I need 4 elements I have to go and recode that page to accept more elements. I hope that I am asking this question properly. Thanks Jack
  12. Thanks Denno, I thought of this approach but wasnt sure if it was the best method. I also wasnt sure if it would cause any issues with all of the different browsers out there. Thanks again for you help As always it is much appreciated.
  13. I am not sure what is the best way to layout this design with Divs. As you can see the navigation is split in the middle from the logo. Any help would be greatly appreciated. Thanks
  14. Thanks for the Feedback. I dont have a mind for design as much as I wish I would.. I am more of a programmar than a designer so any feedback is appreciated!
  15. http://asphaltinc.com Let me know what you think Thanks
  16. This is what I did for my website. <form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF']?>"> <select name="course" id="course" tabindex="30"> <option value="0"> <?php $result = mysql_query("SELECT * FROM course"); while ($row = mysql_fetch_array($result)) { $courseId = $row["courseId"]; $courseName = $row["courseName"]; $option="<OPTION VALUE=\"$courseId\">" . $courseName; echo $option; } ?>
  17. Ill play with it.. Thanks for the help.. I think I might have to use DISTINCT or some type of GROUP by.. The problem with trying to narrow it down by date is that there will be different note dates for each student and that is where I am running into a snag!
  18. Students Table studentId fName lName gradeLevel courseId teacherId specialId started Notes Table noteId date note studentId sched Table schedId start stop studentId
  19. Here is what I am trying to accomplish: I have a students table with a studentID I also have a notes table and a sched table with studentID The sched table is working as planned where if the student is scheduled for more than one time he is displayed twice. However if there are multiple notes per student the student is display for each individual note where I would like only the most current note to be displayed Here is what the output is: 1- 10:30:00 - 10:50:00 student3 Three FST Teacher One Special1 One Writing Ratios 09/10 2- 10:30:00 - 10:50:00 student3 Three FST Teacher One Special1 One Needs to work on fractions and decimals 09/10 3- 13:00:00 - 14:00:00 student3 Three FST Teacher One Special1 One Writing Ratios 09/10 4- 13:00:00 - 14:00:00 student3 Three FST Teacher One Special1 One Needs to work on fractions and decimals 09/10 As you can see I have two notes and two schedule times for this student. what I want it to display is only line 1 & 3. which is the newest note in the system. Below is my code that I am using. Any help would be greatly appreciated. <?php $result = mysql_query("SELECT * FROM students LEFT JOIN teachers ON students.teacherId = teachers.teacherId LEFT JOIN course ON students.courseId = course.courseId LEFT JOIN specialEd ON students.specialId = specialEd.specialId LEFT JOIN sched ON students.studentId = sched.studentId ORDER BY start "); echo "<table>"; while ($row = mysql_fetch_array($result)){ $id = "?id=" . $row['studentId']; echo "<tr>"; echo "<td>" . $row['start'] . " - " . $row['stop'] . "</td>"; echo "<td>" . "<a href='student.php$id'>" . $row['fName'] . " " . $row['lName'] . "</td>"; echo "<td>" . $row['courseName'] . "</td>"; echo "<td>" . $row['teachers_fName'] . " " . $row['teachers_lName'] . "</td>"; echo "<td>" . $row['special_fName'] . " " . $row['special_lName'] . "</td>"; echo "<td>" . $row['note'] . "</td>"; echo "<td>" . date("m/d", strtotime($row['started'])) . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  20. One of the problems I am having is when trying to echo the results because my tables have some identical column names. <?php $result = mysql_query("SELECT * FROM students LEFT JOIN teachers ON students.teacherId = teachers.teacherId"); echo "<table>"; while ($row = mysql_fetch_array($result)){ echo "<tr>"; echo "<td>" . $row['fName'] . "</td>"; //echo "<td>" . $row['teachers.fName'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> The above code will work but the commented out section will not. How do I differentiate between teachers.fName and students.fName when trying to echo the results?
  21. , so your logic is correct, you know what you want to do, but you don't have a single JOIN in your query. maybe you should read this: http://dev.mysql.com/doc/refman/5.0/en/join.html Also: you query ends with AND Ok I will check that out. Thank you. Yea I figured I must have some syntax incorrect, but I was having a hard time finding a good source that related to what I wanted to do. I will report back.
  22. Check out my code below and you will see what I am trying to do. I cannot figure out what is going wrong. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mskordus/public_html/index.php on line 25 <?php $result = mysql_query("SELECT * FROM students,teachers,specialEd,course,sched,notes WHERE students.studentId=notes.studentId AND students.studentId=sched.studentId AND students.teacherId=teachers.teacherId AND students.specialId=specialEd.specialId AND students.courseId=course.courseId AND "); echo "<table>"; while ($row = mysql_fetch_array($result)){ echo "<tr>"; echo "<td>" . $row['students.fName'] . "</td>"; echo "<td>" . $row['teachers.fName'] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
  23. I am not sure where to start but hopefully someone can help me. I created a web system where I track customers and jobs for my company. For some reason when you try to perform a function on the system sometimes it logs you out and you have to re login. It usually happens the first time after you login then you are good to go from there on out. It doesnt happen all the time and I have no clue on where to start to diagnose this problem. Any help would be greatly appreciated.
  24. Currently I have a table that is like this. (There are a lot more fields in the real table) ID Company Name Property Name First Name Last Name Mailing Address Property Address Phone Fax Job Type Job Cost Job Status What I would like is to have two tables that are relational Customer Table ID Company Name First Name Last Name Mailing Address Phone Fax Job ID Job Table ID Property Name Property Address Job Type Job Cost Job Status One of my problems though is that If the customer was a residential customer and not a business the address has been going into property address and not mailing. Is there a way to split these tables but in the case where mailing address was blank it will insert the property address for the "mailing address in the new tables"? If not I could possible manually do this. How would I go about splitting them in the first place?
×
×
  • 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.