-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
carrying form variables through to a third script
Muddy_Funster replied to ikkyopaul's topic in PHP Coding Help
You have a choice: send them in the url and use $_GET[], send them by post again using a hidden field set on the page that is popultaed with your variable data or push them into $_SESSION[] variables. The last one is the comon solution, but you will NEED to include session_start(); at the start of every unique page (i.e. any page that is not called as an include/require). -
could try and change to this, but I'm not sure if it's right or not $checklist = $_POST['size[]']; Just a thought
-
Always using quotes around values will meen that you can not ever use integer values then as wraping a value within quotes in SQL tells it it's a string.
-
Why have you put backticks around ID? and why have you put the number 1 inside quotes?
-
try changing to this: $password=md5( md5($password), $salt); though why your md5()ing it twice is beyond me
-
Distinguishing between rows from a union query.
Muddy_Funster replied to drayarms's topic in PHP Coding Help
Erm...why? The question is about formating the output, it's nothing to do with the SQL or column names, or even table names - although, on the subject of table names, why didn't you just name your tables a, b, c and your fields a,b,c,d it would have saved you having to type the full names at all? -
sounds like $arr_read_messages isn't formated as PHP would expect it to be, you could try if(!in_array($ct->data[$key][3], "$arr_read_messages")){
-
OK, glad we got that cleaerd up From what I have read, I think you might want to change the $$file to ${$file} to evidence that it is an array.
-
isn't there a different section in the forums for this kinda thing?
-
nice, I never knew about those So, having established my ignorance please indulge me a minute - you are assigning a variable variable array variable to $$file (which is attached to $file wich is declared as the contents of $this->upload->initialize($config); which may or may not also be an array? is that right or am I getting the totaly wrong end of the stick?
-
I see, well, as far as I can tell there are two ways of doing it. Because you are storing your checkbox info in an array, you can either implode the array, then run preg_match()'s against it, or loop through it with a for each loop. I think the for each loop is probably the easiest option. $checkList = array (); $checklist = $_POST['size']; $smallOut = 0; $mediumOut = 0; $largeOut = 0; foreach ($checklist as $option){ if ($option = 'Small'){ $smallOut = 1; } else if ($option = 'Medium'){ $mediumOut = 1; } else if ($option = 'Large'){ $largeOut = 1; } } echo 'Checking values:<br>'; echo '<table><tr><th>Small</th><th>Medium</th><th>Large</th></tr>'; echo "<tr><td>$smallOut</td><td>$mediumOut</td><td>$largeOut</td></tr></table>"; Something like that should do, it's messy and untested and probably needs some work but it should get you on the right track.
-
I have never come across a variable prefix using $$ - where did you get this idea from?
-
I wouldn't personaly (again, purely personal prefference here, not saying any one is better than the other) use md5, preffer using crypt with sha256 $password = crypt('muddy_funster', '$5$rounds=5000$##SaltStringHere$');
-
That's pretty much exactly what you would need.
-
problem is that there is no $row['flags'] or $row['color'] - since you are using mysql_fetch_array() change these to $row['0'] and $row['1'] respectivly and it should work, alternativly (and better practice) you can aliase your fields in the SQL SELECT flags.name AS flags, colors.name AS color FROM... also - have you got error reporting set to E_ALL? it should have told you that there were undifined variables
-
php manual page for crypt() has some good resources on in -> http://php.net/manual/en/function.crypt.php
-
yeah, I think the word you wanted was supress, not surpass. It's the only option for the way you are checking the value. you are basicly saying "If this value has been assigned, do this-" however, any time that the value is unassigned you will get that notice up. you are either going to have to change the way you check for the form having been submitted (and quite a few other things as well) or use the @ to suppress the notice.
-
I would probably use a new table for each quiz, with a master index table. each quiz table having question, answer1, answer2, answer3, answer4, corect_answer where correct answer is 1,2,3,4 to refference which of the offered answers is the right one. I havn't thought it through though, you really will need to take some time over your design phase and decide how it's best to refference the data over all.
-
why does no-one ever read before they post? your query failed to return a dataset. because the value of GET['id'] wasn't found in the table, because the value of GET['id'] is not found using double quotes, it is GET['id'] with single quotes, although I expect it's probably a url malformation from the reffering page. Please post code that is from the page that links to this one. two things you need to learn - error capture and variable checking.
-
Gotcha. And what do you see the future of these quizes being after they have been stored? If it's interactivity on the site that you want then store them in a database, otherwise you can get away with flat file storage if it's for something like "download this quiz and print it off".
-
take out "active='1' AND" p.s. why is 'active' storing numerical data in string format?
-
Delete initial digits at the beginning of a string
Muddy_Funster replied to etrader's topic in PHP Coding Help
You could put a preg_match into substr() loop to check from the initial character through the word untill the first non match, then substr() the portion of the string to the right of the loop count marker...(does that make any sense?)