-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
Insert Date from PHP form into MySQL date column
Muddy_Funster replied to mtnmchgrl's topic in PHP Coding Help
Wish I had a penny for every time I'd done that :'( sorry about that! should have been $date = new DateTime($_POST['gameDate']); And just for a rull of thumb - you really shouldn't declare an entry for 'NULL' in general use. -
php with mysql query with a CSV type of dataset
Muddy_Funster replied to monkeytooth's topic in PHP Coding Help
So where is the information currently sitting that you are going to filter on (this scratched, dented etc.) is it in a descriptoin field or simmilar? If you can describe what you currently have to refference it would help a lot. Also, going back to your Insert worry - it will only be a problem if the query has been structured as "INSERT INTO tablename VALUES (...)" if the colum names have been explicitly used then there won't be a problem eg "INSERT INTO tablename (col1, col2, col3....) VALUES (...)". -
Insert Date from PHP form into MySQL date column
Muddy_Funster replied to mtnmchgrl's topic in PHP Coding Help
give this a shot : $date = new DateTime($_POST['gameDate'); $query="insert into `tournaments` ('tourneyName', 'gameDate') values('".$_POST['tourneyName']."', ".$date.")"; -
I just looked at that again and realised : time is not decimal. The comparison will need some manipulation or posting at say 11:59 will show a time out after only 1 minute as rather than going to 11:60 it goes to 12:00. There will be a better arithmetic function to use, but as for the SQL you should be set.
-
how about having a look at this line: <script type="text/javascript" src="<?=bloginfo('url')?>/wp-content/themes/JobPress/jquery.js"></script> I'm concerned about the ?'s here, but I'm not one for JS, it may be nothing :-\ And in all fairness the code tags for take seconds to impliment and make it much easier for everone to get to grips with the code (and it's in the forum rules too)
-
Do you have the code that you inserted? and where in that ling list did you put it? I am having no luck getting arround the missing functions from the include file.
-
move $waardebox=$_POST['richtingbox']; $querybox = "SELECT RichtingNr FROM Studierichtingen WHERE naamRichting='$waardebox'"; $queryboxresult=mysql_query($querybox,$database); $boxnr=mysql_fetch_row($queryboxresult); $boxnummer=$boxnr[0]; to just under if ( !$iserror ) { and see how you get on.
-
Try and comment out the header, and remove the white space from the include string, also, can you post the chartTest2 code se we can see if it's over riding the SQL result set?
-
php with mysql query with a CSV type of dataset
Muddy_Funster replied to monkeytooth's topic in PHP Coding Help
so you already have columns like || cracked | worn | water_damage | **unused** || and you want the unused column to store what eactly? a concatenated value from the previous columns or are you thinking along the lines $qry = "UPDATE tablename SET **unused** = ".$var1.":".$var2.":".$var3.... I can't see the logic in storing a search filter in the actual table it's self, much easier to just script it in my opinion. -
As requested here is the code I came up with for you. As usual it's not tested so you may want to change the DELETE FROM to a SELECT and echo"" for testing (and backup your DB of course). I have chosen to get the the current time from the DB server, since you don't always get the web server being the DB server as well, and there could be clock sync issues. here goes: <?php SESSION_START() include 'connectionFile.php'; //change as appropriate $now = mysql_fetch_array(mysql_query("SELECT CURRENT_TIMESTAMP()")) //get time from database or die('UNABLE TO RETRIEVE CURRENT TIME FROM DATABASE -- '.mysql_error()); //show error on fail $curTime = ereg_replace('[^0-9]+', '',$now['0']); //get current time as number $qryA = "SELECT idField, startTime FROM tableName"; //select files from database table for comparison $resA = mysql_query($qryA) or die ('UNABLE TO RETRIEVE DATASET -- '.mysql_error()); //run query and show error on fail WHILE ($rowA = mysql_fetch_assoc($resA)){ //open loop to proccess each record in table $bTime = ereg_replace('[^0-9]+', '',$rowA['startTime']); //get time from table as numbers if (($curTime - $bTime) > 1800){ //set time cut off for deletion in seconds $qryD = "DELETE FROM tablename WHERE idField = ".$rowA['idfield']; //delete outdated entrys mysql_query($qryD) or die ('ERROR DELETING EXPIRED RECORDS -- '.mysql_error()) // execute deletion and display error on failure } //close if } //close while ?>
-
php with mysql query with a CSV type of dataset
Muddy_Funster replied to monkeytooth's topic in PHP Coding Help
Could you break down exactly what it is you are trying to do a bit more? I'm getting mixed up and can't figure if your trying to pull data out of the database or add it in. As long as all your current INSERTS and UPDATES use explicit column names then you shouldn't have an issue adding columns to the table. -
Did anything return from the or die(mysql_error()) ? Have you changed any code since it was working?
-
In your insert statement put a space after the comma before Finame also change $add_members = mysql_query($insert); to mysql_query($insert) or die (mysql_error()); to get error reporting from your SQL.
-
Beginner creating a user registration page
Muddy_Funster replied to bobby317's topic in PHP Coding Help
oops, forgot to post the edited code [duh] <!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>Register</title> <style type="text/css"> body { text-align: center; } form { text-align: left; } label { width: 7em; float: left; text-align: right; margin-right: 0.5em; } .submit input { margin-left: 6.5em; } .error { color: #F00; } </style> </head> <body> <?php //Starts the code when form is submitted: if( !isset($_GET['submit'])){ //changed logic about to check registration negativly include_once "form.php"; } else { //flag variable to track success: $okay = TRUE; //Validate the email address: if (empty($_POST['email1'])) { print '<p class="error">Please enter your email.</p>'; $okay = FALSE; include_once "form.php"; } //Validate the password: elseif (empty($_POST['pass1'])) { print '<p class="error">Please enter your password.</p>'; $okay = FALSE; include_once "form.php"; } //validate the emails for equality: elseif ($_POST['email1'] != $_POST['email2']) { print '<p class="error">Your emails do not match.</p>'; $okay = FALSE; include_once "form.php"; } //Validate the passwords for equality: elseif ($_POST['pass1'] != $_POST['pass2']) { print '<p class="error">Your passwords do not match.</p>'; $okay = FALSE; include_once "form.php"; } //If there were no errors, print a success message: elseif ($okay == TRUE) { print'<p>You have been successfully registered.</p>'; } } ?> </body> </html> -
Beginner creating a user registration page
Muddy_Funster replied to bobby317's topic in PHP Coding Help
ok, here we go: fistly have removed the form from the page and put it in form.php (doesnt need to be .php, you can make it .htm or .inc or whatever) <form name="register" action="register.php?submit=\'true\'" method="post"> <p> <label for="email1">Email Adress:</label> <input type="text" name="email1" maxlength="30" /> </p> <p> <label for="email2">Email Adress Again:</label> <input type="text" name="email2" maxlength="30" /> </p> <p> <label for"password">Password:</label> <input type="password" name="pass1" /> </p> <p> <label for"password2">Password Again:</label> <input type="password" name="pass2" /> </p> <p class="submit"> <input type="submit" value="Register" /> <input type="hidden" name="submit" value="true" /> </p> </form>' then changed your logic to do a negative check on the isset (and pulled your hidden field, but you can put that back in if you preffer). then set your nested if's as ifelse to lighten the run through (it will now error out per field rather than all at once, but again you can put this back to if's if you preffer) the only thing that changed the actual behaviour was changeing it from if(isset()) to if(!isset()). -
in your $pageURL building you have this little problem : if ($_SERVER["SERVER_PORT"] != "80") {http://www.prosperjobs.net/wp-admin/theme-editor.php?file=/themes/JobPress/single.php&theme=JobPress+Wordpress+Theme&dir=theme that URL isn't supposed to be there I don't think, and if it is you need to quote and assigne it. still working through it, hitting lotts of function errors cause of not having the included file, but I'll get there.
-
Is this a local server? If so you need to turn error reporting on, if not you need to shoot the admin and find a more practical development envyronment...I'll look through the code but it'll take a while...
-
OK, any chance you can post the errors? And PLEASE post your php between the php tags.
-
Can you post up your table structure? We can help clean up the SQL when we know what's what.
-
they be empty...
-
Display all images from folder outside web root
Muddy_Funster replied to micmola's topic in PHP Coding Help
Ken, if I ever need to get symantics checked on anything I do - You da man! -
post up the index page that came with it and I'll have a look see.
-
your variables arn't assigned untill the bottom of the page (line 136 when I reformatd and removed blank line spacers) your error checking is directly against the input array, not on the values in the variables. Try moving the variable population code up the page to just beneth the if(!$iserror) - before you use them in the SQL statement.
-
Help - My $_SESSION vars are being lost after a HEADER.
Muddy_Funster replied to cjp_24's topic in PHP Coding Help
assuming you have SESSION_START() at the top of every page already, just use includes rather than headers ie - include_once "presearch.php" at the top of generatesearch.php. -
Display all images from folder outside web root
Muddy_Funster replied to micmola's topic in PHP Coding Help
couple of things to try. [*]Stop selecting * from your databases (you get this one for free - especialy when you use it on two pages right after each other [*]mysql_fetch_array[''] returns a numeric header for each row. Use mysql_fetch_assoc[''] to use associated table filed headers.