-
Posts
24,605 -
Joined
-
Last visited
-
Days Won
831
Everything posted by Barand
-
You could try finding out what the text actually contains (seems like there are no spaces) $text = wpjm_the_job_description(); $short = substr($text,0,25); // get first 25 characters $chrs = str_split($short); // split into individual chars $hex = array_map('bin2hex', $chrs); // get the hex values of those chars echo '<pre>', print_r($chrs, 1), '</pre>'; // output to compare echo '<pre>', print_r($hex, 1), '</pre>'; // output to compare What is the output?
-
Try $text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna. Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci. Aenean nec lorem."; $words = array_slice(explode(' ', $text), 0, 15); echo join(' ', $words) . '…';
-
Small business needs help creating PHP interview questions
Barand replied to aadamsx's topic in PHP Coding Help
Then why not use one of those- 7 replies
-
- application
- full-stack
-
(and 1 more)
Tagged with:
-
My guess is that 'B' is the char in position 6 of a string. But without more code and data that remains a guess.
-
Is that your entry for this month's "Most Ridiculous Solution" competition? I have recreated the table from your CREATE TABLE code (except I changed the primary key to a column that actually exists in the table) and tried your function. Negative "stack" values were written without problem. I applaud your attempt at debugging to see which of the two queries is executed but it fails miserably as HERE1 is echoed regardless of which path the logic takes. What is the condition supposed to be (in business terms, forget you're a programmer) for the first query to execute instead of the second? It currently always executes unless there is negative stack value to begin with. When I ran it with a stack value of 5 and QUA value of (leaving 4 ) the "DOD" still said "Item is not there, Maybe in ..."
-
$LNTerm = 60; $LNUnit = 'D'; $dt = new DateTime('2017-02-01'); $di = new DateInterval("P$LNTerm$LNUnit"); $dt->add($di); echo $dt->format('Y-m-d'); //--> 2017-04-02 $days_until = $dt->diff(new DateTime())->days; echo "<br>$days_until"; //--> 19
-
$num_recs = 5; for ($count=1; $count<=$num_recs; $count++) { echo "$count of $num_recs<br>"; } But I could give you a more relevant example if you could get around to posting the code you have at present.
-
Use a counter and increment it
-
Good luck.
-
What is the table structure? SHOW CREATE TABLE items;
-
- 30 replies
-
- php calendar
- mysql
-
(and 2 more)
Tagged with:
-
Can you be more specific? "uuid" crops up in two different levels in that data and there are no objects.
-
Probably not what you want but there may be something in here that might help $dt = new DateTime('2017-01-01'); $dt->modify('next monday'); $di7 = new DateInterval('P7D'); $dp = new DatePeriod($dt, $di7, 52); echo "<pre>\nWeek Monday Friday \n"; $i=0; foreach ($dp as $d) { printf("%3d %-12s%-12s\n", ++$i, $d->format('Y-m-d'), $d->modify('+4 days')->format('Y-m-d')); }
-
Double-posting topics violates forum rules. https://forums.phpfreaks.com/topic/303410-forcing-a-div-to-the-bottom-of-another-div/?do=findComment&comment=1543994
-
Something like SELECT the, columns, you, want FROM members LEFT JOIN checkin USING (callsign)
-
How to make progress bar focus on most recent value set?
Barand replied to mal14's topic in PHP Coding Help
I think we need to see your current data. -
How to make progress bar focus on most recent value set?
Barand replied to mal14's topic in PHP Coding Help
Specify the goal instead of the user -
Need some help - pick random lines from text files & email
Barand replied to StudioWorks's topic in PHP Coding Help
Two functions you might find useful: file() array_rand() or shuffle() -
Quite probably. You messed up the syntax.
-
Don't use "SELECT * ", specify the columns you need. Then apply aliases to differentiate between those with the same name. Use explicit join syntax. Example QUANTITY is used on stock_stockin_product and stock_product tables SELECT sip.quantity as quantity_sip , sp.quantity as quantity_sp , whatever_else FROM stock_stockin si INNER JOIN stock_stockin_product sip ON si.id=sip.stockin_id INNER JOIN stock_product sp ON sp.id=sip.product_id WHERE stock_date>='1488366000' AND stock_date<='1488538800' AND stock_product.brand_id='11' AND stock_product.category_id='27' AND stock_product.model LIKE '%iphone 6%' AND stock_stockin.branch LIKE '%henderson%' GROUP BY si.id
-
the server responded with a status of 406 (Not Acceptable)
Barand replied to oracle765's topic in PHP Coding Help
Use CODE tags. -
No. One query to get the stored password hash for the given username. Then verify the given password against that.
-
Your join syntax is wrong. SELECT cat_name FROM domeniu_activitate d INNER JOIN user_pers_juridica u ON d.cat_id = u.cat_id WHERE product_id = '$id' It is also better to use prepared queries. You should not be putting data ($id) directly into your queries.
-
Current Status and Previous States where to start
Barand replied to ScoobyDont's topic in PHP Coding Help
CREATE TABLE `status_log` ( `status_log_id` int(11) NOT NULL AUTO_INCREMENT, `item_id` int(11) DEFAULT NULL COMMENT 'id of item owning the status', `status` tinyint(4) DEFAULT NULL, `changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`status_log_id`) ) ; When the status changes, add a new record mysql> select * from status_log; +---------------+---------+--------+---------------------+ | status_log_id | item_id | status | changed | +---------------+---------+--------+---------------------+ | 1 | 1 | 1 | 2017-02-28 15:03:00 | +---------------+---------+--------+---------------------+ -- add new record mysql> INSERT INTO status_log (item_id, status) VALUES (1,2); -- now you have mysql> select * from status_log; +---------------+---------+--------+---------------------+ | status_log_id | item_id | status | changed | +---------------+---------+--------+---------------------+ | 1 | 1 | 1 | 2017-02-28 15:03:00 | | 2 | 1 | 2 | 2017-03-05 21:08:43 | +---------------+---------+--------+---------------------+