Jump to content

chriscloyd

Members
  • Posts

    488
  • Joined

  • Last visited

About chriscloyd

  • Birthday 02/05/1988

Contact Methods

  • Website URL
    http://cloydprojects.com

Profile Information

  • Gender
    Male
  • Location
    Arizona

chriscloyd's Achievements

Advanced Member

Advanced Member (4/5)

2

Reputation

  1. Try this <?php $host = "localhost"; $username = "root"; $password = "root"; $db_name = "test2.0"; $tbl_name = "permohonan"; mysql_connect("$host", "$username", "$password") or die("cannot connect"); mysql_select_db("$db_name") or die("cannot select DB"); if (isset($_POST['submit'])) { $Jabatan = mysql_real_escape_string($_POST['Jabatan']); $unit = mysql_real_escape_string($_POST['unit']); $lain2 = mysql_real_escape_string($_POST['lain2']); $nama_pemohon = mysql_real_escape_string($_POST['nama_pemohon']); $destinasi = mysql_real_escape_string($_POST['destinasi']); $tujuan = mysql_real_escape_string($_POST['tujuan']); $maklumat_ = mysql_real_escape_string($_POST['maklumat_']); $datedepart_ = mysql_real_escape_string($_POST['datedepart_']); $timedepart_ = mysql_real_escape_string($_POST['timedepart_']); $datearrive_ = mysql_real_escape_string($_POST['datearrive_']); $timearrive_ = mysql_real_escape_string($_POST['timearrive_']); $query1 = mysql_query("INSERT INTO permohonan VALUES(NULL,'$Jabatan','$unit','$lain2','$nama_pemohon','$destinasi','$tujuan','$maklumat_','$datedepart_','$timedepart_,'$datearrive_',$timearrive_')"); if ($query1) { header("location : reservationform.php"); } else { echo mysql_errno() . ": " . mysql_error() . "\n"; } } ?>
  2. I agree with Psycho, but it does not have to be a cron job, if you do not want to use one. You could do it on login. When the user logs in and if it is the first login of the day you can show all available job matches/alerts for that user.
  3. Hello, I would create another row in your member table called subscription_id or what ever you would name the subscriptions table. Then in the subscriptions table just create the rows for the id, name, description (if one), term (months, years), cost, renewal automatically, signup_date, end_date? Some of the things I add to the new table. Then just do your magic.
  4. var x = "#inputList", y = 2; $(add_button).on('click', function(e) { e.preventDefault(); $(x + y).css('display','inline); console.log($(x + y)); //this should show you if you have the right object check your console y++; return false; });
  5. Well hello this is easy if you use jquery.... A couple of things $(document).ready(function() { var appendEle = $("#updateFixture"); $("#fixtures").on('change', function() { appendEle.html(""); var stage = $(this).val(); $.post('getFixtures.php', {stage: stage}, function(data) { var obj = $.parseJSON(data); $.each(obj, function(index, fixture) { var newEle = $("<div></div>"); var goalsfor = $('<label>' + fixture.hometeam + ' Goals</label><input type="text" id="goalsfor_' + fixture.id + '" name="goalsfor_' + fixture.id + '" value="' + fixture.goalsfor + '" />'); var goalsagainst = $('<label>' + fixture.awayteam + ' Goals</label><input type="text" id="goalsagaint_' + fixture.id + '" name="goalsagaint_' + fixture.id + '" value="' + fixture.goalsagaint_+ '" />'); goalsfor.append(newEle); goalsagainst.append(newEle); newEle.append(appendEle); }); }); }); $("#saveButton").on('click', function() { $.post('saveFixtures.php', $("#contactForm").serialize(), function(data) { if(data == "success") { //do what you want } else { //do what you want } }); }); }); That is the jquery file you will need two other files to save the changes and update I can help with that too if you need
  6. function multi_array_permutations($arrays) { $loops = 1; foreach ($arrays as $array) { $loops *= count($array); } for ($i = 0; $i < $loops; $i++) { $product = 1; for ($j = 0; $j < count($arrays); $j++) { $product *= count($arrays[$j]); print($arrays[$j][$i/($loops/$product) % count($arrays[$j])]); } print(PHP_EOL); } }
  7. What exactly are you trying to do with this array?
  8. Fastsol, you know he was trying to show an example so I will help him with that array(array(1,1,1,1),array(2,2,2,2),array(3,3,3,3),array(4,4,4,4));
  9. <form action="" method="post" name="contact"> <input type="text" name="name" placeholder="First and Last Name" /><br /> <input type="email" name="email" placeholder="Email Address" /><br /> <input type="text" name="phone" placeholder="Phone Number" /><br /> <textarea name="message"> Type Your Message Here </textarea><br /> <input type="submit" name="submit" value="Send" /><br /> </form> <?php if(isset($_POST['submit'])){ $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $to = 'Your Email Address'; $subject = 'Contact Message From - ' . $name; $body = "Name: {$name}\n Email: {$email}\n Phone: {$phone}\n Message:\n {$message}"; mail($to, $subject, $body); }
  10. $team = $_GET['team']; echo $team; $query = 'SELECT * FROM a_players WHERE team= '. $team .' ORDER BY nameLast ASC'; $results = mysql_query($query); $count = 0; while($line = mysql_fetch_assoc($results)) { I cleaned up your code a little bit. <?php $team = mysql_escape_string($_GET['team']); if(is_int($team)){ $query = "select `nameFirst`, `nameLast` from `a_players` where 'team' = '{$team}' order by nameLast asc"; $results = mysql_query($query); $count = 0; //why are you counting if you mind me asking while($player = mysql_fetch_assoc($results)) { $nameFirst = $player['nameFirst']; $nameLast = $player['nameLast']; echo <<<EOT <div> <a href="http://eg10basketball.com/playerinfo?nameFull={$nameFirst}-{$nameLast}">{$nameFirst} {$nameLast}</a> <br> </div> EOT; } }
  11. You can always try printing out the global variable $_GET try this echo '<pre>'; print_r($_GET); echo '</pre>'; it will show all the variables sent through
  12. do this on your page before adding to the database just to make sure you are getting everything <?php echo "<pre>"; print_r($_POST); echo "</pre>";
  13. http://www.farinspace.com/saving-form-data-to-google-spreadsheets/ that other one is outdated
  14. Google is a good way to find out information. I googled accessing Google spread sheet and found this. http://sim.plified.com/2008/09/14/accessing-google-spreadsheet-with-php/
  15. my code <?php error_reporting(E_ALL); include("security/config.php"); //create season for testing purposes $sql_season = "insert into season (`season`) values ('1')"; $conn->query($sql_season) or die($conn->error); $season = 1; //echo "Season 1:<br />"; //get number of teams $sql_teams = "select * from teams"; $rs = $conn->query($sql_teams) or die($conn->error); $num_of_teams = $rs->num_rows; //echo " Number of teams this season: {$num_of_teams}<br />"; //put all teams in array $teams = array(); while($ts = $rs->fetch_array(MYSQLI_ASSOC)){ $teams[] = $ts; } if($num_of_teams % 2 != 0){ $teams[] = array('name' => 'bye week', 'id' => 0); $sql_dummy = "insert into teams (`name`) values ('bye week')"; $conn->query($sql_dummy); } //how many matches $weeks = 10; $matches = 10; //echo " This Seaon will be {$weeks} consisting of {$matches} matches<br /><br />"; for($i = 0; $i < $weeks; $i++){ //mix up teams $teams1 = $teams; shuffle($teams1); $number_of_matches = (count($teams) / 2); shuffle($teams); $teams1 = array_slice($teams, 0, $number_of_matches); $teams2 = array_slice($teams, $number_of_matches, $number_of_matches); $teams2 = array_reverse($teams2); shuffle($teams1); shuffle($teams2); $week = $i + 1; $sql_week = "insert into weeks (`number`, `season_id`) values ('{$week}', '{$season}')"; $conn->query($sql_week) or die($conn->error); $weekID = $conn->insert_id; //echo " Week {$week} Created:<br />"; $matchup = array(); $x = 0; do{ shuffle($teams1); shuffle($teams2); $team_1 = array_pop($teams1); $team_2 = array_pop($teams2); $sql_search = "select * from matches where (`team_1` = '{$team_1['id']}' or `team_1` = '{$team_2['id']}') and (`team_2` = '{$team_1['id']}' or `team_2` = '{$team_2['id']}') and `season_id` = '{$season}'"; $rs = $conn->query($sql_search) or die($conn->error); if($rs->num_rows == 0){ $sql_create = "insert into matches (`team_1`, `team_2`, `week`, `season_id`) values ('{$team_1['id']}', '{$team_2['id']}', '{$weekID}', '{$season}')"; $rs = $conn->query($sql_create); $x++; } else{ //echo "{$team_1['name']} vs {$team_2['name']} ==== Played already find new match up<br />"; $teams2[] = $team_1; $teams1[] = $team_2; array_reverse($teams2); shuffle($teams1); } } while($x < $number_of_matches); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.