yoda699
Members-
Posts
15 -
Joined
-
Last visited
Never
Everything posted by yoda699
-
Great! Thanks, that was what I was looking for. Sorry for the confusion.
-
That's exactly what I don't want since I can't randomize this output. It will always come in the same order. Is there a way to get $row['name'] into a variable? To extract all the rows just into variables?
-
That's a start. My question is this: The array that I get back from that query has 2 columns id name How do I get the 3 rows into 3 separate variables. The only method I know is to echo the rows in a loop: echo $row['name']; I want just variables because I have to randomize the order of all the answers and I the only way I can show the user different order of possible answer is if I have variables that I can play with. I hope this makes my question a bit more clear. Thanks
-
Hi people. I'm building a quiz with one correct answer out of possible 4. My problem is that after I choose a random answer (which is the correct one) I have problems with choosing random 3 wrong answers which are not the same as answer 1 (they all come from the same table). My first mysql query gives me back 1 row my second mysql query gives me back 15 row (there were 16 - 1 which is the correct one). How can take only 3 rows out of that second query and output them into variables that I can later echo into a form? Can you help me understand this problem or can you propose an alternative method to deal with this? Here are my two queries: // Fetch random answer (correct) $query = "SELECT * FROM psychofarm_brand WHERE `id`=".$randomNumber; $result = mysql_query($query); $row = mysql_fetch_array($result); // Fetch wrong answer $query2 = "SELECT * FROM psychofarm_gen WHERE `id`!=".$randomNumber; $result2 = mysql_query($query2); $row2 = mysql_fetch_array($result2); I hope this is clear. Thanks
-
I'm sending some information to mysql server to format a string into datetime format that the server can understand. I'm running into problems regarding fetching that data. $connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $connection) or die(mysql_error()); $newSqlDate = "SELECT STR_TO_DATE('$newDateTime', '%m/%d/%Y %h,%i,%p');"; $result = mysql_query($newSqlDate); $row = mysql_fetch_array($result) or die(mysql_error()); echo "Date and Time: ".$row['datetime']; mysql_close($connection); My echo returns only: "array" Thanks
-
Thanks, Could you please also give me an example of how to use the %r function
-
Hi, I am trying to convert a string to datetime format. Here is my code: SELECT STR_TO_DATE('11/02/2009 01,30,00,am','%m/%d/%Y %r') It doesn't work. Can you please tell me whats wrong with the code? Thanks
-
STR_TO_DATE is an mysql function. is there a php equivalent?
-
Got it! Thanks
-
Hey, So I got a form that requires the user to insert: the hour, the minuets, and if its AM or PM. what I get is three variables: $hour $minuets $amPm Those variables are combined into a string. I need to convert this somehow to readable format for mysql server and insert the data. I found loads of function to convert date from mysql into strings, but not the other way around. Any suggestions about this issue? Thanks,
-
Hey, I'm in the process of teaching myself stuff (Yes, I am a total beginner). And I got a question about a part of a code that I don't understand. if(isset($_POST['sublogin'])){ $this->procLogin(); } else { echo "blah blah"; } The first line of the code I understand. I also understand how you call a function. What i don't understand is what does $this-> stands for? Does it mean that its a call for a function on the same page? Thanks
-
Thanks very much. The first option worked great for me.
-
Hi, I am trying to create an IF statement with several conditions. What I am trying to achieve is actually three conditions: 1. $num_errors > 0 2. And $field != "curpass" 3. Or $field != "newpass" I wrote the statement using AND (&&) + OR (||) operators in the same statement, but it doesn't work. Could please look at my code and tell me whats wrong. Is it even possible to do what I am trying to do? Thanks ahead, if ($this->num_errors > 0 && $field != "curpass" || $field != "newpass"){ return "<img src=\"../images/check.jpg\" alt=\"\" width=\"34\" height=\"34\" />"; //Errors with form } else{ return "";
-
Creating an xml file from an html form using PHP
yoda699 replied to yoda699's topic in PHP Coding Help
Okay great, I have trying to work with this script. It works great. Now there are two things I need to change. 1. I would like that every time a new xml file will be created. The way this script is set up, the name of the xml file is parsed from the 'document name' field of the form. I want the name of the file to have a number or something attached to it so files will always be new. 2. What is the command to upload the xml file to ftp server. Thanks again -
Hi people, I've got about 10 fields in my html form and I just want to parse the information into an xml file that will be upload to an ftp. Could someone please direct me to a thread or a tutorial that deal with creating an xml file from an html form? Thanks