-
Posts
67 -
Joined
-
Last visited
Everything posted by DarkKnight2011
-
hi, To get an additional window to appear that will show content from another URL then yes, you could use something like window.open(url, "Popup Window", "width=400,height=300,resizable=yes"); Although, As gristoi stated, this is a very old (and also annoying) way of showing information even if it's not intended for advertisements, the code provided by gristoi can be used to popup a form or some other small information on the current page the user is viewing, Which is much preferrred. And yeah, Inline javascript.... eeeeeewww
-
datepicker minDate based on time of day
DarkKnight2011 replied to bravo14's topic in Javascript Help
Did this work ok for you? could you please mark as answered if so, Thanks -
try one of these or maybe best to buy a book, but be prepared to put alot of time into it, You can't master programming languages easily www.php.net http://www.codecademy.com/tracks/php The topic of your post concerns me though, it wont be fast lol
-
datepicker minDate based on time of day
DarkKnight2011 replied to bravo14's topic in Javascript Help
Try this... <script> $(function() { $( "#delDate" ).datepicker({ dateFormat: 'd MM yy', changeMonth: true, changeYear: true, minDate: "+1D", constrainInput: true }); var currentdate = new Date(); if (currentdate.getHours() >= 17) { currentdate.setDate(currentdate.getDate() + 2); $( "#delDate" ).datepicker( "option", "minDate", currentdate); } }); </script> -
I would suggest that you use an associative array, ie. $arr = array( 'value1' => 1, 'value2' => 2 ); echo $arr['value1']; // outputs 1 or given your latest comment... $arr = array( 'tableName' => 'Table1', 'tableData => array( 'value1' => 1 ) );
-
Yeah I agree, This does sound like a fairly big project, if your new i would personally suggest that you start off with something smaller first, There are alot of considerations regarding which technologies to use for a project, and varies for each one. Personally my choice for that application would probably be Backend - PHP (Symfony2/Zend Framework 2) FrontEnd - ExtJs (www.sencha.com) or maybe something like BackboneJS with Twitter Bootstrap But to use those things would take a lot of learning, Maybe try a smaller project and see how you progress, You could of course hire an experienced developer to build this on your behalf but it would be expensive
-
Assigning colors from XML variable in an array
DarkKnight2011 replied to Texan78's topic in PHP Coding Help
nice mate, well done -
Assigning colors from XML variable in an array
DarkKnight2011 replied to Texan78's topic in PHP Coding Help
Your welcome mate, good luck with the project -
Forcing a password change every 90 days
DarkKnight2011 replied to swatisonee's topic in PHP Coding Help
Like Jessica has mentioned, when a user is registered or changes their password, store the date this occured in the user table, Then in your script you can check to see if that was last done more than 90 days ago, if it was more then show a change password screen otherwise success -
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
your welcome mate, could you mark the question as answered, Good luck with the project -
Assigning colors from XML variable in an array
DarkKnight2011 replied to Texan78's topic in PHP Coding Help
sorry I'm really missing something here I think, maybe this helps... $color = ''; switch($severity) { case 'Extreme': $color = 'red'; break; case 'Severe': $color = 'amber'; break; default: $color = 'white'; } echo "<span style='color: $color;'>$severity</span>"; Does that help? -
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
that is the var_dump($sql) line we added earlier, just remove it, was to try and find out what is happening with the query -
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
sorry what do you mean? the query looks ok? I have never used on duplicate key to be honest so not sure about that -
SELECT requests.*, users.*, areas.* FROM requests LEFT JOIN users ON requests.requesterID = users.userid LEFT JOIN areas ON requests.areaID = areas.areaID try that, you had brackets in there which weren't needed
-
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
in this case your using a variable that hasn't been defined before, so either your calculate function isn't working or you need to initialise it first, ie. add $calories = 0; near the top of your code before you use it in a calculation -
try this http://www.codecademy.com/tracks/php
-
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
The value is being passed into the query correctly, i think it may be due to the ON DUPLICATE KEY statement, why dont you auto increment the ID key? try running that query directly in mysql client / phpmyadmin / mysql workbench and it will show the error that is being thrown -
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
try this.. // Create connection $con=mysqli_connect("localhost","root","","inshapewebsite"); // Check connection if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $clid=111; $date=date("m.d.y"); $foodS = ''; $total = 0; foreach ($_SESSION['foodTypes'] as $food) { $foodS= $foodS . ",". $food; } $calories = (int) calculate($_SESSION['foodTypes']); $query = "SELECT Calories FROM caloriescounter where ID=$clid AND Date = '$date'"; $result1 = mysqli_query($con,$query); $row = mysqli_fetch_array($result1); $total = $calories + (int) $row['Calories']; $sql = "INSERT INTO caloriescounter (ID, Date, Lunch, Calories) VALUES ($clid, '$date','$foodS', $total) ON DUPLICATE KEY UPDATE Lunch = '$foodS'"; var_dump($sql); echo 'The amount of Calories registered is: ' . $total; $result = mysqli_query($con, $sql) or die(mysqli_error()); //mysqli_query($con,"INSERT INTO caloriescounter (ID, Date, Lunch) //VALUES ('$clid', '$date','$foodS')"); mysqli_close($con); // session exists and has content // process the array list here. // after the processing, empty the session $_SESSION['foodTypes'] = array(); } -
Assigning colors from XML variable in an array
DarkKnight2011 replied to Texan78's topic in PHP Coding Help
so you need to know how to get the $severity variable assigned from the code in the XML file itself? you would need to provide a sample from the xml file or a sample of the array -
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
try this... $result = mysqli_query($con,"INSERT INTO caloriescounter (ID, Date, Lunch, Calories) VALUES ('$clid', '$date','$foodS', '$total') ON DUPLICATE KEY UPDATE Lunch = '$foodS'") or die(mysqli_error()); You might need to check the mysqli_error() bit, I haven't used mysqli for a while -
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
Does it echo out the total? you shouldn't enclose the $total value in quotes as it is a number like you said "INSERT INTO caloriescounter (ID, Date, Lunch, Calories) VALUES ($clid, '$date','$foodS', $total) -
Assigning colors from XML variable in an array
DarkKnight2011 replied to Texan78's topic in PHP Coding Help
sorry i dont understand what your trying to do, could you maybe give some example code even if it is wrong and i'll see if i can fix it? will help to understand the issue. things i need to know... what values would you expect to receive what logic do you want to apply to those values what is the output Thanks, sorry i just dont get it lol -
As far as I know, you cannot use the same id more than once, that could be throwing an error an causing your issue, they could all have the class menu, and the id's can be button1, button2 etc
-
retrieve data from database.. variable in the query
DarkKnight2011 replied to farahZ's topic in PHP Coding Help
You will still a form element with the value for the total in order to post it, If you could show your code for the form I can help -
If you want to get the ip address of a local machine accessing your website then that previous code will still work, if your trying to the ip address of the machine your website is running on try this... $localIP = gethostbyname(trim('hostname')); I think it only works on linux though