
FinnKim
Members-
Posts
17 -
Joined
-
Last visited
Never
About FinnKim
- Birthday 07/08/1984
Profile Information
-
Gender
Male
-
Location
Finland
FinnKim's Achievements

Newbie (1/5)
0
Reputation
-
Click name from one mysql table to show report on other page
FinnKim replied to FinnKim's topic in PHP Coding Help
This is the last version of my code if(!isset ($_SESSION['v_topic'])){ $_SESSION['v_topic'] = 'topic';} $_SESSION['v_topic'] = $_Get['id']; $query = mysql_query("SELECT * FROM students WHERE topic LIKE'"%$_SESSION['v_topic']%"'"); $result=mysql_query($query) or die (mysql_error()); if($row = mysql_fetch_array($result)) { echo "<tr><p>"; echo"<th><p>" . $row['studentId'] ."</p></th>"; echo "<th><p>" . $row['gender'] . "</p></th>"; echo "<th><p>" . $row['fname'] . " " . $row['lname'] . "</p></th>"; echo "<th><p>" . $row['email'] . "</p></th>"; echo "<th><p>" . $row['assigned'] . "</p></th>"; echo "</tr>"; } else { mysql_error(); } and this is the link: echo"<th><a href='../student.php'=?id=".$row['topic']."'>".$row['topic']."</a></th>"; -
Click name from one mysql table to show report on other page
FinnKim replied to FinnKim's topic in PHP Coding Help
. Before it printed all the query, but since I've changed it, it just print this line:"Warning: mysql_query() expects parameter 1 to be string, resource given". ??? My code looks like this now: if (!isset($_GET['v_topic'])) { $st =($_GET['v_topic']); } else { $st = 1; } $topic = $_Get['id']; $query = mysql_query("SELECT * FROM students WHERE topic LIKE'%$st%'"); $result=mysql_query($query) or die (mysql_error()); if($row = mysql_fetch_array($result)) { echo "<tr><p>"; echo"<th><p>" . $row['topic'] ."</p></th>"; echo "<th><p>" . $row['gender'] . "</p></th>"; echo "<th><p>" . $row['fname'] . " " . $row['lname'] . "</p></th>"; echo "<th><p>" . $row['email'] . "</p></th>"; echo "<th><p>" . $row['assigned'] . "</p></th>"; echo "</tr>"; } else { mysql_error(); } echo "</table>"; ?> Do you know, if this is ok? echo"<th><a href='../student.php'=?id=".$row['topic']."'>".$row['topic']."</a></th>"; -
I want if checkbox's value already exist in db, it becomes unavailble and for this I have changed the code like below, but still, when I select whatever checkbox, becoming unavailble starts from the first checkbox, and after whatever checkbox's selection on the form sencond checkbox becomes unavailble and so on! $squery = mysql_query("SELECT * FROM is_availble WHERE datetime=$v_datetime "); echo"<div class='box'> <div class='boxbut'>"; if(mysql_fetch_array($squery)) { echo" Booked "; } else{ echo" <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time1'] ."</t>"; } echo"</div></div>"; //---------------------------------- choeckbox 2(bookable time 2)------------------------\\ echo"<div class='box'> <div class='boxbut'>"; if(mysql_fetch_array($squery)) { echo" Booked "; } else{ echo" <input type='radio' name='datetime' value='". $row['day1']." ".$row['time2']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time2'] ."</t>"; } echo"</div></div>";
-
Hi, I want to make a query and check if data exists already on my is_availble table on calendar db tomake it unavailble . I have 16 checkboxs. I have this code for first one. And I did it for second one alse, although data dosen't exist on db, but it makes it also unvailble! Here you can see my php code: PHP Code: <?php mysql_select_db("calendar", $con); $result2 = mysql_query("SELECT * FROM is_availble WHERE datetime=$v_datetime "); //---------------------------------- choeckbox 1(bookable time 1)------------------------\\ echo"<div class='box'> <div class='boxbut'>"; if($result2) { echo" Booked "; } else{ echo" <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time1'] ."</t>"; } echo"</div></div>"; //---------------------------------- choeckbox 2(bookable time 2)------------------------\\ echo"<div class='box'> <div class='boxbut'>"; if ($result2) { echo" Booked "; } else{ echo" <input type='radio' name='datetime' value='". $row['day1']." ".$row['time2']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time2'] ."</t>"; } echo"</div></div>"; Regards
-
Click name from one mysql table to show report on other page
FinnKim replied to FinnKim's topic in PHP Coding Help
I tried this, but it still does'nt work? <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("college", $con); $result = mysql_query("SELECT * FROM students"); $topic = $_Get['id']; echo "<table> <tr> <th>" $topic->['fname']"</th>" "<td>"$topic->['lname']"</td> <th>"$topic->['email']"</th> <td>"$topic->['gender']"</td>"; echo "</table>"; mysql_close($con); ?> I think there is something wrong with tis one also echo"<th><p><a href='student.php?id='".$row['topic']."'\'>".$row['topic']."</p></a></th>"; -
Hi, How can I get others informations on another page by clicking on one row's value I have this code, but it doesn't work: while($row = mysql_fetch_array($result)) { echo "<tr><p>"; echo "<th><p>" . $row['fname'] . " " . $row['lname'] . "</p></th>"; echo"<th><p><a href='student.php?id='".$row['topic']."'\'>".$row['topic']."</p></a></th>"; echo "</tr>"; } echo "</table>"; Student.php <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("college", $con); $result = mysql_query("SELECT * FROM students"); $topic = $_Get['topic']; while($row = mysql_fetch_array($result)) { echo "<tr><p>"; echo "<th><p>" . $row['month']." " .$row['datetime']."</p></th>"; echo"<th><p>". $row['topic'] ."</p></th>"; echo "<th><p>" . $row['gender'] . "</p></th>"; echo "<th><p>" . $row['fname'] . " " . $row['lname'] . "</p></th>"; echo "<th ><p>" . $row['id'] . "</p></th>"; echo "</tr>"; echo "</table>"; mysql_close($con); } ?>
-
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
I have this now, but still it doesn't work !! <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("calendar", $con); $result = mysql_query("SELECT * FROM datetime ORDER BY id DESC LIMIT 1"); while($row = mysql_fetch_array($result)) { echo"<div class='month' align='center'><input type='hidden' name='month' value='".$row['month']."' ><l>".$row['month']."</l></div>"; $v_datetime='datetime'; $con2=mysql_connect("localhost","root","") or die( "DB connection error:".mysql_error()); $dbcon=mysql_select_db("college",$con2) or die ( "Db Selection error:".mysql_error()); $squ=mysql_query("SELECT * FROM students "); if($v_datetime!= ($row['day1'] . " " . $row['time1'])) { echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."' " . ( $v_datetime == "$row[day1] $row[time1]" ? "checked" : "" ) . "> <d>". $row['day1'] ,"</d><br/><t>". $row['time1'] ."</t> </div> </div>"; } -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
It doesn't recognize 'datetime', because this information are from different table on mysql! So I have connection only to the table where this dates are from. Maybe if you take a look at my code, you get my purpose. Date and time for checkbox are from calendar database and datetime table.But the booked time will be stored on another database named College and studens table. So I have to datetime, one is a table and other one is just a row from student. I have only connection to table, where date and time are from, but for checking if checkbox is selected I have to connect form also to another table which is student on college db And I put this cod and got this errpr: Undefined index: datetime in C:\xampp\htdocs\form.php on line 98 and here is line 98: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("calendar", $con); $result = mysql_query("SELECT * FROM datetime ORDER BY id DESC LIMIT 1"); while($row = mysql_fetch_array($result)) { echo"<div class='month' align='center'><input type='hidden' name='month' value='".$row['month']."' ><l>".$row['month']."</l></div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."' " . ( $v_datetime == "$row[day1] $row[time1]" ? "checked" : "" ) . "> <d>". $row['day1'] ,"</d><br/><t>". $row['time1'] ."</t> </div> </div>"; I also put this one, it shows taht chechbox is disabled after being selected, but same error came up! if($_POST['datetime'] != ($row['day1'] . " " . $row['time1'])) { echo" <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."' disabled> <p>". $row['day1'] ,"</p><br/>". $row['time1'] ." // etc } else { echo" <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."'> <p>". $row['day1'] ,"</p><br/>". $row['time1'] ." } Maybe I have to make connection to student table on college db. But how to connect to tow databases ? -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
You are right, I've never before done any codings and any things with mysql, but now I have to do this booking system, which is so difficult for a beginner! -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
Yes, I want to store them in student table... where should put this? -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
I've tried do it with PHP since yesterday, but I don't know how to do it -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
Exactly -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
before submitting he/she will be able to change it. They are for bookin time, and I want that only selected one disappears and other onse still be availeble to select... -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
Can you please tell me how can I do it? Thank you, let's start if you can show me how to do it, and I might have other questions related to php coding. -
How to disappear a checkbos after it is checked
FinnKim replied to FinnKim's topic in Javascript Help
Yes those are radio buttons and from only form. I want pick only one and after that it becomes unselectable or unavailable or disappears from form. here bigger picture of form: Everything work good, exept for I don't know how to make this buttons unavailble after being selected? Here is also my php code: <?php $con = mysql_connect("localhost", "root", ""); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("college",$con); if (!$db_selected) { die ("No Database: " . mysql_error()); } //mysql_close($con); ?> <?php $v_counselor=$_POST["counselor"]; $v_fname=$_POST['fname']; $v_lname=$_POST['lname']; $v_studentId=$_POST['studentId']; $v_gender=$_POST["gender"]; $v_email=$_POST['email']; $v_tel=$_POST['tel']; $v_month=$_POST['month']; $v_topic=$_POST['topic']; $v_datetime=$_POST['datetime']; $v_detail=$_POST["detail"]; //$v_gender= serialize($_POST["gender"]); // check for null values if ($v_fname=="" or $v_lname==""or $v_email=="" or $v_tel=="") echo "All fields must be entered correctly"; // validate a phone number //elseif(!preg_match("#^[0-9]{8}$#",$v_tel)) //echo 'Please enter a valid phone number'; elseif(!ctype_alpha($v_fname)) echo "Please correct your FIRST NAME"; elseif(!ctype_alpha($v_lname)) echo "Please correct your LAST NAME"; elseif(ctype_alpha($v_tel)) echo "Phonenumber is not valid"; else{ //insert values into the table $query="insert into students(counselor,fname,lname,studentId,email,tel,gender,topic,month,datetime,detail) values('$v_counselor','$v_fname','$v_lname','$v_studentId','$v_email','$v_tel','$v_gender','$v_topic','$v_month','$v_datetime','$v_detail')"; mysql_query($query) or die(mysql_error()); echo "Registration was successful"; } ?> and here is the form's codes: <form name="form1" method="post" action="login/insert.php"> <table width="500" border="0" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC"> <tr> <td >Counselor</td> <th>:</th> <td> <select name="counselor"> <option></option> <option value="con1">Counselor A</option> <option value="con2">Counselor B</option> </select> </td> </tr> <tr> <td height="31">First name</td> <td>:</td> <td><input name="fname" type="text" id="fname" size="30"></td> </tr> <tr> <td>Last name</td> <th>:</th> <td><input name="lname" type="text" id="lname" size="30"></td> </tr> <tr> <td height="31">Student ID</td> <th>:</th> <td ><input name="studentId" type="text" id="studentId" size="30"></td> </tr> <tr> <td height="31">Gender</td> <th>:</th> <td> <select name="gender"> <option></option> <option value="Male">Male</option> <option value="Femle">Eemale</option> </tr> <tr> <td>Email</td> <th>:</th> <td><input name="email" type="text" id="email" size="30"></td> </tr> <tr> <td>Telephone</td> <td>:</td> <td><input name="tel" type="text" id="tel" size="30"></td> </tr> <tr> <td>Topic</td> <td>:</td> <td><input name="topic" type="text" id="topic" size="30"></td> </tr> <tr> <td>Date</td> <td>:</td> <td> <div class=' contentcalendar'> <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("calendar", $con); $result = mysql_query("SELECT * FROM datetime ORDER BY id DESC LIMIT 1"); while($row = mysql_fetch_array($result)) { echo"<div class='month' align='center'><input type='hidden' name='month' value='".$row['month']."' ><l>".$row['month']."</l></div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day1']." ".$row['time1']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time1'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day1']." ".$row['time2']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time2'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day1']." AT ".$row['time3']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time3'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day1']." ".$row['time4']."'> <d>". $row['day1'] ,"</d><br/><t>". $row['time4'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day2']." ".$row['time5']."'> <d>". $row['day2'] ,"</d><br/><t>". $row['time5'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day2']." ".$row['time6']."'> <d>". $row['day2'] ,"</d><br/><t>". $row['time6'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day2']." ".$row['time6']."'> <d>". $row['day2'] ,"</d><br/><t>". $row['time7'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day2']." ".$row['time8']."'> <d>". $row['day2'] ,"</d><br/><t>". $row['time8'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day3']." ".$row['time9']."'> <d>". $row['day3'] ,"</d><br/><t>". $row['time9'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day3']." ".$row['time10']."'> <d>". $row['day3'] ,"</d><br/><t>". $row['time10'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day3']." ".$row['time11']."'> <d>". $row['day3'] ,"</d><br/><t>". $row['time11'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day3']." ".$row['time12']."'> <d>". $row['day3'] ,"</d><br/><t>". $row['time12'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day4']." ".$row['time13']."'> <d>". $row['day4'] ,"</d><br/><t>". $row['time13'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day4']." ".$row['time14']."'> <d>". $row['day4'] ,"</d><br/><t>". $row['time14'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day4']." ".$row['time15']."'> <d>". $row['day4'] ,"</d><br/><t>". $row['time15'] ."</t> </div> </div>"; echo" <div class='box'> <div class='boxbut'> <input type='radio' name='datetime' value='". $row['day4']." ".$row['time16']."'> <d>". $row['day4'] ,"</d><br/><t>". $row['time16'] ."</t> </div> </div>"; } mysql_close($con); ?> </td> </tr> <tr> <tr> <td>More detail</td> <td>:</td> <td><textarea name="detail" cols="40" rows="4" value="detail"></textarea></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>