cmb
Members-
Posts
100 -
Joined
-
Last visited
Everything posted by cmb
-
i get this error Notice: Undefined index: name in C:\xampp\htdocs\PhotosByChristian\Untitled-1.php on line 55
-
Notice: Undefined offset: 0 in C:\xampp\htdocs\PhotosByChristian\Untitled-1.php on line 55
-
I get an undefined offset error when i try and call the array i made i know very little so I'm stuck and i don't know what to do <?php $file = fopen("playerstats.csv","r"); $data = array(); while (($csv_line = fgetcsv($file, 0, ";")) !== FALSE) { echo $csv_line; $number = $csv_line[0]; $name = $csv_line[1]; $half = $csv_line[2]; $goals = $csv_line[3]; $assists = $csv_line[4]; $SOG = $csv_line[5]; $shots = $csv_line[6]; $fouls = $csv_line[7]; $yellow = $csv_line[8]; $yellowred = $csv_line[9]; $red = $csv_line[10]; $CK = $csv_line[11]; $saves = $csv_line[12]; $data[] = array( 'name' => $name, 'half' => $half, 'goals' => $goals, 'assists' => $assists, 'sog' => $SOG, 'shots' => $shots, 'fouls' => $fouls, 'yellow' => $yellow, 'yellowred' => $yellowred, 'red' => $red, 'ck' => $CK, 'saves' => $saves ); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <table><tr><td>Number: </td><td><?php echo $data[0];?></td></tr></table> </body> </html>
-
I tried what it said and it did not work this is my code <?php $file = fopen("playerstats.csv","r",";"); while(! feof($file)) { print_r(fgetcsv($file)); echo "<br />"; } fclose($file); ?>
-
How do i specify that i want the fgetcsv() to use a ; to separate instead of a , p.s.(i have no control over the .csv file so i cant change it from ; to ,)
-
So i have created a html5 java page for keeping soccer stats that works on my xoom offline, the problem is it runs really slow and it crashes often and i only have 1 person set up i was wondering if their was a way to make it faster and less buggy before i add the rest of the players please I don't know very much and all the help would be very muchly appreciated here is the code(i'm not including the show/hide code or the time code because I got them from tutorials on the web if they would help let me know and i will add them): mane page <!DOCTYPE html> <html manifest="stats.appcache"> <head> <title>Stats</title> <script type="text/javascript" src="../js/showhide.js"></script> <script type="text/javascript" src="../js/timer.js"></script> <script type="text/javascript" src="../js/localstoragefunctions.js"></script> <script type="text/javascript" src="../js/playertime.js"></script> <link href="../css/stats.css" rel="stylesheet" type="text/css"> </head> <body onload='load();'> <table width="779"> <tr> <td width="254" class="button">Score <input type="text" class="time" id="us" size="1" readonly value="0" />:<input type="text" class="time" id="them" size="1" readonly value="0" /></td> <td width="257"><input class="button" type="number" name="minutes" id="minutes" min="1" max="100" size="2" /> <input type="button" name="minutesbtn" id="minutesbtn" value="Chose" onClick="time()" class="button" /></td> <td width="110"><div class="button" id='timer'></div><div id='uptime'></div></td> <td width="64"><a href="../pinkpanthers/pinkpanthers.php">Home</a> <a href="upload.php">Upload</a></td> </tr> </table> <table width="1005" border="1"> <tr> <td width="82" height="85"><p class="button">Tyler</p></td> <td width="56"><form id="form1" name="form1" method="post" action=""> <input type="checkbox" name="inout" id="inout" rel="in" onClick="ss()" class="checkbox"/> <label for="inout">In/Out</label> </form></td> <td width="845"> <table border="0"> <td width="56" style="background-color:#666666; border:#666666" rel="in"><form id="form2" name="form2" method="post" action=""> <input type="checkbox" name="golliey" id="golliey" rel="gollie" class="checkbox" /> <label for="golliey">Golly</label> </form></td> <td width="118" style="background-color:#666666; border:#666666" rel="gollie"><form id="form6" name="form6" method="post" action=""> <input name="gsavebtn" type="button" id="gsavebtn" value="Saves" onClick="add_gsave()" class="button"/> <input name="gsave" type="text" id="gsave" value="0" size="2" readonly class="gol"/> </form></td><td width="120" style="background-color:#666666; border:#666666" rel="gollie"> <form id="form43"> <input type="button" name="inbtn" id="inbtn" value="Let In" onClick="add_in()" class="button"/> <input name="in" type="text" id="in" value="0" size="2" readonly class="gol"/> </form></td> <td width="118"rel="in"><form id="form3" name="form3" method="post" action=""> <input type="button" name="savesbtn" id="savesbtn" value="Saves" onClick="add_save()" class="button"/> <input name="save" type="text" id="save" value="0" size="2" readonly class="time"/> </form></td> <td width="113"rel="in"><form id="form4" name="form4" method="post" action=""> <input type="button" name="goalbtn" id="goalbtn" value="Goals" onClick="add_goals()" class="button"/> <input name="goals" type="text" id="goals" value="0" size="2" readonly class="time"/> </form></td> <td width="134"rel="in"><form id="form5" name="form5" method="post" action=""> <input type="button" name="assistbtn" id="assistbtn" value="Assists" onClick="add_assist() " class="button"/> <input name="assists" type="text" id="assists" value="0" size="2" readonly class="time"/> </form></td> <td width="317"><input type="text" class="time" id="disp"/></td> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> <script type="text/javascript"> function time(){ var minu = document.getElementById('minutes').value; var minutes = minu * 60; CreateTimer("timer", minutes); //CreateTimer1("uptime", minutes); } //////////////////////////////////////////////////////////////////////////////// //FOR SCORE ARRAY // 0 us //1 them //FOR NAME ARRAYS // 0 Gollie saves // 1 Gollie letin // 2 saves // 3 goals // 4 assists // 5 time played var val1 = localStorage.getItem('Tyler').split(',')[0]; document.getElementById('gsave').value = val1; var val2 = localStorage.getItem('Tyler').split(',')[1]; document.getElementById('in').value = val2; var val3 = localStorage.getItem('Tyler').split(',')[2]; document.getElementById('save').value = val3; var val4 = localStorage.getItem('Tyler').split(',')[3]; document.getElementById('goals').value = val4; var val5 = localStorage.getItem('Tyler').split(',')[4]; document.getElementById('assists').value = val5; var val6 = localStorage.getItem('Score').split(',')[0]; document.getElementById('us').value = val6; var val7 = localStorage.getItem('Score').split(',')[1]; document.getElementById('them').value = val7; </script> and here is the functions: //FOR SCORE ARRAY // 0 us //1 them //FOR NAME ARRAYS // 0 Gollie saves // 1 Gollie letin // 2 saves // 3 goals // 4 assists // 5 time played var tyler = [0, 0, 0, 0, 0, 0]; tyler[0] = localStorage.getItem('Tyler').split(',')[0]; tyler[1] = localStorage.getItem('Tyler').split(',')[1]; tyler[2] = localStorage.getItem('Tyler').split(',')[2]; tyler[3] = localStorage.getItem('Tyler').split(',')[3]; tyler[4] = localStorage.getItem('Tyler').split(',')[4]; tyler[5] = localStorage.getItem('Tyler').split(',')[5]; var score = [0, 0]; score[0] = localStorage.getItem('Score').split(',')[0]; score[1] = localStorage.getItem('Score').split(',')[1]; function add_gsave() { var bm = document.getElementById('gsave').value; var am = bm * 1 + 1; tyler[0] = am; localStorage.setItem("Tyler", tyler); document.getElementById('gsave').value = am; } function add_in() { var bm = document.getElementById('in').value; var am = bm * 1 + 1; tyler[1] = am; localStorage.setItem( "Tyler", tyler ) document.getElementById('in').value = am; var them = document.getElementById('them').value; var addthem = them * 1 +1; score[1] = addthem; localStorage.setItem("Score", score); document.getElementById('them').value = addthem; } function add_save() { var bm = document.getElementById('save').value; var am = bm * 1 + 1; tyler[2] = am; localStorage.setItem( "Tyler", tyler ) document.getElementById('save').value = am; } function add_goals() { var bm = document.getElementById('goals').value; var am = bm * 1 + 1; tyler[3] = am; localStorage.setItem( "Tyler", tyler ) document.getElementById('goals').value = am; var us = document.getElementById('us').value; var addus = us * 1 +1; score[0] = addus; localStorage.setItem("Score", score ); document.getElementById('us').value = addus; } function add_assist() { var bm = document.getElementById('assists').value; var am = bm * 1 + 1; tyler[4] = am; localStorage.setItem( "Tyler", tyler ) document.getElementById('assists').value = am; }
-
This is the code i came up with var t = []; t.push(innerHTML = TotalSeconds1); localStorage.setItem("assist_time", t); but it doesn't do what i want instead of it just updating the same spot in the array i want it to add on the new value to the end of the array
-
After i posted this i acutally figured this out but i was wondering if their was a better way of doing it <form id="form6" name="form6" method="post" action=""> <input name="gsavebtn" type="button" id="gsavebtn" value="Saves" onClick="add()"/> <input name="gsave" type="text" id="gsave" value="0" size="2" readonly /> </form> <script type="text/javascript"> function add() { var bm = document.getElementById('gsave').value; var am = bm * 1 + 1; document.getElementById('gsave').value = am; localStorage.setItem( "gsave", am ) } </script>
-
This is what i would like to do and i have no idea how to, pleas help i want to get the value of a text box add 1 to it and then update what that text box says
-
Im very sorry to have wasted your time you were correct with the password not matching in the update query thank you for your help
-
Ya and it works i tried a INSERT INTO query instead of the UPDATE one and that didn't work either
-
i echoed $session $email $pas $ip $password and $key and everything is coming out correctly
-
no that wasn't it because when i did that it just gives me the password doesn't match the database error the + works
-
I'm not shore what to do this update code isn't updating my database this is just the update code for my login mysql_query("UPDATE users SET session_id='$session' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add session ID to DB mysql_query("UPDATE users SET login_ip='$ip' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add login IP to DB and this is all of it <title>Log In</title><?php require('database.php'); //Include DB connection information if (isset($_POST['login'])) { //Execute the following if form is submitted $ip = mysql_real_escape_string($_SERVER["REMOTE_ADDR"]); //Geet user's IP Address $email = mysql_real_escape_string($_POST['email']); //Post email from form $password = mysql_real_escape_string(sha1(md5($_POST['pass']))); //Post password from form and encrypt if (empty($email) || empty($password)) { //Check for empty fields die("<b>Error:</b> All fields are required to be filled in."); } $check = mysql_query("SELECT * FROM users WHERE email = '$email'") or die(mysql_error()); $check2 = mysql_num_rows($check); if ($check2 == 0) { //Check if account exists die("<b>Error:</b> Email and password do not match the database."); } $row = mysql_fetch_array($check); $db_password = $row['password']+$row['key']; if ($password != $db_password) { //Check if password is correct die("<b>Error:</b> Email and password do not match the database."); } $allowed = $row['u']; if ($allowed != 1) { //Check if they have permission die("<b>Error:</b> You do not have permission to view this section."); } function randomstring($length = 10) { $validCharacters = "abcdefghijklmnopqrstuxyvwz1234567890"; $validCharNumber = strlen($validCharacters); $result = ""; for ($i = 0; $i < $length; $i++) { $index = mt_rand(0, $validCharNumber - 1); $result .= $validCharacters[$index]; } return $result; } $session = randomstring(); $key = $row['key']; $pas = $password . $key; mysql_query("UPDATE users SET session_id='$session' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add session ID to DB mysql_query("UPDATE users SET login_ip='$ip' WHERE email='$email' AND password='$pas'") or die(mysql_error()); //Add login IP to DB $level = $row['accounttype']; $u = $row['u']; $fs = $row['fs']; $bc = $row['bc']; $fam = $row['fam']; $future = time() + 1209600; setcookie("uemail", $email, $future); //Set cookie containing username setcookie("sessionid", $session, $future); //Set cookie containging session ID setcookie("acounttype", $level, $future); setcookie("u", $u, $future); setcookie("fs", $fs, $future); setcookie("bc", $bc, $future); setcookie("fam", $fam, $future); ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// //header("Location: undefined.php"); //Redirect to members page } else { //If form is not submitted display the form echo<<<login <center> <h1>Log In To The Undefiend Section</h1> <h2>Or GO <a href="../main.php">Home</a></h2> <form method="post" action=""> Email: <input type="text" name="email"><br> Password: <input type="password" name="pass"><br> <input type="submit" name="login" value="Login"><br><br> </form></center> login; } ?>
-
I followed this tutorial on how to do this and it all works except for when i went and tried to run the site in IE8 the popup comes up in the top left and idk how to fix it #predata{ display:none; position:fixed; _position:absolute; /* hack for internet explorer 6*/ height:auto; width:auto; background:#FFFFFF; border:2px solid #cecece; z-index:2; padding:12px; font-size:13px; } #predata h1{ text-align:center; color:#6FA5FD; font-size:22px; font-weight:700; border-bottom:1px dotted #D3D3D3; padding-bottom:2px; margin-bottom:20px; } #predataClose{ font-size:20px; line-height:20px; right:6px; top:4px; position:absolute; color:#6fa5fd; font-weight:700; display:block; } ///////////////////////////////Pre Data//////////////////////////////////////////////// //SETTING UP OUR POPUP //0 means disabled; 1 means enabled; var popupStatus = 0; //loading popup with jQuery magic! function loadPopup3(){ //loads popup only if it is disabled if(popupStatus==0){ $("#backgroundPopup").css({ "opacity": "0.7" }); $("#backgroundPopup").fadeIn("slow"); $("#predata").fadeIn("slow"); popupStatus = 1; } } //disabling popup with jQuery magic! function disablePopup3(){ //disables popup only if it is enabled if(popupStatus==1){ $("#backgroundPopup").fadeOut("slow"); $("#predata").fadeOut("slow"); popupStatus = 0; } } //centering popup function centerPopup3(){ //request data for centering var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupHeight = $("#predata").height(); var popupWidth = $("#predata").width(); //centering $("#predata").css({ "position": "absolute", "top": windowHeight/2-popupHeight/2, "left": windowWidth/2-popupWidth/2 }); //only need force for IE6 $("#backgroundPopup").css({ "height": windowHeight }); } //CONTROLLING EVENTS IN jQuery $(document).ready(function(){ //LOADING POPUP //Click the button event! $("#btn_predata").click(function(){ //centering with css centerPopup3(); //load popup loadPopup3(); }); //CLOSING POPUP //Click the x event! $("#predataClose").click(function(){ disablePopup3(); }); });
-
Yes it does display with the list of dates and when i put this in the place of $row['0'] it doesn't show any results then
-
Sorry but where should i put this code
-
i want to pass 2 variables through the url and the one im having trouble with is passing the variable that comes from my mysql_fetch_row statement the way i have it now just pass the value array through and not the actual piece of data that i want <?php //adds database login information include_once "connecttodatabase/database.php"; $id = $_GET['id']; $query = "SELECT c_day_entered FROM Comments WHERE pid = $id UNION SELECT wv_day_entered FROM walk_in_visit WHERE wv_pid = $id UNION SELECT day_entered FROM first_visit WHERE fv_pid = $id ORDER BY 1 DESC" or die ('Error With Database ' .mysql_error()); $result = mysql_query($query) or die("Query failed ($query) - " . mysql_error()); while($row = mysql_fetch_row($result)){ echo "<h2><a href='repop.php?id=$id&date=$row'" . $id . $row['0']. ">" . $row[0] . "</a></h2>"; echo "<br />"; } // disconnect mysql_close(); ?>
-
Thank you thats what i wanted but one more thing is their anyway to get rid of Array ( [0] => when it shows the results
-
when i get rid of the while and just have it as print_r(mysql_fetch_row($result)); i only get 1 result when i should be getting 8 and im sure i should be getting 8 because ive tested the query with mysql workbench
-
I tried this but it doesnt give me all the data it should include_once "connecttodatabase/database.php"; $id = $_GET['id']; $query = "SELECT c_day_entered FROM Comments WHERE pid = $id UNION SELECT wv_day_entered FROM walk_in_visit WHERE wv_pid = $id UNION SELECT day_entered FROM first_visit WHERE fv_pid = $id ORDER BY 1 DESC" or die ('Error With Database ' .mysql_error()); $result = mysql_query($query) or die("Query failed ($query) - " . mysql_error()); while(mysql_fetch_row($result)){ print_r (mysql_fetch_row($result)); echo "<br />"; } // disconnect mysql_close(); ?>
-
i have this union statement that returns exactly what i want SELECT c_day_entered FROM Comments WHERE pid = '22' UNION SELECT wv_day_entered FROM walk_in_visit WHERE wv_pid = '22' UNION SELECT day_entered FROM first_visit WHERE fv_pid = '22' ORDER BY 1 DESC Now i want to using php display this info but idk how to do this help plz
-
i have set up a search of my database and now i want wen i click a result it to take me to a page were i can have the user edit the information this is my search code: <?php require('check_login.php'); echo "<a href=\"index.php\">Logout</a>"; echo "<span> </span>"; echo "<a href=\"s_home.php\">Home</a>"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-… <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search</title> </head> <body> <center> <h2>Search </h2> <form action='./search.php' method='get'> <input type='text' name='k' size='50' value='<?php echo $_GET['k']; ?>' /> <input type='submit' value='Search'> </form> <hr /> <?php $k = $_GET['k']; $terms = explode(" ", $k); $query = "SELECT * FROM patients WHERE "; foreach ($terms as $each){ $i++; if ($i == 1) $query .= "Keyword LIKE '%$each%' "; else $query .= "OR Keyword LIKE '%$each%' "; } // connect mysql_connect("localhost", "root", "password"); mysql_select_db("hospital_patients")… $query = mysql_query($query); $numrows = mysql_num_rows($query); if ($numrows > 0){ while ($row = mysql_fetch_assoc($query)){ $id = $row['id']; $name = $row['First_Name']; $lname = $row['Last_Name']; echo "<h2><a href='modify.php'>$name, $lname</a></h2> "; } } else echo "No results found for \"<b>$k</b>\""; // disconnect mysql_close(); ?> </center> </body> </html> MOD EDIT: code tags added.