
onlyican
Members-
Posts
921 -
Joined
-
Last visited
Everything posted by onlyican
-
First you want to get what today - 4 weeks is <?php $LinuxToday = strtotime("now"); $ADay = 1*60 *60 *24; $Linux4WeeksAgo = $LinuxToday - 28 * $ADay; $DB4WeeksAgo = date("Y-m-d H:i:s", $Linux4WeeksAgo; $Today = date("Y-m-d H:i:s"); $query = "SELECT * FROM Categories WHERE ProductsDateAdded BETWEEN '".$DB4WeeksAgo."' AND '".$Today."'"; ?>
-
INNER JOIN GOT error for mysql_fetch_array()
onlyican replied to jimjack145's topic in PHP Coding Help
try this 2 Things $result = mysql_query($query); You dont need the " and also try this under that line if(!$result){ echo "Error.<br />\n".mysql_error(); } -
Yes its possible. But not easy. You need to open the site in php, which will have the source code. and find <form name= Then Hope they aint like me and do <form method='post' name='XXX' action='' Or some other order.
-
Hey people I have a page for when the user has purchased something. The form has 2 submit buttons. One being "Cancel order" Other being "Continue To Buy" As you might guess, if the user Clicks "Cancel Order" I want to cancel the order. Now, what happens if the user Clicks "Canel order" By accident, they actually want to purchase. So I want a little bit of Javascript to check they want to cancel. Nothing to clever, something like this. This is what I done so far //Javascript Include File function ComfirmCancelOrder(){ var r=confirm("Are you sure you want to cancel this order?"); if(r==true){ return true; }else{ return false; } } function on the submit button for Cancel I have <input type='submit' name='submit' value='Cancel order' onclick='ConfirmCancelOrder();' /> So what happens now, is the user Clicks cancel, I get a pop up saying my text, and a OK and Cancel button. What I want is, If the user clicks OK, then the form is submitted, if the user Clicks Cancel, then nothing happens. But at the moment, whatever the user clicks the form is still submitting. How do I stop that form submitting if the user clicks cancel.
-
ok I understand I think You dont want one two three ect You want one two three four five .. .. .. If its a text sheet, not HTM, you want \n\r NOT <br />
-
ok cheers, got it now
-
Using the same array <?php $numbers = array("one", "two", "three", "..."); foreach($numbers as $TheNumber){ echo $TheNumber."<br />\n"; } it all depends on why you want to do the loop, to what will be the best method
-
for($i = 1; $i <= 50; $i++){ echo "\"".$i."\","; } this will show "1", "2", "3", All the way to 50
-
but I need it in PHP, as I need to seperate the ones that are within 10 minutes and ones that are outside of the 10 minutes.
-
Hey people I am storing Date Time in the mySQL Table in the following format Y-m-d H:i:s (This is 2007-19-03 10:56:01) I want to check if that Date Time is within 10 minutes of NOW How would I do this? Its ok if the date time is as is above. But if now is 2007-19-03 00:03:04 (3 Minutes past midnight) That means having to then check Date -1 Any pre-built functions for this?
-
cheers, preg_replace works
-
Hey people I thought there was a function out there for this. I have a user input, and I want to remove all special chars, to make it suitable for a file name For example User input is Max's S@urday and then with this function, the output would be maxs surday So it removed the ' and @ Anyone remember this function, if not one out, any suggestions?
-
Hey people I have seen in several places where it says the Server time is X, and your computer time is Y How do I get the users computer time?
-
YYYY MM DD is not the american way USA Way is MM-DD-YYYY Its actually DB way, as I store the DB in the MySQL Table, under DATE Format
-
thank you, as I said, i thought there was a function in php
-
with this, $dob[] = $_POST['day']; $dob[] = $_POST['month']; $dob[] = $_POST['year']; $dateob = implode("/", $dob); I aint suprised <?php $Dob = $_POST["year"]."/".$_POST["month"]."/".$_POST["day"]; if(GetAge($Dob) < 13){ $value = "YES"; setcookie("RegisterBan", $value, time()+(1825*24*60*60)); } ?>
-
I could also do something like <?php function CountWords($Str){ $words = explode(" ", $str); $NumWords = count($words); return $NumWords; } ?> But I thought there was already a function out there
-
use my function if you want. I would not post it if I did not want people to use it
-
Hey people I need to check the amount of "Words" in a string, and I forgot how to do it I know strlen counts the number of chars in a string, I want the amount of words I think there is a function out there but I cant remember.
-
This is my function to get someones age <?php function GetAge($dob) { $dob = explode("-",$dob); $year = $dob[0]; $month = $dob[1]; $day = $dob[2]; $year_to = date("Y"); $month_to = date("m"); $day_to = date("d"); $age_this_year = $year_to - $year; $age_minus_one = $age_this_year - 1; if ($month_to == $month) { if ($day_to >= $day) { $age = $age_this_year; }else{ $age = $age_minus_one; } }else{ if ($month_to > $month) { $age = $age_this_year; }else{ $age = $age_minus_one; } } return $age; } ?> so you can do something like <?php if(GetAge($UsersDOB) <= 13){ //set cookie } ?>
-
i know I should not use the ID more than once, which is why I was checking if JavaScript can handle [] like PHP I have this then <script language='text/javascript' /> function FinishedEditing(){ alert(document.forms['MyForm'].elements['MyValues[]']); } </script> <form method='post' action='' name='MyForm'> <input type='text' name='MyValue[]' value='1' /> <input type='text' name='MyValue[]' value='2' /> <input type='text' name='MyValue[]' value='3' /> <input type='hidden' name='MyOrigValue[]' value='1' /> <input type='hidden' name='MyOrigValue[]' value='2' /> <input type='hidden' name='MyOrigValue[]' value='3' /> <input type="submit" onClick="FinishedEditing();" name="submit" class="loginbutton" value="Finished" /> </form> And the following pop up [object NodeList]
-
I mean the [] makes it an array for php I am a php guy so if I done this in php <input type='text' name='something' value='1' /> <input type='text' name='something' value='2' /> <input type='text' name='something' value='3' /> <?php print_r($_POST["something"]); //Output //3 ?> BUT if I did <input type='text' name='something[]' value='1' /> <input type='text' name='something[]' value='2' /> <input type='text' name='something[]' value='3' /> <?php print_r($_POST["something"]); //Output //Array ([0] => "1", [1] => "2", [2] => "3") if I done in javascript the following <script type='text/javascript'> function ShowValues(){ var MyValues; alert(document.getElementById('MyValues').value); } </script> <form method='post' action='' onClick="ShowValues();"> <input type='text' name='MyValues[]' id='MyValues' value='1' /> <input type='text' name='MyValues[]' id='MyValues' value='2' /> <input type='text' name='MyValues[]' id='MyValues' value='3' /> </form> I will get an Alert saying "1"; I want the array like Array ([0] => "1", [1] => "2", [2] => "3")
-
Hey guys I have a form, and when the user hits submit, I will check the form for certain things. Basic fields I can do easily by <input type='text' name='MyName' id='MyName' value='Jamie' /> <script type='text/javascript'> var MyName; MyName = document.getElementById('MyName').value; alert("MyName is " + MyName); </script> That works, I have a pop up with "Jamie" BUT I also have some text fields set out like this <input type='text' name='MyValues[]' value='1' /> <input type='text' name='MyValues[]' value='2' /> <input type='text' name='MyValues[]' value='3' /> The [] makes the Value go into an Array Is there anyway I can check this in JavaScript without a Page Refresh?
-
ok, that bets what I done I done this <?php function ValidateSeatingKeys(){ $ColumnsLeft = isset($_POST["ColumnsLeft"]) ? $_POST["ColumnsLeft"] : array(); $ColumnsMiddle = isset($_POST["ColumnsMiddle"]) ? $_POST["ColumnsMiddle"] : array(); $ColumnsRight = isset($_POST["ColumnsRight"]) ? $_POST["ColumnsRight"] : array(); $RowsTop = isset($_POST["RowsTop"]) ? $_POST["RowsTop"] : array(); $RowsMiddle = isset($_POST["RowsMiddle"]) ? $_POST["RowsMiddle"] : array(); $RowsBottom = isset($_POST["RowsBottom"]) ? $_POST["RowsBottom"] : array(); $Columns = array_merge($ColumnsLeft, $ColumnsMiddle, $ColumnsRight); $Rows = array_merge($RowsTop, $RowsMiddle, $RowsBottom); $Rows = array_merge($RowsTop, $RowsMiddle, $RowsBottom); $UniqueCols = array(); $UniqueRows = array(); $DupCols = array(); $DupRows = array(); foreach($Columns as $Column){ if(!in_array($Column, $UniqueCols)){ $UniqueCols[] = $Column; }else{ $DupCols[] = $Column; } } foreach($Rows as $Row){ if(!in_array($Row, $UniqueRows)){ $UniqueRows[] = $Row; }else{ $DupRows[] = $Row; } } if(count($DupCols) != 0 && count($DupRows) != 0){ return true; }else{ return false; } } ?> Cheers
-
I dont want to remove duplicates, I want to find them, and if there are duplicates, then return to the user, so they can correct the issue. If I remove duplicates, I mess up there work