-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Survey.php Line 9: The query uses a parameter "?" (mysqli type, not PDO!) but no bindParam() statement. Does each operator have their own que_id? It looks like you need to pass the$row['id'] of the last call made in the form (hidden field) to operation.php (or use the $_SESSIONto store). operator.php When you update tracker table I think you need a "WHERE que_id = :queid"
-
A simple loop to take the elements from each array and build a third one?
-
Are you sure that is what you tried? The parameter is optional and, if present, should be one of MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH(default). Have you left the $result as a parameter?
-
sort teams array by ELO use array_slice to get 2 arrays shuffle them
-
If you have set of include files all in one folder then it is easier to add that folder to the included_files path, so it would become .;C:\php5\pear;D:\Hosting\myaccount\html\classes\Ps2 if that is where the files are. Then you only need include('filename'); without worrying about the path
-
Sending time to mysql as 6:43 p.m. (for example)
Barand replied to mystic7's topic in PHP Coding Help
With the exception of unix times (which are just integer seconds values) you cannot just subtract one date value from another, functions are required. Also conversion is not automatic. Again a function is required. Example queries below demonstrate this. CREATE TABLE datetest ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, numdate INT, realdate DATETIME, otherdate DATETIME ); INSERT INTO datetest (numdate, realdate, otherdate) VALUES ($now, CURDATE(), CURDATE()+INTERVAL 7 DAY); mysql> SELECT * FROM datetest; +----+------------+---------------------+---------------------+ | id | numdate | realdate | otherdate | +----+------------+---------------------+---------------------+ | 1 | 1381142283 | 2013-10-07 00:00:00 | 2013-10-14 00:00:00 | +----+------------+---------------------+---------------------+ mysql> SELECT numdate + INTERVAL 1 DAY as tomorrow FROM datetest; +----------+ | tomorrow | +----------+ | NULL | +----------+ mysql> SELECT FROM_UNIXTIME(numdate) + INTERVAL 1 DAY as tomorrow FROM datetest; +---------------------+ | tomorrow | +---------------------+ | 2013-10-08 11:38:03 | +---------------------+ mysql> SELECT otherdate - realdate as days FROM datetest; +----------------+ | days | +----------------+ | 7000000.000000 | +----------------+ mysql> SELECT DATEDIFF(otherdate, realdate) as days FROM datetest; +------+ | days | +------+ | 7 | +------+ -
Are you trying to find out what the next ID should be for a new record by finding the last one used then adding 1 to it?
-
why is update limiting me to 255 characters or less?
Barand replied to tommytx's topic in MySQL Help
SHOW CREATE TABLE wp_posts Execute that and see how the column is defined -
try $found_user = $result->fetch_array() fetch_xxxx() are mysqli_result object methods
-
You can specify the path when you include/require the file or you can add the folders which hold your include files to the included files path in PHP.ini (so that it knows where to search for them)
-
Sending time to mysql as 6:43 p.m. (for example)
Barand replied to mystic7's topic in PHP Coding Help
If you store the time as you originally proposed (6.43pm) then it is impossible to do comparisons or sorts on the data. 11.00pm will sort before 6.43pm and 7.00am will sort after it. As much use as a chocolate teapot IMHO. Storing times as hh:ii:ss is sortable and is the native format expected by the MySQL DBMS. This also means you can use the many date/time functions without prior conversion to the expected format. Using a unix timstamp (int(10) ) gets around the sortability problem but it still requires conversion before it can be used by the inbuilt functions. It also has the disadvantage that it is not human-readable. There will be times, when debugging for example, when you need to browse the records in a table and readability is a great help. So, my advice is use DATE, DATETIME, TIME or TIMESTAMP type fields (that's what they were invented for) and store your dates and/or times for functionality and not for prettiness - you can format them as you like on output, either in the SQL or in the PHP code.. -
$orderDate = new DateTime($_GET['date']);
-
why is update limiting me to 255 characters or less?
Barand replied to tommytx's topic in MySQL Help
varchar(255) has a limit of 255 chars, varchar(1000) has a limit of 1000 chars. How is post_content defined in your table, and what is your maximum size that you want to store? -
When this has executed $row will contain "false", not the returned data while($row = mysql_fetch_array($result)){ } If you only search for one row, don't use while(). But then, having put the returned row into $row, it doesn't appear again in the code
-
For the sake of those of us who aren't looking over your shoulder to see the results, or who are sadly lacking in the clairvoyance department, please define "not working"
-
Using cross database table calculations for onscreen total tally
Barand replied to gijs33's topic in PHP Coding Help
It would help if you let us know what your data looks like -
That may be because you always use the date I hard-coded as an example in $OrderDate = new DateTime('2014-01-31'); You need to get the date that you are passing to OrderDateForm.php in the query string
-
$orderDate = new DateTime('2014-01-31'); $today = new DateTime(); $days = $today->diff($orderDate, 0); if ($days->days > 90) { // option 1 } else { // option 2 }
-
If upload.php were in C:/php5/pear or in the current diectory then this would work require("upload.php"); Anywhere else (ie not in a folder specified in the include path) and you have to give the path to the file
-
Sending time to mysql as 6:43 p.m. (for example)
Barand replied to mystic7's topic in PHP Coding Help
I think he meant "on my entire street" rather than "planet" -
Alternative $stmt->execute(); $stmt->bind_result($id,$driver,$date,$time,$fname,$lname,$town); // assuming this is the order from SELECT * (which shouldn't be used) $while ($stmt->fetch()) { $date = date('d/m/y', strtotime($date)); // etc; }
-
BTW, what version of PHP are you using? 5.3 or later is required for get_result()
-
It's a mysqli_statement method http://www.php.net/manual/en/mysqli-stmt.get-result.php