
jtjtjthey
Members-
Posts
14 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
jtjtjthey's Achievements

Newbie (1/5)
0
Reputation
-
Hi thorpe thanks for reading my post. The connection.php code is shown in below: <?php // connect to database $server_name = "localhost"; $host_name = "root"; $password = ""; $database = "notification_sys"; $con = mysql_connect($server_name,$host_name,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); ?>
-
Hi guys! I'm having a new problem regarding posting an edited record in edit_form.php where the page contains mysql update functionality. For me, I seems to have no problem for mysql database connection in conncection.php dunno what to do with my coding as I have no idea regarding the problem shown as below: Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'localhost' (10048) in C:\Program Files\xampp\htdocs\notification_system\connection\connection.php on line 8 Could not connect: Can't connect to MySQL server on 'localhost' (10048) The Update form coding is shown in below: include("../connection/connection.php"); $error0=$_GET['error0']; $checkbox[$i]=$_POST['ID']; $error1=$_GET['error1']; $edit=$_POST['edit']; $cancel=$_POST['cancel']; if($cancel) { header("Location:admin_main_page.php"); } else { if($checkbox[$i]) { $sql0="SELECT * FROM directory WHERE id = '$checkbox[$i]'"; $result0=mysql_query($sql0,$con); $num=mysql_fetch_array($result0); ?> <? } else { header("Location:edit_form.php?error3=1"); } ?>
-
Yes! I've made it! Simply change the textarea "name=textarea1" to "name=comment" and done! Anyway thanks for the reply, Pyro. You made my day
-
Thanks Pyro for the reply. I've tried the code you have posted here but the output is still the same. After clicking the Save button the database doesnt update the data. Here's another php file code used to process update the data name comment_process.php: <? include("../connection/connection.php"); $mode=$_GET['mode']; if($mode=="update") { $id=$_POST['id']; $comment=$_POST['comment']; $sql0="UPDATE directory SET comment ='$comment' WHERE id='$id'"; mysql_query($sql0); //echo $sql0; header("Location:user.php"); } ?>
-
Hi all! I want to create a textarea form not only to display the user comment data from a database but also allows the commenter to edit their comment and save it into the database. I know how to display the data in textarea form but after clicking the save button the data has been erased in the database. Here is the coding for textarea form: <? $mode=$_GET['mode']; if($mode=='update') { include("../connection/connection.php"); $id=$_GET['id']; $sql0="SELECT * FROM directory WHERE id='$id'"; $search_result0=mysql_query($sql0); while($row=mysql_fetch_array($search_result0)) { $id=$row['id']; $name=$row['name']; $department=$row['department']; $position=$row['position']; // $extension=$row['extension']; $assignation_starts=$row['assignation_starts']; $assignation_ends=$row['assignation_ends']; $status=$row['status']; $comment=$row['comment']; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Comment Box</title> <style type="text/css"> <!-- .style1 {font-size: 12px} .style2 {font-size: 18px; } --> </style></head> <body> <table width="440" height="225" border="1"> <tr> <td width="430" align="center" valign="top"><p class="style1"> </p> <p align="center" class="style2">Comment </p> <form name="comment" method="post" action="comment_process.php?mode=update"> <p> <input type="hidden" name="id" id="id" value="<? echo $id; ?>"> </p> <p> <textarea name="textarea"><? echo $comment; ?></textarea> </p> <p align="center" class="style2"> <input type="submit" value="Save" onClick="window.close()"> <input type="submit" name="Submit2" value="Cancel"> </p></form></td> </tr> </table> </body> </html> Hope you guys can help.
-
Hi all! I've seen my codes and it looks ok for me but when i execute the code it shows Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\notification_system\user\user.php on line 117 Here is the code: <? // display the record when assignation ends < current date $time2=date('Y-m-d H:i:s'); $sql2="SELECT * FROM directory WHERE assignation_ends < $time2"; $result2=mysql_query($sql2); ?> <form name="user_main_page" method= "post" action= "save.php"> <table width="786" border="1" align="center"> while ($fetch_result=mysql_fetch_array($result2)) { $time2=date('Y-m-d H:i:s'); $assignation_ends=$fetch_result['assignation_ends']; if($result2) { <tr> <td align= "center" >[/color]<span class="style4"><? echo $fetch_result['id']; ?> </span> </td> <td align= "center" > <span class="style4"> <? echo $fetch_result['name']; ?> </span> </td> <td align="center"> <span class="style4"> <? echo $fetch_result['department']; ?> </span> </td> <td align= "center" > <span class="style4"> <? echo $fetch_result['position']; ?> </span> </td> <td align= "center" > <span class="style4"> <? echo $fetch_result['assignation_starts']; ?> </span> </td> <td align= "center" > <span class="style4"> <? echo $fetch_result['assignation_ends']; ?> </span> </td> <td align= "center" > <span class="style4"> <? echo $fetch_result['email']; ?> </span> </td> <td align= "center" > <span class="style4"> <? echo $fetch_result['status']; ?> </span> </td> <td align= "center" > <span class="style4"> <a href="<? echo "save.php?id=" .$fetch_result['id']. "&mode=update"?>">Comment</a> </span> </td> </tr> <? } } ?> </table></form> Does anybody have a idea on this?
-
at the bottom of the page. Ken Hi Ken: Thanks Ken for the reply but I dunno what to do right now if strptime() cannot be used. Now I'm facing a problem related to calculating the user input of timestamp. Lets say the timestamp of $assignation_starts = '23-7-2008 10:55:23' and $assignation_ends = '24-7-2008' how can I calculate the subtraction between this two values? without using strptime() how can I perform such calculation? To subtract this two values we need to separate '23-7-2008 10:55:23' so that it can be inserted into mktime() right? Thank you!
-
Oops! the error is like this: Fatal error: Call to undefined function strptime() in C:\Program Files\xampp\htdocs\strftime.php on line 5 Sorry for the trouble.
-
I'm kinda new to php programming and the coding below seems ok but it displays an error like this: http://localhost/strftime.php. <?php $format="%d/%m/%Y %H: %M: %S"; $strf=strftime($format); echo("$strf"); print_r(strptime($format,$strf)); ?> Is strptime() function cannot be used in window platform? But without using it how can I determine the subtraction between two timestamps for time validation input? I'm using xampp 1.5.5 version. Anybody please help!!