2wasted
Members-
Posts
41 -
Joined
-
Last visited
Never
Everything posted by 2wasted
-
[quote author=HuggieBear link=topic=110633.msg447653#msg447653 date=1160091253] OK, so like I said, do you want a current timestamp in the timestamp field? MySQL's [b]now()[/b] function will do that, see my code above. Huggie [/quote] cheers m8, works!!:-)
-
[quote author=HuggieBear link=topic=110633.msg447650#msg447650 date=1160090791] You need to convert the time in php to a format MySQL can recognise... $date = time(); as suggested will not give you a valid date format in MySQL. Do you just want a current timestamp, if so, use this: [code] <?php $query = "INSERT INTO onlineform (name, Cname, email, query, Pnumber, date) VALUES ('$name','$Cname','$email','$Query', '$Pnumber', now())"; ?> [/code] Regards Huggie [/quote] i think you have hit the nail on the head:-)it displays on the page but does not go in to the datamase(MYSQL)
-
[quote author=mgallforever link=topic=110633.msg447643#msg447643 date=1160090496] [code] $query = "INSERT INTO onlineform (name,Cname,email,query,Pnumber,date) VALUES ('$name','$Cname','$email','$Query', '$Pnumber', '$date')"; [/code] try that [/quote] still the same m8
-
[quote author=mgallforever link=topic=110633.msg447638#msg447638 date=1160090242] is id primary key w/ auto_increment? [/quote] yeah m8
-
id int name vachar Cname varchar email varchar query varchar Pnumber varchar date timestamp
-
Operator -> on a function that returns an object
2wasted replied to CoolMints's topic in PHP Coding Help
i tryed copying mgallforever code and still the same problem:-( -
my inserts are the same order as my database m8
-
this is what i have changed it to and it still does'nt work $Name=$_POST['name']; $Cname=$_POST['cname']; $Query=$_POST['Question']; $email=$_POST['email']; $Pnumber=$_POST['Pnumber']; $date = time(); $query = "INSERT INTO onlineform VALUES ('','$name','$Cname','$email','$Query', '$Pnumber', '$showdate')"; mysql_query($query); mysql_close(); echo "<h2>THank you for filling in this form, we will be in touch with you ASAP</h2>"; //echo $showdate;
-
i took out the echo $showdate; and it still never worked. i have tryed values of date×tamp in the mysql database structure, could i use another? Charlie
-
tryed that still 0000-00-00 00:00:00 thx Charlie
-
the show date on the page works..it just does'nt go into the DB. thx Charlie
-
lo all, i have a form that goes to a database, everthing works fine except the timestamp says 0000-00-00 00:00:00 .i have tryed changing the value in the mysql from timestamp to date but still is'nt working...i have displayed the date on my page np...here is the code ?PHP $Name=$_POST['name']; $Cname=$_POST['cname']; $Query=$_POST['Question']; $email=$_POST['email']; $Pnumber=$_POST['Pnumber']; $date = time(); $showdate = date("H:i:s d/m/Y"); mysql_select_db($database_csc, $csc); $query_Recordset1 = "SELECT * FROM onlineform"; $Recordset1 = mysql_query($query_Recordset1, $csc) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); $query_Recordset1 or die( "Unable to select database"); if($_POST['submit']) { $query = "INSERT INTO onlineform VALUES ('','$name','$Cname','$email','$Query', '$Pnumber', '$date')"; mysql_query($query); mysql_close(); echo "<h2>THank you for filling in this form, we will be in touch with you ASAP</h2>"; echo $showdate; } ?> Thanks for any help Charlie
-
here ya go:-) <input name="submit" type="Submit" onclick="MM_validateForm('email','','RisEmail');return document.MM_returnValue" value="Enter information" /> </label></td> <td> </td> <?PHP $Name=$_POST['name']; $Cname=$_POST['cname']; $Query=$_POST['Question']; $email=$_POST['email']; mysql_select_db($database_csc, $csc); $query_Recordset1 = "SELECT * FROM onlineform"; $Recordset1 = mysql_query($query_Recordset1, $csc) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); $query_Recordset1 or die( "Unable to select database"); $query = "INSERT INTO onlineform VALUES ('','$name','$Cname','$email','$Query')"; mysql_query($query); mysql_close(); ?>
-
lo all, i would like when my form is submitted it went 2 a thank you page, is this easy? thx Charlie
-
do i just put in ur bit of code instead of the stuff i done?? i tryed that and the error was on the page on load.. cheers Charlie
-
lo all, i have a simple form that posts fine 2 a mysql, but i want to check that there is something in the email textbox. So i did this... //validate email $var = $_POST['email']; $len = strlen($var); if($len >0) { $query = "INSERT INTO onlineform VALUES ('','$name','$Cname','$email','$Query')"; mysql_query($query); mysql_close(); } else { echo "Error:Please fill in your email address"; } ?> its does not work:-( thx for any help Charlie
-
thx m8 i'll give that a go:-) cya Charlie
-
can i query the mysql DB and add them for display?i have a guestbook i put a vote on so when i goto the table it says name,email,comment,then there are 2 rows for the vote 'yesvote' and 'novote' with a 1 where there vote is.could i echo out the total added together? cheers Charlie
-
[!--quoteo(post=383104:date=Jun 13 2006, 12:38 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 13 2006, 12:38 AM) [snapback]383104[/snapback][/div][div class=\'quotemain\'][!--quotec--] Do you mean you added a vote system to an existing database/code and you need an update query to get the votes in if a existing user votes. [/quote] soz for not explaining it properly,but yeah when they vote it goes into the DB but i would like the number to update:-) Thx Charlie
-
thx for the reply,what i would like is for the votes to be added up in the database.atm it looks like this in the DB, Name,email,comment(memo),yvote1,novote 0<<submit 1 Name,email,comment(memo),yvote1,novote 0<<submit 2 i would like.. Name,email,comment(memo),yvote2,novote 0<<submit 2 the yvote adding atm its just telling me what there vote was. yvote=yes nvote=no Thx Charlie
-
lo all, i have put a vote yes/no on a guestbook that submits with the other info name,email,comment.it works ok,but could i use "update" or something like that so it adds in the database? this is what i have done... [!--coloro:#006600--][span style=\"color:#006600\"][!--/coloro--] $name = $_POST["txt_name"]; $len = strlen($name); if ($len > 0) { $email = $_POST["txt_email"]; $comment = $_POST["txt_comment"]; $date = time(); $yvote = $_POST["ybutton"]; $nvote = $_POST["nbutton"]; if ($ybutton == true) { $yvote++; } else { $nvote++; } $query = "INSERT INTO guestbook (autoID, name, email, comment, date_auto, yvote, nvote) VALUES (NULL, '$name', '$email', '$comment', '$date', '$yvote', '$nvote')";[!--colorc--][/span][!--/colorc--] Thx for any help:-) Charlie
-
lo all, i dont know if i should install it.iam new to php doing it on DW and i thought this might help me...?anyone use it? Thx for any reply Charlie P.s i hope i put this in the right part of the forum.
-
[!--quoteo(post=382292:date=Jun 10 2006, 01:58 PM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 10 2006, 01:58 PM) [snapback]382292[/snapback][/div][div class=\'quotemain\'][!--quotec--] just choose do add a new row, considering you are using an INT field it will automatically set all fields to a negative result of 0 if u do not set the default to 1 (given there are already entries in the book) [/quote] thx all, Charlie