jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
@Christian, there are many ways to solve this issue. I don't pretend at all that my code is a perfect. There is no a perfect code, also no perfect programmers. The whole idea is to show some beginning programers how could be done the same task in different way, that's why I write in this forum. By the way, you are absolutely right about global, but the answer really depends. In some cases you don't have a choice
-
pretty cool query buddy
-
Little mistake, this form should be return true: <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <select name="select"> <option value="Molimo odaberite" selected="selected">Molimo odaberite</option> <?php foreach ($validList as $val): ?> <option value="<?php echo $val; ?>"><?php echo $val; ?></option> <?php endforeach;?> <option value="Trup #T106">Trup #T106</option> </select> <input type="submit" name="Submit" /> </form> Try, // array items $validList = array('Trup #T100','Trup #T101','Trup #T102','Trup #T103','Trup #T104','Trup #T105'); // function, check for correct items exist in array function isValidList($str){ global $validList; return (isset($_POST['select']) && in_array($str, $validList)) ? true : false;} if(isset ($_POST['Submit'])){ var_dump(isValidList($_POST['select'])); } ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <select name="select"> <option value="Molimo odaberite" selected="selected">Molimo odaberite</option> <?php foreach ($validList as $val): ?> <option value="<?php echo $val; ?>"><?php echo $val; ?></option> <?php endforeach;?> <option value="Trup #T106">Trup #T106</option> </select> <input type="submit" name="Submit" /> </form> Now, as you can see, every value out of array named validList, should be false.
-
Molim te, no problem This way will work, but is not very effective. If someone type the value which name does not exist in options, the result could be true. My suggestion is creating an array with all available options. Take a look for seconds what I mean, for sure you can add more securities issues, if you want it. // array items $validList = array('Trup #T100','Trup #T101','Trup #T102','Trup #T103','Trup #T104','Trup #T105'); // function, check for correct items exist in array function isValidList($str){ return (isset($_POST['select']) && $str != 'Molimo odaberite') ? true : false;} if(isset ($_POST['Submit'])){ var_dump(isValidList($_POST['select'])); } // html form <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <select name="select"> <option value="Molimo odaberite" selected="selected">Molimo odaberite</option> <?php foreach ($validList as $val): ?> <option value="<?php echo $val; ?>"><?php echo $val; ?></option> <?php endforeach;?> </select> <input type="submit" name="Submit" /> </form>
-
Just check the value from options. Exemple: return (isset($_POST['select']) && $_POST['select'] != 'Molimo odaberite') ? true : false;
-
I would start from here -> http://www.php.net/manual/en/book.imap.php
-
In your script there is no variable name - submit. you can also use js .value method in php. This is completely wrong: if ((isset($_POST['submit'])) and (int($_POST["ValAnswer"].value) == 75))
-
Common..Jessie....don't kidding me To write integers between 1 - 12, this guy use integer column type(10), signed. @Christian, could you explain to him, what does mean, please ?
-
He needs to check the values coming from $_POST['grade_ID'], but the form use GET method. There is js functions too, but I don't see ajax code...I don't know
-
And...something else, if you want to retrieve the current month of year as an integer from 1 - 12, you could create a new field with a "DATE" type and using a month sql function to retrieve it. Now this field will have much more functionality than before. Don't waste database resources. Take a look at this: amount Newamount created_at 10.00 5.00 2012-10-12 100.00 40.00 2012-12-08 SELECT SUM(( `tbl_name`.`amount` -`tbl_name`.`newAmount` ) * month(`tbl_name`.`created_at` )) FROM `tbl_name`
-
@off the neil.johnson's post is correct, check the values again.
-
And..... where they are in this particular output ?
-
I don't have any experience with windows, but... try to change the path to a service.
-
date, title_a, title_b, title_c are names of the tables ?
-
What a result do you expect to be? I got - 770, the query is: SELECT SUM(( `amount` - `newAmount` ) * `months` ) FROM `tbl_name`
-
Now, how you'd like to be your sorting?
-
I think, you need to change executable path to the service. What OS you use - Linux, windows, mac?
-
http://support.godaddy.com/help/article/3323/locating-your-mysql-database-connection-strings/?pc_split_value=4
-
Have you tried dumping the content of $row? I can not understand if (!isset ($data[$row[$date] , variable inside in variable inside in other one Put this code inside the while loop and post the result: while ($row = mysql_fetch_array($rs)) { echo '<pre>'.print_r($row, true).'</pre>'; exit; // Check if we have a new date array.
-
Are you able to connect to database server using any mysql client application?
-
Don't public this information!
-
Sorry I skipped the first one