Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. good luck. I just don't see what you are asking.
  2. What situation? Watching a video? Touring a gallery? Moving to another gallery? What are your objects?
  3. You English is fine - your description is not. Don't have a clue what you are describing.
  4. You need to do what Jacques1 indicated. I merely told you one facet of writing a proper query statement, but he told you how to do things the proper way. So roll up your sleeves and do some research! Coders help those who help themselves.
  5. if id is NOT an integer value you need to wrap the argument in single quotes and curly braces
  6. AS I SAID IN MY FIRST POST - you didn't tell us what was wrong. You didn't ask us to fix anything.
  7. oops - meant to say 'for'. Got distracted by the op's bad code.
  8. You didn't ask a question!! This code: <?php do { ?> <?php } while ($x++ < 4); { echo $x ;?> </td></tr><tr> <?php } $x = 0 ; } is ridiculous. Try this - note that I turned on error checking so you can see what error you have: <?php session_start(); error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); // do { } while ($x++ < 4); { echo $x; echo "</td></tr><tr>"; } $x = 0 ; } You don't need all those php on and php off tags. You don't need a do statement with no contents You don't put a semi at the end of the while line - it leaves you with no contents again. I think you want: <?php session_start(); error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); // while ($x = 0;$x < 4; $x++) { echo "<tr><td>$x</td></tr>"; } This will give you a set of 4 table rows with one cell counting from 0 to 3.
  9. How can you say that pdo is harder to debug? One doesn't debug the interface. One debugs the query statement which is the same regardless of whether you use mysqli or pdo or mssql.
  10. How can a statement be 'difficult to use PDO on'? Whatever do you mean?
  11. I think he forgot he posted.
  12. You might also want to finish your code and add a query call and a test of its results inside that loop. Depending on where your input is coming from (the user?) you should also be concerned about security and use prepared queries. Hopefully you are NOT planning on using MySQL_* functions.
  13. How about re-writing your post and make sense out of your scattered thoughts?
  14. The point I was making was to clean up your code in preparation for you to make the change (that you have yet to show us) that will alter your input from email to phone. Show Us How You Are Changing It. The code I gave you should have absolutely no problem working. Just upload it and type in the url to execute it and you should see the thank you message (with no email being sent since I commented it out. So now there is no hangup. We're just waiting to see your proposed changes to handle a phone instead of an email.
  15. Alright shavedhead - I took your last post and cleaned it up and made a correction. This ran just fine on my system. <?php session_start(); error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); // $_POST = array(); $_POST['email'] = 'dummy@domain.com'; $_POST['first_name'] = 'Firstname'; if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED // validation expected data exists // MISSING ! ON EMAIL TEST HERE. if(!isset($_POST['first_name']) || !isset($_POST['email'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['first_name']; // required $email_from = $_POST['email']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } $email_message = "Form details below.\n\n"; $email_message .= "First Name: ".clean_string($first_name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; //*************************** // Build mail message $email_to = "mail@gmail.com"; $email_subject = "Your email subject line"; $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); $mail_result = true;//mail($email_to, $email_subject, $email_message, $headers); echo 'Thank you for contacting us. We will be in touch with you very soon.'; if (!$mail_result) echo "Mail could not be sent to us"; } //***************************** //***** FUNCTIONS *********** //***************************** function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } ?> Note - you left off the ! on the first test of the email value - I added. I faked the post values to avoid having to build a form to test this. Remove those. The clean involved indents in a logical way as well as placing the function OUT OF THE INLINE CODE since that is one of the reasons for writing functions - to move blocks of code out of the way when they will be used elsewhere or when they detract from the flow of the surrounding code. In your case I don't see them as necessary at all.
  16. So - you've showed us some code. Where have you actually tried to make it a phone number? What is the hangup here? You've already showed that you can clean it up - so what's keeping you from the last step? I mean - the code is sloppy and hard to read and very disorganized, but it seems to be what you need. So - again - what's the hangup??
  17. You had the query call In your original code. Don't know what other reader was looking at. Methinks you are not looking at your db correctly when checking it.
  18. If you turn on php error checking you might see your errors. If you are getting a blank page you may have errors. You might also read the manual about these functions. Note the special RED highlighted paragraphs that tell you not to use them. BTW - your logic on the loop is flawed. You're missing the last file with this code. Also - you are saving a filename but you do not necessarily have the path to the files. If you do a glob for "*.*" you get the files in the directory where the script is run from. But once you store them in your table you have no reference to where the files are located.
  19. you mention a MySQL database but I don't see any attempts to read from one or write to (update) one. Did you forget to post that part? And - please follow forum rules and post the code in the proper tags.
  20. Is that really all one sentence?
  21. When you echo out the value in the loop, be sure to echo out a space char as well.
  22. ... The terminology is irrelevant Really?? In English as well as PHP, JS, C+, Pascal, Fortran, Cobol, CICS, and any other language - spoken or written - I find the terminology to be very important as well as relevant. A silly statement.
  23. 1 - do you have error checking turned on? 2 - the bindvalue function returns a result. Did you bother to check that it ran ok? No. 3 - the manual gives you the proper syntax for this function. Read it.
  24. Why don't you try doing some research on your own? That's how one learns.
×
×
  • 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.