Re: [PHP-DB] Displaying groups from SELECT
On Fri, 2003-06-06 at 21:49, Becoming Digital wrote: I'm wearing the stupid hat today, so please pardon this. I know I must be overlooking something. I have a small catalogue with two tables (categories, products) from which I'm trying to display items. I'm trying to print the contents as below without using two queries, but I'm having a difficult time with it. cat1 prod1 prod2 cat2 prod1 prod2 etc. I think this came up fairly recently, but I cannot for the life of me figure out what search terms would answer this question. As you can see from the message subject, I don't even know how to refer to my problem. Thanks a lot for all your help. Edward Dudlik Becoming Digital www.becomingdigital.com Hi Ed, The magic word is DISTINCT :) $query=SELECT DISTINCT(category) AS cat_name FROM table_name; $result=mysql_query($query); print ul; while ($row=mysql_fetch_array($result)) { print li.($row[cat_name]).; $query1=SELECT productname FROM tablename WHERE category=.($row[cat_name]).; $result1=mysql_query($query1); while ($row1=mysql_fetch_array($result1)) { print li.($row1[productname]).; } print /ul; } print /ul; I hope this helps.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysqldump
Hi, Can you show the code? How r u running mysqldump in your php code? I think phpmyadmin has such facility as well, you may want to check their code and see how they did it ... Gurhan On Sat, 2003-05-31 at 06:51, buttoz wrote: hi, i want to backup mysql database. i use mysqldump command . when i use this command from server (win2000) , command promt its work fine. but when run this command (mysqldump) from php file, it creat backup file but with zero size. what can i do , help me? thanks, zuhear -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] formatting a timestamp
Rick, Please give more information about your problem. Are you trying to format a timestamp field in a MySQL table? If yes, you can do something like, SELECT DATE_FORMAT( columnname, '%m-%d-%y : %T-%i' ); Hope this helps... Gurhan On Sat, 2003-05-31 at 01:38, Rick Dahl wrote: I want to print out a timestamp of length 14. I want to have it formatted like: mm-dd-yy : hh-mm I have looked but all I can find is how to format a date and I don't want that. I want the time also. Rick Don't burn the day...away ~ DJM _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] query string
On Sun, 2003-06-01 at 22:26, Ian Fingold wrote: I'm trying to build a query string for one of my links.. for example... fant_stnd3.php?week=1team=fun%20team I need to be able to grab the values of 'week' and 'team' from an array, I can do that no problem, but when the code runs it cuts off the value if there is a space in the string. so instead of putting fun team in the query string it cuts it off and just puts.. fun So my question, is there a function or any way to prevent this from happening? thanks. Hi Ian, I have no idea what you are trying to do.. Well if you are getting those values from a URL, $week and $team variables in your php script should have the values in them.. In later versions of PHP, they will be _POST['week'] and _POST['team'] or _GET['week'] or _GET['team'] depending on which method is used.. You don't need to parse the URL and run them through an array.. :) Gurhan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] query string
On Sun, 2003-06-01 at 23:20, Ian Fingold wrote: Sorry I don't think I explained very well... heres my situation... I have a mysql database set up... I have a user table with 2 fields...team_name and fant_week. What I want to do is, depending on who is logged in, I want my link to change the value of 'team' to the logged in members team name, like wise for the week. For example.. if gorno is logged in and his team is called fun team the link will reflect his team and look like this... fant_stnd3.php?week=1team=fun team or if say... billbo is logged in and his team is called silly team the link will look like this fant_stnd3.php?week=1team=silly team but again, my problem is that it's cutting off the team value when there is a space in the string.. Ok.. I can't say anything, unless i know where and how it is being cut off.. From that scenario you said.. You should probably query the week name and team name from the database and then redirect the browser to the location.. so something like.. $query= select weekname, teamname from tablename where username=.($username). limit 1; $result=mysql_query($query); $row=mysql_fetch_array($result) header( Location: http://servername/fant_stnd3.php?;.($row[weekname]).team=.($row[teamname]).); Of course, you will need to replace servername, tablename and column names with appropriate values.. I hope this helps.. Gurhan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php