
rajaahsan
Members-
Posts
24 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
rajaahsan's Achievements

Member (2/5)
0
Reputation
-
ya it is sure i have auto incremented checked in database and my id is primary id key but i dont understand what the problem is why my database jumble id's up and down...
-
no boss, i have already auto increment checked in database on my primary key which is "id" but problem remains the same why is it happening as my data successfully been saved but only sequence problem distirb me please help guyz..
-
HY every one , i am having problem with my phpmysql database , i save different values form form but when i save multi values at a time the values saved in database successfully but the sequence of my praimary id changes , e.g id firstname lastname dob 1 abc abc abc 3 abc abc abc 2 abc abc abc 4 abc abc abc 5 abc abc abc so own but as you see 2 must be before the value 3 so any one tell me what is the problem in database ?
-
hy every one i have two files one is index.php and second insert.php as follow, index.php <html> <body> <form action="insert.php" method="post"> Time <input type="text" name="time" /> <input type="submit" /> </form> <?php $ctime = date('h:i:s A'); echo "Current time is : " . $ctime ; echo "<br>"; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("time", $con); $result = mysql_query("SELECT * FROM time"); while($row = mysql_fetch_array($result)) { echo date('h:i:s A', strtotime($row['time'])); echo "<br />"; } mysql_close($con); ?> </body> </html> here is my insert.php file code, <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("time", $con); $sql="INSERT INTO time (time ) VALUES ('$_POST[time]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; echo "<br>"; echo "<a href='index.php'>Home</a>"; mysql_close($con) ?> this code work fine but the form which submit the value of time in database whos code is in index.php file above, i have to enter time in the form text field like this 17:00 and it save the value in database but, i want to enter time in the form text field like this 05:00 PM which automatically save the value in database as 17:00 what should i do with the code help me please thanks
-
i mean to say that , code is working f9 know but , i have to putt the time value in this format in text box 17:00 i want to put 05:00 PM in text box which automatically save my time value in sql like 17:00
-
thanks it worked but now tell me that i have to put the time like this 17:00 i want to enter time in like this 5:00 PM format as i view 5:00 PM
-
Hy every one i have this two file code one is index.php and second is insert.php here is index.php code , <html> <body> <form action="insert.php" method="post"> Time <input type="text" name="time" /> <input type="submit" /> </form> <?php $ctime = date('h:i:s A'); echo "Current time is : " . $ctime ; echo "<br>"; $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("time", $con); $result = mysql_query("SELECT * FROM time"); while($row = mysql_fetch_array($result)) { echo $row['time']; echo "<br />"; } mysql_close($con); ?> </body> </html> here is insert.php code , <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("time", $con); $sql="INSERT INTO time (time ) VALUES ('$_POST[time]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; echo "<br>"; echo "<a href='index.php'>Home</a>"; mysql_close($con) ?> This code work fine but when it returns me the ouput in this format Time (inputbox) submit Current time is : 07:25:53 PM 10:55:00 10:55:00 i saved one value with 10:55 AM in my field box and one value with 10:55 PM but no effect what is the problem i want to display the output as like this, 10:55:00 AM 10:55:00 PM Hope you understand what i want... thanks
-
Your are right that i am not an english speaker but i can understand very well but the php is little newer to me so thats why it creat problem to explain any body well let me explain my code , this i my insert.php file which takes simple values from user using form and form action is this php code....hope understand. <?php include ("connect.php"); //connect database sucessfully $selecteddate = $_POST['sdate']; // date variable set which comes from my form $sql1 = "select date from game1"; $query1 = mysql_query($sql1) or die(mysql_error()); while($row = mysql_fetch_assoc($query1)) // this is while code which i think may work well for me but unfortunately not { $rowdate = $row['date']; if($selecteddate == $rowdate) // compare values previously saved date in database with my new one { echo "Date already Exists"; } else { echo "Weldone there is no date"; } } ?> the problem is that which is minor , this code also work fine it displays my date values from database which i have already saved before ,this code displays again and again because of while loop ,what should i do with this code so that is just only search all the value from date field and display once not again and again...hope now you got my point....
-
gizmola soory i didnt understand please guide me i have writen code also :'( thank you
-
i have tryed this code before, while($row = mysql_fetch_assoc($query1)) { $rowdate = $row['date']; if($selecteddate == $rowdate) { echo "Date already Exists"; } else { // form insertion data code here which i have and working fine } } but when i do this my else part repeats hole and then show all the else values again and again...only on one value echo "Date already Exists" that matches my date value else repets its code again again for all values and displays again and again.
-
i have php code, <?php include ("connect.php"); $selecteddate = $_POST['sdate']; $sql1 = "select date from game1"; $query1 = mysql_query($sql1) or die(mysql_error()); while($row = mysql_fetch_assoc($query1)) { $rowdate = $row['date']; // problem here i this while loop only compare my latest last value in database. i want a code here which search all the data in "date" field. } if($selecteddate == $rowdate) { echo "Date already Exists"; } else { // form insertion data code here which i have and working fine } SHINSTAR is online now Add to SHINSTAR's Reputation Report Post Edit/Delete Message
-
thanks for your sweet help but now when i use, while { it repeats the same code again and again here....! i am confused here because i need to search only from database that the date selected by user exist already or not if it exist already then data must not be save in database.. }
-
i have enters some data using form which submit data in sql table1 like this, Fields name in table -->> id First name Lastname Date data saved -->> 1 user 1 2011-05-10 2 user 2 2011-05-11 3 user 3 2011-05-12 now i dont want to duplicate date in database let say while inserting data using form, Firstname : ____________ Lasename : ____________ Date : ____________ (i dont want this date to b save if the date alredy exist in database, it should prompt user "Date already exist and to edit click here (this will be the link to that date which is already exist so that we can edit) " ) SAVE i user files , form.php , insert.php(so insert values in database) , so tell me what function should i use to solve my problem....
-
thank you vvvvvvvvvvv much 4end....
-
FIrst of all thank for replying..... my variables are as under $cdate = date("d-m-y"); // current server date $ctime = date("h:i:s"); // current server time i have upload sql database table as well in pic you can understand then.... [attachment deleted by admin]