Jump to content

nealios

Members
  • Content Count

    16
  • Joined

  • Last visited

Community Reputation

0 Neutral

About nealios

  • Rank
    Newbie
  1. Hello,I have two tables in a database. One which stores customers and one which stores jobs. Each job has a customer allocated.When i delete a customer from the customer table i want it to delete all the corrosponding jobs from the Job table. Ive looked into delete on cascades as i think thats what needs to be done.The problem is im having trouble with the syntax and im getting an error when trying to implement it. Im not sure where to put the delete on cascade. I gather i can alter my existing tables and add delete on cascade under the foreign key reference.Can anyone help?My tables are belo
  2. nealios

    Ajax & PHP suggest

    Thanks for your help again justsome guy. I have played with the SQL before to get the same solution i think the problem occurs with the echo. I have tried changing the echo statement by adding another field. Now if i enter a surname both the surname and firstname appears as a suggestion. For instance if a person in the database is called John Smith and i enter S into the textbox both John and Smith are displayed. What i want it to do is display all the first names and surnames relevant to the letter i enter. For instance if i enter S i want Smith, Sam, Sarah etc to be displayed. $query = $db-
  3. nealios

    Ajax & PHP suggest

    Hello,I got this nice bit of code courtesy of http://nodstrum.com/2007/09/19/autocompleter/ Its an Ajax suggest function that im using on a text field to fill a search page.However at the moment it only looks at one field in the table currently surname. Ive played around with it but cant manage to get another field to work. What i want it to do is search a few fields from my table.Here is the php code with it, i dont think the javascript needs to be edited.Can anyone help?thanks // PHP5 Implementation - uses MySQLi. // mysqli('localhost', 'yourUsername', 'yourPassword', 'yourDatabase');
  4. nealios

    PHP Validation

    Cheers guys, The tutorial worked a charm!
  5. nealios

    PHP Validation

    Thanks for the reply, ive heard you can do it with Sessions but not sure how i would even start going about it!
  6. nealios

    PHP Validation

    Hello,Im performing some php validation on a form, before it is entered into the database.It check the validity of the field in a separate insert script, it then relays the message back to the form if there is an error.The problem is when the error message relays the whole page is refreshed so the user loses any data previously entered.Is there a way to temporarily save the data if there is an error?example of validation error that checks to see if an email is valid.Code:if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $message15 = "Error: Please
  7. nealios

    IF & Sum

    Hello,I am executing a query in which i am adding together the fields matching the expensetype then if the vatid is equal to '2' i calculate the vat on top.The following code works when i do it for one expense type (tools). SELECT amount,SUM(IF(expensetype ='Tools', ROUND(amount,2), 0.00)) AS toolstotal, SUM(IF(expensetype ='Tools' AND vatid='2',ROUND(amount * 0.175, 2), 0.00)) AS toolsvat, SUM(IF(expensetype ='Tools' AND vatid='2',ROUND(amount * 1.175 ,2), amount)) AS toolsnet FROM expenditure, expenses WHERE expenditure.expenseid = expenses.expenseid AND`extransactiondate` BETWEEN '" . $dat
  8. nealios

    IF Select -

    Hello, I am trying calculate vat on certain records in my table. At the moment i have the query half working and can perform my calculations where the vattype is set to yes.But if the vattype is set to 'no' i want the vat alias to appear as NULL. I was thinking something like this but im not sure how to display it. IF(vattype='yes',ROUND(amount * 7/47, 2),amount), IF(vattype='no',(amount-(amount), 2),amount) AS vat My query at the moment. $sql = "SELECT incomeid, intransactiondate, invoiceno, amount, IF(vattype='yes',ROUND(amount * 7/47, 2),amount) AS vat, IF(vattype='no',ROUND(amount-(am
  9. I have a dynamic drop down box that populates with customer names from my database.This works correctly and communicates with the database and i can update my job table once a customer has been chosen/allocated to each job.However when i come out and go back into the form although the customer information is still in the database the drop down obviously defaults back to the first customer in the database.Is there a way in which the drop down box can default to the value that was previously selected which is stored in the database?Here is my attempt that is currently only defaulting the drop do
  10. Thanks for your reply.Ive just started learning php, so my understanding is still very basic. Im not sure where the xml will come in. In W3 example you input the hyperlinks into the xml file. But i need to search my database for the information rather than the xml file? Otherwise each time a new customer is added to the database i would have to manually type it in the xml file.
  11. Hello,On facebook the search box on the side enables you to search for friends and new people.When you type in the name of a person that is already your friend it dynamically creates a drop down list with all the people in your friends that has that name.Ive looked everywhere to find some examples of similar coding to no avail. I have no real idea how to even start, ive looked at W3 schools but there live search works from an XML file rather than connecting to a database.What i want to do is have a customer search within my system that when i type in a first name/surname all the people that me
  12. Hello,On facebook the search box on the side enables you to search for friends and new people.When you type in the name of a person that is already your friend it dynamically creates a drop down list with all the people in your friends that has that name.Ive looked everywhere to find some examples of similar coding to no avail. I have no real idea how to even start, ive looked at W3 schools but there live search works from an XML file rather than connecting to a database.What i want to do is have a customer search within my system that when i type in a first name/surname all the people that me
  13. Thanks guys got it working!!
  14. Hello,I have been creating CSS buttons and using the following way of displaying. <a href="jobadmin.php?JobID=$JobID&op=5&move=2" class="button" span class="icon">However i now have a html submit button but i cant implement it in the same way. Is there a way to use my css code on the submit button?<input type="submit" value=" Do It ! " />Css code is as follows /* button styles */a.button, a.buttonDis {display: block;background-color: transparent;background-image: url(buttonBackground.gif);background-repeat: no-repeat;width: 132px;height: 28px;margin: 5px auto;padding: 5px
  15. Thanks for your reply, it was worth a shot but it still didnt work! Any other suggestions?
×
×
  • Create New...