-
Posts
24,566 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
Take a look at simplexml library http://php.net/manual/en/book.simplexml.php Example $str = '<?xml version="1.0"?> <NowPlaying> <Current> <Station>KVXX</Station> <Artist>NOTHING BUT THIEVES</Artist> <Title>TRIP SWITCH</Title> <Album>NOTHING BUT THIEVES</Album> <Duration>03:00</Duration> <Category>Music</Category> <RecordLabel>RCA</RecordLabel> <Composer/> <CutNumber>11940</CutNumber> <StartTime>12/31/2015 11:29:22 AM</StartTime> <AlbumArt>http://radio1017x.co....jpg</AlbumArt> <Purchase>https://geo.itunes.a...t</Purchase> </Current> </NowPlaying>'; $xml = simplexml_load_string($str); echo "Title: {$xml->Current->Title}<br>"; echo "Artist: {$xml->Current->Artist}<br>"; echo "Duration: {$xml->Current->Duration}<br>";
-
I am guessing it is to do with another post of yours (http://forums.phpfreaks.com/topic/300074-paypal-payment-access-page-issue/?do=findComment&comment=1528883). If so it is not helpful for others if you keep spreading the problem over separate posts so that we have to search the forum for relevant information
-
Explode value from database column then count it
Barand replied to cobusbo's topic in PHP Coding Help
No it isn't, but it is you that isn't splitting it before storing it You can try SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(profile_info, ',', 4), ',', -1) as gender , COUNT(*) as total FROM mytable GROUP BY gender -
Explode value from database column then count it
Barand replied to cobusbo's topic in PHP Coding Help
Store that data correctly in five separate columns, instead of cramming it all into a single column in that ridiculous manner, and your problem goes away. -
You could also try using realpath()
-
You are right about joining twice to the attribute table, but you would use INNER JOINS if both attributes must match. Not sure you need the MATCH..AGAINST - if an attribute is "clock type" then the chances are it's a clock. If you only join once, as benanamen suggests, then you are back to finding someone who is both male and female at the same time, to quote the earlier example.
-
You may need to put $symbol inside backticks in case it contains a reserved word or special characters. ie ... `$symbol` ...
-
I've already done the edit.
-
You are mixing DELETE, UPDATE and SELECT syntaxes in the vain hope of getting something to work. Have you tried reading the manual? http://dev.mysql.com/doc/refman/5.6/en/update.html You'll find it should be like this UPDATE $symbol b INNER JOIN CleanedCalendar a ON a.BuyDate = b.Date SET a.CalDatePrice = b.Close
-
"password" is a keyword but is not reserved http://dev.mysql.com/doc/refman/5.5/en/keywords.html
-
All items have the same category and subcategory in that dump. What results are you expecting from the data you provided?
-
Strange that your sub-categories do not belong to any category in that diagram
-
You can only create the foreign key constraint if all records in chat have a matching uid in account table. You first need to fix those that do not match.
-
So you need to find at least one record where the specific_id has both the value 15 and the value 19 at the same time. Good hunting!
-
It appears that most of the tables in that query are just fluff. Most of those tables that are LEFT JOINed are not used. For example, your subquery "s" will contain all rows from specifics table (since the others are left joined) and the only condition you're using on that subquery is from the specifics table. Also you have no join condition for that subquery.
-
This should show you the logic you need to employee to process your data. (Note this is pseudocode, not runnable code) $jsondata = '[{"payee":"John Doe","amount":5.25},{"payee":"Joe Smith","children":[{"amount":10.25,"category":"Groceries"},{"amount":5.75,"category":"Dining out"}]}]'; $data = json_decode($jsondata,1); foreach ($data as $trans) { if (isset($trans['children'])) { insert into transaction (payee) VALUES '{$trans[payee]}' $parentid = last_insert_id(); foreach ($trans['children'] as $child) { insert into transaction (parent,amount,category) VALUES ($parentid, $child[amount], $child[category]) } } else { insert into transactions (payee,amount) VALUES ($trans[payee], trans[amount]) } }
-
I need some help. Trying to show label before showing pictures in a row.
Barand replied to vet911's topic in PHP Coding Help
If you are looping through the items when outputting the results, why are you using $row['cid'] etc instead of $item['cid']? -
What is this "XY problem" to which you keep alluding?
-
I need some help. Trying to show label before showing pictures in a row.
Barand replied to vet911's topic in PHP Coding Help
You need to build an array for each label. You just keep overwriting the single element each time. Try $custResArray[$row['label']][] = array('list_images'=>$row['list_images'], 'image_th'=>$row['image_th'], 'image'=>$row['image'], 'cid'=>$row['cid'], 'comment'=>$row['comment']); Note the added [] in $custResArray[$row['label']][] -
Sorry,
-
Not tested UPDATE Room_users INNER JOIN Users2 u ON u.mxitid = Room_users.mxitid INNER JOIN Rooms u ON u.mxitid = Rooms.mxitid SET Room_users.User = u.Username ,Rooms.creator = u.Username Duplicating the username across three tables is destroying your database normalization. You should store it in one place only (Users) and retrieve it with a join when needed.
-
No, it is a keyword but not reserved. Example mysql> CREATE TABLE nametest (name varchar(30)); Query OK, 0 rows affected (0.27 sec) mysql> INSERT INTO nametest VALUES ('Peter'),('Paul'),('Mary'); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> SELECT name FROM nametest; +-------+ | name | +-------+ | Peter | | Paul | | Mary | +-------+ 3 rows in set (0.00 sec)
-
Merry Christmas!
-
... WHERE exrdate BETWEEN LAST_DAY(CURDATE()) + INTERVAL 1 DAY - INTERVAL 3 MONTH AND LAST_DAY(CURDATE())
-
That query will get you those records with dates between "2015-09-24 16:51:43" and "2015-12-24 16:51:43". Is that what you want?