-
Posts
24,602 -
Joined
-
Last visited
-
Days Won
830
Everything posted by Barand
-
Yes. You would use the on change event to send an AJAX request to the server and return a value to let you know if is taken or not.
-
Avoid problems with spaces and lowercase entirely by restructuring your array $cakesmade = array( "kate" => array( 0=>array( "cakename" => "cake", "cakeingredients" => "egg, flour" ), 1=>array( "cakename" => "Lovely Chocolate Cake", "cakeingredients" => "chocolate, eggs, flour" ), 2=>array( "cakename" => "amazing cake", "cakeingredients" => "lemons, flour" ) ) );
-
Selecting all data of a specific date from mysql datetime
Barand replied to ludah's topic in MySQL Help
... WHERE DATE(departure_date_time) = CURDATE() -
You said you wanted the chart on the same page
-
No problem now we have established that works <?php $dir = './data/test111'; $ddArray1 = scandir($dir,1); ?> <html> <head> <title>Select Drop Down List</title> </head> <body> <form action="" method="get"> <select name="file"> <?php FOREACH($ddArray1 AS $file){ PRINT '<option value="'.$file.'">'.$file.'</option>'; } ?> </select> <input type="submit"/> </form> </body> </html> <?php if (isset($_GET['file'])) { $id = $_GET['file']; echo "<img src='mygraph.php?file=$id' />" ; } ?>
-
save data to database checkboxe values checked or not
Barand replied to tom7890's topic in PHP Coding Help
Don't output a checkbox for times already booked. If you look at the booking form in the code I gave you you will see it only allows input for non-booked times (except for a cancellation checkbox). And add a unique key on (date, starttime) in the booking table to prevent duplicates. Add a hidden input field to your form containing the date value <input type="hidden" name="date" value="2015-01-22" /> then you can access with $_POST['date'] Why are you hard-coding all those start times in your form instead of pulling them from a timeslot table in the db? Again, if you look at my code you will see it uses a query with FROM timeslot LEFT JOIN booking so you know all the timeslots and which timeslots have/not been booked for the day -
No guarantees, but try putting the php portion of your code in a separate file (mygraph.php) and use GET instead of post. In a separate php file put $id = whatever; echo "<img src='mygraph.php?file=$id' />";
-
Your join() isn't putting the statuses in quotes. It will give IN (active,inactive,un-verified,cheater)
-
By using the "text-align" attribute in the cells style definition. https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
-
You can format it in your query EG SELECT DATE_FORMAT(datecol, '%d.%m.%Y') as formatted_date or you can do it in php echo date('d.m.Y', strtotime($row['datecol']));
-
I set up styles with 3 background colours pale green - default, no bookings yellow - partially booked days red - fully booked days td { background-color: #C4E5C4; } td.full { background-color: red; color: white; font-weight: 600; } td.partial { background-color: yellow; color: black; font-weight: 600; } This the relevant code to apply those classes if (isset($bookings[$d->format('Y-m-d')])) { // are there bookings in db for that day? $tit[$dow] = wordwrap($bookings[$d->format('Y-m-d')][1],34); // construct popup of free times (on hover) if ($bookings[$d->format('Y-m-d')][1]) // are there free slots? $clsArray[$dow] = "class='day partial $now'"; // if so, apply "partial" class else $clsArray[$dow] = "class='day full $now'"; // if not, apply "full" class }
-
Do you want me to answer that here or in that (yet another) thread you have now raised?
-
The code I gave you in your original thread on this topic (you now have 3 of them) showed you how to colour code your cells and almost all the other things you said you wanted (like showing available times on hovering, making the cells clickable, displaying a booking form for the clicked day). Look at the code, the answers are there.
-
Putting an array in to a CSV using fputcsv
Barand replied to Kristoff1875's topic in PHP Coding Help
Nonsense!. You can access any bits of a datetime field that you need. EG mysql> SELECT dob FROM date_sample; +---------------------+ | dob | +---------------------+ | 2014-09-11 20:57:22 | +---------------------+ mysql> SELECT YEAR(dob) as year FROM date_sample; +------+ | year | +------+ | 2014 | +------+ mysql> SELECT MONTH(dob) as month FROM date_sample; +-------+ | month | +-------+ | 9 | +-------+ mysql> SELECT DAY(dob) as day FROM date_sample; +------+ | day | +------+ | 11 | +------+ mysql> SELECT DATE_FORMAT(dob, '%b %d') as birthday FROM date_sample; +----------+ | birthday | +----------+ | Sep 11 | +----------+ -
Putting an array in to a CSV using fputcsv
Barand replied to Kristoff1875's topic in PHP Coding Help
As a space-saver it isn't much of an idea either A DATETIME field in a table occupies 8 bytes whereas $serialized_date = 'a:3:{i:0;s:2:"03";i:1;s:2:"02";i:2;s:4:"1986";}'; echo strlen($serialized_date); #---> 47 39 wasted bytes! -
Putting an array in to a CSV using fputcsv
Barand replied to Kristoff1875's topic in PHP Coding Help
You'll have to unserialize() then join() to get a string value. Why are a you using a relational database to store data in a manner that prevents you from ever using it as a relation database? I recommend you read up data normalization and relational database design. -
Output an HTML anchor tag with a link to the file. echo "<a href='path/to/file'>View</a>";
-
Having a form insert the data in the database.
Barand replied to laflair13's topic in PHP Coding Help
You are connecting with mysql_connect() then using mysqli_query(). You need a mysqli connection, you cannot mix the two. -
Check your array is as it should be echo '<pre>',print_r($opts, true),'</pre>'; For example, is there a "/" missing from the URL item?
-
echo urldecode("Galaxy+Universe+Admin"); #--> Galaxy Universe Admin
-
Two Input Forms - One Based Upon Input to the Other
Barand replied to nshaw's topic in PHP Coding Help
The array code is perfectly valid. If you want an indexed array to start at 1 instead of 0 $array = array( 1 => "a", "b", "c", "d", ); echo '<pre>',print_r($array, true),'</pre>'; RESULT Array ( [1] => a [2] => b [3] => c [4] => d ) See PHP manual http://php.net/manual/en/language.types.array.php example #5 -
Replacing the current <script> with this in the code I posted in your other thread will do it <script type="text/javascript"> //******************************************** // Create the on-click function for each // clickable cell (class = day) // to resubmit the page with clicked date //******************************************** <?php if (isset($_GET['date'])) { echo "var formvis = \"visible\";" ; } else { echo "var formvis = \"hidden\";" ; } ?> $().ready(function(){ $(".form").css("visibility",formvis); $(".day").click(function(){ location.href="?date="+$(this).attr("id"); }) }) </script>
-
does this help? http://www.firstdata.com/downloads/marketing-merchant/fdgg-web-service-api-v3.pdf
-
Then what are you sending to Linkpoint, if it requires an xml string?
-
If I understand right, the second block above should be like the third, not using POSTs that don't exist.