363 Posted Topics
Re: I was going to be all descriptive, but the words didn't come to me. So I just wrote you an example: [code=php]<?php // Isset actually takes an unlimited amount of parameters. if(isset($_POST['submit'], $_POST['question'])) { // Make sure there aren't to many questions selected. if(count($_POST['question']) > 3) { echo "You can … | |
Re: Semantics aside, this is the most basic PHP-MySQL example you will get: [code=php] <?php // Connect to MySQL mysql_connect("host", "user", "pwd") or die(mysql_error()); mysql_select_db("dbName") or die(mysql_error()); // Query some data from the MySQL database $sql = "SELECT field1, field2 FROM myTable"; $result = mysql_query($sql) or die(mysql_error()); // Display the results … | |
Re: Hi. Sure, I can give you an example. It's pretty basic at this point, but I assume you are going to be adding your own methods to it. Note that I don't store the actual password used for the connection, but rather a SHA1 has of it. [I](For security reasons)[/I] … | |
Re: You could always just register a GMail account and use the example I posted in [url=http://www.daniweb.com/forums/post886043-8.html]this post[/url]. Note, that example uses [url=http://phpmailer.codeworxtech.com/]PHPMailer[/url]. [i](Which I highly recommend whenever you need to sen emails.)[/i] | |
Re: Hi. Have you tried the [url=http://cakephp.org/]CakePHP[/url] website? They have a [url=http://book.cakephp.org/]Docs section[/url], which includes a [url=http://book.cakephp.org/view/4/Beginning-With-CakePHP]User Manual[/url]. Then there is always [url=http://www.google.com/search?q=CakePHP+tutorial&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a]Google[/url] | |
Re: Hi. Invisible code is extremely hard to debug. Please show us the parts of your code that are causing the problem. [i](Note, not all of the code, just the parts that aren't working)[/i] | |
Re: Hi. Yes, be careful with a value of 0. Both PHP and MySQL interpret it as FALSE under certain circumstances. And PHP, being a loosely typed language, is very aggressive in converting values when it needs to. [I](e.g. converting 0 into FALSE during boolean comparisons.)[/I] I would just convert it … | |
Re: Hi. This integer date thing is a Unix timestamp, I assume? If so, check out [url=http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime]FROM_UNIXTIME[/url] If not, how exactly is it formatted? P.S. You should ALWAYS store dates and times in the standard date/time format (YYYY-MM-DD HH:SS), and store them in date type fields, to avoid problems just like … ![]() | |
Re: [QUOTE=ardav;887555]I HATE Facebook and all that social networking twaddle, so I haven't seen it in action (I ain't got no friends!). [/QUOTE] I hate Facebook to. Mostly because the site itself is crap. I mean, have you tried validating the markup? [icode]14524 Errors, 1571 warning(s) [/icode] But yea I would … | |
Re: The problem is (if I am reading this correctly) that if you intend to redirect the user to the file, you can't delete it first. The redirect happens [i]after[/i] the PHP code completes, so any call to [icode]unlink($url);[/icode] anywhere in your code would delete the file... and then your redirect … | |
Re: Hi. Is the image itself (the data) inside the database, or just a link to where it is stored on the file-system? If it is the first one, you have to fetch the image by itself and output it as an image by setting the headers. That is generally done … | |
Re: Hi. The PHP part of this is pretty simple. Basically what you wrote, except you left out the body of the email. The [url=http://php.net/mail]mail[/url] function requires three parameters. If for some reason this failing, my best bet is that there is something wrong with whatever is supposed to receive the … | |
Re: Or simply [icode]$var = file_get_contents("http://www.example.com");[/icode] Should work on most servers. ![]() | |
Re: You can specify the exact width of the <select> box using CSS. Like: [code=html] <select style="width: 50px;"> <option value="">- Select -</option> <option value="">A very long option name</option> </select> [/code] All decent browsers will show the box exactly 50px wide, but will expand the list itself to whatever size fits the … | |
Re: [QUOTE=Josh Connerty;884905]If you stick the file_g..... function at the top of your script in a variable then it should be loading the code before you echo it out. The issue comes as your are essentially loading two websites.[/QUOTE] The [icode]file_get_contents[/icode] function halts the execution of the PHP script until after … | |
Re: These could just be caching problems. Meaning; your browser likely stores a copy of the page so when you re-enter it, rather than download the same page again, it shows the one it already downloaded. Try hitting ctrl+f5 to refresh. That usually forces it to reload the page. The page … | |
Re: Can't you just put the contact info in it's own div, under the div that scrolls the table? Like: [code=html]<div style="margin: 0 auto; width: 300px; height: 250px; overflow: scroll;"> <table> <tr> <th>ID #</th> <th>Name</th> <th>Something</th> </tr> <?php for($i = 0; $i < 100; $i++) { ?> <tr> <td><?php echo $i; … ![]() | |
Re: Ok. So [icode]mysqli_result::fetch_row[/icode] works perfectly, but [icode]mysqli_result::fetch_assoc[/icode] and [icode]mysqli_result::fetch_object[/icode] on the same instance cause PHP to freeze? I very much doubt that would have anything to do with your code. (Unless it involves some shady loops, which I don't see in your code). So my guess is that either your … | |
Re: Post the whole thing here so we can scan it over for you. If it's the same error, the error message should include the exact line where the error is happening at. Try to look there ;) | |
Re: Hi. I stay away from Dreamweaver's overrated tools like the plague... so I won't be able to help you with those. But I can show you how to do this in PHP code: [code=php]<?php // Establish a DB connection $dbLink = new mysqli('localhost', 'usr', 'pwd', 'db_name'); if(mysqli_connect_errno()) { printf("Database connection … | |
Re: Hi. You submit the form, and then you can access it from [ICODE]$_POST['bMinute'][/ICODE]. Like: [code=php] <?php if(isset($_POST['bMinute'])) { $bMinute = $_POST['bMinute']; // etc... } ?> <form action="?" method="post"> <select name="bMinute"> <option value="10">10</option> <option value="20">20</option> <!-- etc... --> </select> </form> [/code] | |
Re: Hi. Check out [url=http://phpmailer.codeworxtech.com/]PHPMailer[/url]. [i](See an example of how to use it [url=http://phpmailer.codeworxtech.com/index.php?pg=examplebmail]here[/url])[/i] And there is always the old [url=http://php.net/mail]mail[/url] function, if you need something simpler. | |
Re: So, only certain users should be able to modify this data? Then you simply need to figure out [i]who[/i] should be able to modify it, check if the current user is a part of that group, and display the controls if he is. This example assumes that: [list] [*]You have … | |
Re: Hi. You shouldn't load and execute code using the same <script> tag. And all <script> blocks should be inside the <header> block, or at least all <script> blocks that are meant to load external code. You could do this like so: [code=php] <html> <head> <title>Test</title> <script src="test.js" type="text/javascript"></script> </head> <body> … | |
Re: A proper table design would prevented this problem. The first rule of relational database design: - You should never store more than one piece of data in a single field. Your fields are storing two pieces of information. A name and a number. As a result, the number is being … | |
Re: SQL queries only return two-dimensional tables, so if you want to do that, you would have to get the output somewhat like: [code] +-----------+-----------+ | Designer | Article | +-----------+-----------+ | Designer1 | Article1 | | Designer1 | Article2 | | Designer2 | Article1 | | Designer2 | Article1 | … | |
Re: Hi. So, basically, you want to make a PHP script that is executed via the Windows Command Prompt, which repeatedly calls another PHP script on the web? What is the point of all this? | |
Re: Hi. The problem is that you are using single-quotes around your query. Variables within single-quoted strings will not be evaluated like they are in double-quoted strings. Consider this: [code=php] $var = 'hi'; echo "Var = $var"; // Var = hi echo 'Var = $var'; // Var = $var [/code] Try … | |
Re: I think you may want to do something more like: [code=php] <?php // Assuming there is a open mysql connection $sql = "SELECT item, cost FROM orders_total"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $newValue = $row['item'] .", ". $row['cost']; $sql = "UPDATE orders_complete SET ord_descr='$newValue ' WHERE … | |
Re: Hi. You can use the [url=http://php.net/filectime]filectime[/url] function to determine when a file was last changed and the [url=http://php.net/glob]glob[/url] function to get a list of files in a directory. Using that, you can determine which of the files was last edited and display that. For example: [code=php] <?php header("Content-Type: text/plain"); $files … | |
Re: It would help to see the code. It's kind of hard to help debug code that you can not see :) For the record tho. If it doesn't work in Mozilla and the other standards supporting browsers, it doesn't work. IE is flawed, so some code that shouldn't work works, … | |
Re: Hi. I would do this using JavaScript and AJAX. Would be a simple matter of either having PHP pre-load the information into a JavaScript array or have AJAX load the new info from your server. But, if you want this in pure PHP, consider this: [code=php] <?php $arr = array('First', … | |
Re: Is this part of your if statement on line #10 meant to make sure the password is more than 3 letters? [code=php]($password_1 > 3)[/code] If so, try using the [url=http://php.net/strlen]strlen[/url] function around the variable, like: [code=php](strlen($password_1) > 3)[/code] Simply matching the string to a number will not get you the … | |
Re: Hi. You could simply have him enter his email address and try sending it there. Like: [code=php] <pre> <?php if(isset($_POST['email'])) { $usEmail = $_POST['email']; $usSubject = $_POST['subject']; $usMessage = $_POST['message']; if(mail($usEmail, $usSubject , $usMessage )){ echo "Email sent!"; } else { echo "Failed to send email!"; } } ?> </pre> … | |
Re: The [icode]document.getElementById("List1").selectedIndex[/icode] property would not return the actual element, only the position of the selected option in the options array. To move it over you would have to do something more like: [code=javascript] var firstBox = document.getElementById('List1'); var secondBox = document.getElementById('List2'); var option = firstBox.options[firstBox.selectedIndex]; secondBox.options.add(option); [/code] That would move … | |
Re: Hi. Not knowing your exact table structure, I assuming a structure like this: [code=mysql] CREATE TABLE `Member` ( `MemberID` INT Auto_Increment Primary Key Not Null, `MemberRole` ENUM('Reader', 'Candidate') Not Null, `MemberName` VarChar(65) Not Null ); CREATE TABLE `ReaderAssignment` ( `ReaderID` INT References `Member`(`MemberID`), `CandidateID` INT References `Member`(`MemberID`), PRIMARY KEY (`ReaderID`, … | |
Re: Hi. How are you sending the text messages? (I am assuming this is a message meant to be sent to your client's phone?) If that is the case, you are probably going to have to use some external API to do this, or send a request to some phone companies … | |
Re: Hi. You seem to mix up your variables a lot. You define them using one name and then try to use them using another. And you are validating the image based on the extension, which is pretty much useless. Validating the mime type returned by the [icode]getimagesize[/icode] function is a … | |
Re: My first guess would be that you don't have write permission on the destination directory. Try turning on the debug messages by putting this at the top of your page: [code=php] error_reporting(E_ALL); ini_set('display_errors', true); [/code] See if that produces a more helpful error message. | |
Re: Could we see the code? It's kind of hard to debug invisible code :) | |
Re: Hi. I'm happy to help you, but I'm not about to do all that work for you. Make a list of all the data you need stored and try to sort them into tables. Post them here and we can take a look and let you know if your doing … | |
Re: You could try adding a "anchor" to the URL, passing the ID (or whatever) of the image you want displayed. So, try opening a window with the URL formated like [icode]http://example.com/childWindow.html#5[/icode], where 5 is the index of the photo you want viewed. Then you can use "document.location.hash" to read the … | |
Re: Why do you have AJAX send the data to the [icode]formlogic.php[/icode] script? You need to have a script that can process the data you are sending, and have AJAX send the data there. | |
Re: Hi. I notice that none of you <img> tags are closed properly. Have you validated the markup? ([url]http://validator.w3.org/[/url]) Although browsers usually attempt to correct invalid markup before showing it, not all browsers employ the same methods to correct it, which can cause these sort of problems. Try validating (if you … | |
Re: Well no. That wouldn't work, seeing as you only specify one email recipient. It should be something like: [icode]$to = "user@example.com, [email]anotheruser@example.com[/email]"[/icode] | |
Re: To add a to buddylee's post. Note that if a checkbox isn't checked, it will not be sent, and will therefore not be included in the $_POST array. (May seem obvious, but there is no harm in stating the obvious :)) | |
Re: Are you trying to get the mail out of Outlook, or from a mail server? Not sure how you would go about interfacing with Outlook, but PHP has the [URL="http://php.net/imap"]IMAP functions[/URL] to interact with mail servers. | |
Re: I see all your ID's are quoted. If they are integers, they shouldn't be. Only strings and string-like data should be quoted. I also can not find any reference to the fetch() function you are using. Is this something you made, or from some 3'rd party include? | |
Re: Hi. I see two problems. First, the <select> box is missing the ID attribute. IE incorrectly uses the name attribute when an ID tag is missing, which explains why this works in IE. Also, the [ICODE]<input type="submit">[/ICODE] button should not be used to trigger scripts like that. Unlike the onsubmit … | |
Re: Firstly, why do you use `$_GET` first and the `$_POST` later? On the first run, your `$_POST['number']` would be empty. You could solve this by using sessions. For example: <?php // Star the session. Myst be done before anything is added to the outpu. session_start(); // Define your data $data … |
The End.