Jump to content

kamal213

Members
  • Posts

    198
  • Joined

  • Last visited

Everything posted by kamal213

  1. I havent been here long enough to know all the rules you have listed Muddy_Funster..you obviously have that why you do. I did what I did because I wanted the perspective of someone good with PHP and someone good with SQL..i simple copied n paste to save time obviously the mistake - Again I wasnt aware of the rules.. I know now. The code below checks to see if there is a duplicate sales record for a customer when inserting into the table and if there is it redirect to an error page. I want to know if you can do the same for when you are updating a table. // See if that customers sale has already been recorded $sql = mysql_query("SELECT * FROM salesrecord WHERE customer ='$customer' AND value='$value "); $customerMatch = mysql_num_rows($sql); // count the output amount if ($customerMatch > 0) { while($row = mysql_fetch_array($sql)){ $customer = $row["customer"] header("location: sale_error.php?id=$c_id"); exit(); } }
  2. Hey men am new to all this so I am not aware of any rules, Am just a normal guy asking you pros for help, If you want to help please do if you dont want to help then dont.
  3. Hi guys, I was wondering if there is a way or if its possible to check the database if the field has already been updated..just like you would if data has already been inserted into the field. Please let me know if you need more info Thanks
  4. Lol! My Bad its coz I come here for help all the time thats y. Thanks for your help guys really appreciate!
  5. Hi guys, Is it possible to select only the lastest added item/entry added to your database. If so could you tell me how. Thanks alot
  6. Thanks guys for your all you help. Am just reading through the link AyKay47 - and your right there are some cool stuff which will help. Thanks for you help - that should be problems solved now!!!
  7. Thanks for your reply!! Do you kno of any online links that can help or an example you could show as I am not good with jquery/javascript. Thanks
  8. Hi Guys, Ok this is might be a strange and new request. I have a php page with a link on the side menu which when you click you can add a customer into my database. I would another link (to book an appointment) to appear on this page when the customer has been added or the link should be disabled before the customer is added and enabled when the customer is added. Is this possible? Please help Thanks alot
  9. Thanks QuickOldCar, I take it the numbers in the array would for example be the items in my database table? if yes can the code make the items from 0-19 unclickable and item 20 clickable? as this would exactly what am looking for and would solve the problem. Thanks
  10. Thanks for your reply QuickOldCar! Please explain what the testArray variable and the foreach function do. Thanks alot
  11. Hi guys, Can you tell me if it is possible. Let say you had a table which stores names and address (with a primary key and auto-increment) , and a PHP script which display every thing on you SQL Table dynamically. Is it possible to write a PHP code such that if a name and address is added it display and its clickable "i.e. <a href="">$name,$address</a>", and if a new name and address is added its also clickable BUT the older/previous added become unclickable. I would really appreciate your inputs Thanks guys!
  12. It works like a charm Thanks WebStyles! So all I have2 to is when they click yes if redirects to a page else redirects to the previous page. Thanks for you help, really appreciate!!!
  13. Hi WebStyle, It is for a form correct. Do you know of any javascript codes that can help? Thanks
  14. Hi guys, I am not good with PHP and I need your help. I would like to create a confirmation page where you can confirm an action or cancel. Please help any way you can Thanks alot.
  15. Do you have any examples or web links I could use? Thanks
  16. Hi guys Please does any1 know how to change the style of a submit button to something more fancy. Thanks guys.
  17. Hi guys, I have a customer management script were only logged user can view and perform tasks such as add customers and book appointments. Currently only certain users can do certain thing e.g. some users can add customers and book appointments and other can only add customers or only book appointments. What I did was create two table in mysql 'customer users' and 'appointment users', so users who can do all activities are have their username and password in both table, those who can do only one activity have log details save on only their approtiate tables i.e 'customer users' or 'appointment users'. The problem is I have to go to the datebase all the time if I want to decide which user does what, I was wondering if you knew a way I can do it on my system, maybe like creating a control panel and changing the user settings from there instead. Look forward to your help and advise, Thanks alot.
  18. Thanks xyph, Problem solved, Found a tutorial that makes it look like a five yr old could do it if you have dream weaver lol! - very easy! Here's is the link: Thanks again!
  19. Hi guys, I have a script which displays a list of customers on my database, I now have about 100 customers. It gets quite tiring scrolling up and down all the time, so I would like to possibly display 20 customers per page and use a previous/next button to go to each page. Please guys I would appreciate all you help, Thanks alot.
  20. Also thorpe, I just google 'send email from comment box' and so people using 'mailto:' so I just added that without actually know what it meant hoping it would work
  21. I dnt kno coz am dump. I just installed xammp server which automatically installed everything else for me so I wouldn't know..Is there a way I can check?
  22. Hi guys, I have a form which is meant to post to my database as well send me an email. It posts to the database very fine but it returns the following error: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\site\reportingfaults.php on line 58 An not sure what to do, I am 2month new to PHP. I would appreciate your help in solving the problem. Thanks. Here is the code and form: <?php // Parse the form data if(isset($_POST['fault'])) { $fault = mysql_real_escape_string($_POST['fault']); $sql = mysql_query("INSERT INTO csj_fault(fault, username, fault_date) VALUES('$fault','$manager', now())") or die (mysql_error()); //!!!!!!!!!!!!!!!!!!!!!!!!! Email me !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $to = "mailto:kamal.musah@yahoo.com"; $from = "$manager"; $subject = "$manager reported a system fault"; //Begin HTML Email Message $message = "$fault"; $headers = "From: $from\r\n"; $headers .= "Content-type: text\r\n"; mail($to, $subject, $message, $headers); exit(); header("location: index.php"); exit(); } ?> Form <form action="reportingfaults.php" method="post" enctype="multipart/form-data"> <table width="90%" border="0" cellspacing="0" cellpadding="6"> <tr> <td align="right">Fault Description</td> <td><label> <textarea name="fault" id="fault" cols="42" rows="5"></textarea> </label></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="button" id="button" value="Send" /> </label></td> </tr> </table>
  23. It works fine now. Actually what I did was use your idea of defining $week in the initial $sql. so basically this is how it look: <?php // Connect to the MySQL database include "leadscript/connect_to_mysql.php"; if(isset($_GET['week'])){ $week = $_GET['week']; } else{ //Get today's date and put them in date, month, year $day = date("j"); $day = $day; } if(isset($_GET['month'])){ $month = $_GET['month']; } else{ $month = date("n"); $month = "0".$month; } if(isset($_GET['year'])){ $year = $_GET['year']; } else{ $year = date("Y"); } if(isset($_GET['week'])){ $week = $_GET['week']; } else{ $week = date("W"); } //Run a select query to count the amount of leads - Khalid $sql = mysql_query("SELECT COUNT( * ) AS Leads, c_employee AS name, week_added AS week FROM customer WHERE c_employee='Khalid' AND week_added='".$week."'"); $customerCount = mysql_num_rows($sql); // count the output amount if ($customerCount > 0) { while($row = mysql_fetch_array($sql)){ $leads = $row["Leads"]; $name = $row["name"]; $week = $row["week"]; echo '<a href="canvasserweekleads.php?pid=' . $name . '&cid=' . $week . '">' . $leads . '</a>'; } } ?> Not the cleanest of coding but it works now. Thanks for getting back to me, if not for that idea dont know what I would have done.
  24. Thanks for getting back to me AMcHarg, I didn't know I had to define in the $sql. Could you give an example how it would look like Thanks
×
×
  • 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.