Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Sun Zaza

Pages: 1 ... 6 7 8 9 [10] 11 12 13 14 ... 34
136
Hi V@no,

I like the mod. Already installed and works fine so far.

I have a question (suggestion) for you:

Guess you have more than 50 categories on your gallery. What is the easier way to know which categories are hidden/password protected and which not? To look for 1 by one it will cost a lot time (Time is money :wink:).

I suggest the following:

When you click on category edit on the ACP, you get a list of the categories. After the name of cat you can put something like:

My fotos  (ID: 2)    [Open]  [delete]  [Add subcategory]   (Hidden & password protected)
My videos (ID: 3)    [Open]  [delete]  [Add subcategory]   (Hidden)
My friends (ID: 4)    [Open]  [delete]  [Add subcategory]   (password protected)

What do you think about that?

137
Thanks V@no. It'is working.


Cheers,
Cruxy

138
Hello,

How can I change the code to make sure that Admin can vote the same image many times as he want?

Thank you in advance,
Cruxy

139
Chit Chat / Re: Query for returning info from 2 columns
« on: January 23, 2009, 03:55:17 PM »
Hi V@no,

Unfortunately I could not create a new topic on MySql.com. I believe they have a problem with the scripts of the forum.

Never mind! I hope you have time to give me the solution of this issue.


Thank you in advance,

140
Chit Chat / Re: Query for returning info from 2 columns
« on: January 22, 2009, 10:04:53 PM »
No problem V@no. I am free tomorrow. I will be waiting for your answer.


Quote
but I bet you would get more chanses get the answer if you ask it at the approriate site - mysql.com

I will do it right now.

NB: Of course I will let you know if I solve it before you start looking for it.

141
Chit Chat / Re: Query for returning info from 2 columns
« on: January 22, 2009, 09:48:11 PM »
Thanks V@no for your reply. I tried your query many times, but without success.

I will give you a working code, so maybe you get a better idea about what I am looking for.

To return the HOME information (uitslagen_thuis_streak = info home) of that team ($teams_id = Barcelona) I used this query:



Code: [Select]
$sql = "SELECT u.uitslagen_thuis_streak, u.uitslagen_uit_streak, u.uitslagen_thuis, u.uitslagen_uit, u.uitslagen_id, tt.teams_id, tu.teams_id
        FROM ".UITSLAGEN_TABLE." u
       
        LEFT JOIN ".TEAMS_TABLE." tt ON (u.uitslagen_thuis = tt.teams_name)
        LEFT JOIN ".TEAMS_TABLE." tu ON (u.uitslagen_uit = tu.teams_name) 
     
        WHERE $teams_id = tt.teams_id
        ORDER BY u.uitslagen_datum ASC       
        ";       
        $result = $site_db->query($sql);
        $num_rows = $site_db->get_numrows($result);       

        while ($uitslagen_row = $site_db->fetch_array($result)) {       
       
        $streak .= "".$uitslagen_row['uitslagen_thuis_streak']."<BR/>";           
        }
        $site_template->register_vars("streak", $streak);

The result is:

W
V



To return the AWAY information (uitslagen_uit_streak = Info away) of that team ($teams_id = Barcelona) I used this query:


Code: [Select]
$sql = "SELECT u.uitslagen_thuis_streak, u.uitslagen_uit_streak, u.uitslagen_thuis, u.uitslagen_uit, u.uitslagen_id, tt.teams_id, tu.teams_id
        FROM ".UITSLAGEN_TABLE." u
       
        LEFT JOIN ".TEAMS_TABLE." tt ON (u.uitslagen_thuis = tt.teams_name)
        LEFT JOIN ".TEAMS_TABLE." tu ON (u.uitslagen_uit = tu.teams_name) 
     
        WHERE $teams_id = tu.teams_id
        ORDER BY u.uitslagen_datum ASC       
        ";       
        $result = $site_db->query($sql);
        $num_rows = $site_db->get_numrows($result);       

        while ($uitslagen_row = $site_db->fetch_array($result)) {       
       
        $streak .= "".$uitslagen_row['uitslagen_uit_streak']."<BR/>";           
        }
        $site_template->register_vars("streak", $streak);

The result is:
G

Now I want to combine those two query in one query.

I need to return the result like this:

W
G
V



I already solved it with PHP, but I need the query table to use in other query (FROM (SQL 2) A ....)
Check the PHP solution:

Code: [Select]
$sql = "SELECT u.uitslagen_thuis_streak, u.uitslagen_uit_streak, u.uitslagen_thuis, u.uitslagen_uit, u.uitslagen_id, u.uitslagen_datum, uitslagen_speelronde,  tt.teams_id, tu.teams_id, tt.teams_name AS teamsTHUIS, tu.teams_name AS teamsUIT
        FROM ".UITSLAGEN_TABLE." u

LEFT JOIN ".TEAMS_TABLE." tt ON (u.uitslagen_thuis = tt.teams_name)
LEFT JOIN ".TEAMS_TABLE." tu ON (u.uitslagen_uit = tu.teams_name)

WHERE $teams_id = tt.teams_id OR $teams_id = tu.teams_id
ORDER BY u.uitslagen_datum ASC
";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

while ($uitslagen_row = $site_db->fetch_array($result)) {


if ($uitslagen_row['uitslagen_thuis'] != $teamsNAME AND $uitslagen_row['uitslagen_thuis_streak'] == 'W')
{
$streak_teams = 'V';
}
elseif ($uitslagen_row['uitslagen_thuis'] != $ teamsNAME AND $uitslagen_row['uitslagen_thuis_streak'] == 'V')
{
$streak_teams = 'W';
}
else
{
$streak_teams = $uitslagen_row['uitslagen_thuis_streak'];
}

$streak .= "".$uitslagen_row['uitslagen_speelronde']." (".date("d-m-Y", $uitslagen_row['uitslagen_datum']).") ".$streak_teams." ".$uitslagen_row['uitslagen_thuis']."<BR/>";
}
$site_template->register_vars("streak", $streak);


NB: I already contacted PHPFREAKS.COM and also the biggest PHP forum in the Netherlands, but nobody could code this query yet.

Am I requesting something impossible from MySql?




142
Chit Chat / Query for returning info from 2 columns
« on: January 22, 2009, 06:12:22 PM »
Hi,

I have some problem with a query.

I added a new table to the 4 images database (TEAMS_TABLE).

I have this information in my table:

Team home    Team away   Info home    Info away
Barcelona       Valencia               W               V
Sevilla           Barcelona              G                G
Barcelona       Madrid                  V                W


I need a query to return the info home & away of the club Barcelona.

Something like that:

Barcelona: W, G, V

I could get only the info home of Barcelona and also only the info away.

But the problem is how can I get both info home & away of the club Barcelona in one table or line.

I appreciate any help.

Many thanks in advance,
Cruxy

143
No. It did not. The home & the out teams had the same teams ID "1".

144
Hi V@no,

Thanks to your help I solved it with this query:

Code: [Select]
$sql = "SELECT u.uitslagen_id, u.uitslagen_thuis, u.uitslagen_uit, u.uitslagen_doelpunten_thuis, u.uitslagen_doelpunten_uit, u.uitslagen_done, t.teams_id, t.teams_name, tu.teams_name, tu.teams_id AS teams_id2
 
        FROM ".UITSLAGEN_TABLE." u
LEFT JOIN ".TEAMS_TABLE." t ON (u.uitslagen_thuis = t.teams_name)
LEFT JOIN ".TEAMS_TABLE." tu ON (u.uitslagen_uit = tu.teams_name)
ORDER BY u.uitslagen_id ASC";

Thank you very much V@no.
PS: My thanks goes also to KurtW.



145
Perfect V@no :D I don't believe my eyes.

We still have a small problem.

The uitslagen_uit get the wrong teams_id. I believe we have to change something in the querey.

I tried this, but without success:

Code: [Select]
        FROM ".TEAMS_TABLE." t
LEFT JOIN ".UITSLAGEN_TABLE." u ON (u.uitslagen_thuis = t.teams_name OR u.uitslagen_uit = t.teams_name)

Is that correct?

146
You are right V@no. I just tested on a new php file and I get the good results. Very strange.

To be sure I give you here the code of the php page uitslagen.php. Maybe you can see what I did wrong:

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: uitslagen.php                                          *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
 
$main_template 'uitslagen';


define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
include(
ROOT_PATH.'includes/page_header.php');



//-----------------------------------------Start uitslagen--------------------------------------------------------------------
 
 
$sql "SELECT u.uitslagen_id, u.uitslagen_thuis, u.uitslagen_uit, u.uitslagen_doelpunten_thuis, u.uitslagen_doelpunten_uit, u.uitslagen_done, t.teams_id, t.teams_name
        FROM "
.TEAMS_TABLE." t 
LEFT JOIN "
.UITSLAGEN_TABLE." u ON (u.uitslagen_thuis = t.teams_name)
GROUP BY u.uitslagen_id
ORDER BY u.uitslagen_id ASC"
;
        
$result $site_db->query($sql); 
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  { 
   
$uitslagen "Geen uitslagen"

else  {
    
$uitslagen "<table class=\"head2000\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">
    <tr>
    <td>#</td>
<td><b>teams ID</b></td>
    <td><b>Club1</b></td>
    <td><b>Club2</b></td>
    <td><b>Uitslagen</b></td>
    <td><b>Uitslagen</b></td>
    </tr>
    "
;
   
   
   
$i 1;
   while (
$uitslagen_row $site_db->fetch_array($result)){
  
  
  
   
$teams_id $teams_row['teams_id'];
   
$teams_name $teams_row['teams_name'];
   
$uitslagen_thuis $uitslagen_row['uitslagen_thuis'];
   
$uitslagen_uit $uitslagen_row['uitslagen_uit'];
   
$uitslagen_done $uitslagen_row['uitslagen_done'];
   
   
   
   
   if (
$uitslagen_done == 0)
   {
   $uitslagen_doelpunten_thuis '-';
   $uitslagen_doelpunten_uit '-';
   }   
   else {

$uitslagen_doelpunten_thuis $uitslagen_row['uitslagen_doelpunten_thuis'];
$uitslagen_doelpunten_uit $uitslagen_row['uitslagen_doelpunten_uit'];
   }
 
   
   
$uitslagen .= "<tr>
   <td>"
.$i++."</td>
   <td>"
.$teams_id."</td>
   <td><a href=\""
.$site_sess->url(ROOT_PATH."teams.php?teams_id=".$teams_row['teams_id'])."\" target=\"_blank\">".$uitslagen_row['uitslagen_thuis']."</a></td>
   <td><a href=\""
.$site_sess->url(ROOT_PATH."teams.php?teams_id=".$teams_row['teams_id'])."\" target=\"_blank\">".$uitslagen_row['uitslagen_uit']."</a></td>
   <td>"
.$uitslagen_doelpunten_thuis."</td>
   <td>"
.$uitslagen_doelpunten_uit."</td>
   

   </tr>

   "
;                   
}      

  
//$uitslagen .= "</table>\n";
  
$site_template->register_vars("uitslagen"$uitslagen); 
unset(
$uitslagen);
//----------------------------------------Start uitslagen------------------------------------




 
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------

$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator']."<a href=\"".$site_sess->url(ROOT_PATH."evenementen.php")."\" class=\"clickstream\">uitslagen pagina</a>".$config['category_separator'].$eventsROWname."</span>";



//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"clickstream" => $clickstream,
  
"teams_name" => $teams_name,
  
"teams_id" => $teams_id,
  
"teams_description" => $teams_description,
  
//"image_name" => format_text($image_row['image_name'], 2),

));
$site_template->print_template($site_template->parse_template($main_template));

include(
ROOT_PATH.'includes/page_footer.php');
?>

en the test page retuns this results:

Quote
Array
(
   
  • => 4
[uitslagen_id] => 4
    [1] => Barcelona
    [uitslagen_thuis] => Barcelona
    [2] => Real Madrid
    [uitslagen_uit] => Real Madrid
    [3] => 5
    [uitslagen_doelpunten_thuis] => 5
    [4] => 5
    [uitslagen_doelpunten_uit] => 5
    [5] => 1
    [uitslagen_done] => 1
    [6] => 1
    [teams_id] => 1
    [7] => Barcelona
    [teams_name] => Barcelona
)
Array
(
   
  • => 5
[uitslagen_id] => 5
    [1] => Real Madrid
    [uitslagen_thuis] => Real Madrid
    [2] => Barcelona
    [uitslagen_uit] => Barcelona
    [3] => 4
    [uitslagen_doelpunten_thuis] => 4
    [4] => 4
    [uitslagen_doelpunten_uit] => 4
    [5] => 1
    [uitslagen_done] => 1
    [6] => 2
    [teams_id] => 2
    [7] => Real Madrid
    [teams_name] => Real Madrid
)



See also attachment please.

I hope you can help me to solve this mysterious issue.


147
Thanks V@no for your reaction.

Some fields are in Dutch (I am from the Netherlands).

uitslagen = results
thuis = home
uit = out
doelpunten = goals

The rest is not important I believe.

More explanation:

The value of the field uitslagen_thuis (the teams hoe is playing at home) & uitslagen_uit (From the UITSLAGEN TABLE (RESULTS), you can find it always in the TEAMS TABLE.

I do know how it works in MySql, but in Microsoft Excel I do like this: Find uitslagen_thuis (From the  UITSLAGEN TABLE in the TEAMS TABLE and then give me the teams_id (VLookup function).
NB: I just want to be clear.


Here you are:

Code: [Select]
Tabel structuur voor tabel `4images_teams`
--

CREATE TABLE IF NOT EXISTS `4images_teams` (
  `teams_id` int(10) NOT NULL auto_increment,
  `teams_name` varchar(255) NOT NULL,
  `teams_description` text NOT NULL,
  `teams_gespeeld` int(2) NOT NULL default '0',
  `teams_gewonnen` int(2) NOT NULL default '0',
  `teams_gelijk` int(2) NOT NULL default '0',
  `teams_verloren` int(2) NOT NULL default '0',
  `teams_punten` int(2) NOT NULL default '0',
  `teams_doelpunten_voor` int(3) NOT NULL default '0',
  `teams_doelpunten_tegen` int(3) NOT NULL default '0',
  `teams_punten_mindering` int(2) NOT NULL default '0',
  `teams_zaal` varchar(50) NOT NULL default '',
  `teams_voorkeurstijd` varchar(5) NOT NULL default '',
  `teams_clubkleuren` varchar(25) NOT NULL default '',
  PRIMARY KEY  (`teams_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Gegevens worden uitgevoerd voor tabel `4images_teams`
--

INSERT INTO `4images_teams` (`teams_id`, `teams_name`, `teams_description`, `teams_gespeeld`, `teams_gewonnen`, `teams_gelijk`, `teams_verloren`, `teams_punten`, `teams_doelpunten_voor`, `teams_doelpunten_tegen`, `teams_punten_mindering`, `teams_zaal`, `teams_voorkeurstijd`, `teams_clubkleuren`) VALUES
(1, 'Barcelona', '', 3, 0, 3, 0, 3, 14, 14, 0, '', '', ''),
(2, 'Real Madrid', '', 3, 0, 3, 0, 3, 14, 14, 0, '', '', '');

-- --------------------------------------------------------

--
-- Tabel structuur voor tabel `4images_uitslagen`
--

CREATE TABLE IF NOT EXISTS `4images_uitslagen` (
  `uitslagen_id` int(3) NOT NULL auto_increment,
  `uitslagen_datum` int(10) default NULL,
  `uitslagen_speelronde` int(2) NOT NULL default '0',
  `uitslagen_thuis` varchar(25) NOT NULL default '',
  `uitslagen_uit` varchar(25) NOT NULL,
  `uitslagen_doelpunten_thuis` int(2) NOT NULL,
  `uitslagen_doelpunten_uit` int(2) NOT NULL,
  `uitslagen_done` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`uitslagen_id`),
  KEY `uitslagen_thuis` (`uitslagen_thuis`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- Gegevens worden uitgevoerd voor tabel `4images_uitslagen`
--

INSERT INTO `4images_uitslagen` (`uitslagen_id`, `uitslagen_datum`, `uitslagen_speelronde`, `uitslagen_thuis`, `uitslagen_uit`, `uitslagen_doelpunten_thuis`, `uitslagen_doelpunten_uit`, `uitslagen_done`, `uitslagen_thuis_id`, `uitslagen_uit_id`) VALUES
(1, 1231912800, 1, 'Barcelona', 'Real Madrid', 5, 5, 0, 0, 0),
(2, 1231912800, 1, 'Barcelona', 'Real Madrid', 4, 4, 1, 0, 0);

Please let me know if I have to change or add something from those two tables. I need to solve this issue.


Many thanks in advance V@no :)

148
Can iemand correct this query for me please?

I spend de hole day trying solving this issue without any success.

I really need your PHP knowledge.

Many thanks in advance,

149
Thanks KurtW,

I still not get the teams_id.

I wonder what wrong in this code.

150
Hello,

I really need some support to correct this query for me.

I added 2 tables to the 4images database.

TEAMS (teams_id, teams_name,....)
 &
RESULTS (results_id, results_home, results_out, .....)

In my additional page results.php I have this information:

Barcelona vs Dynamo Moscow 5 - 5

The problem is that I cannot get the value of the teams_id (When you click on the name the team)


I am using this query, but I still not have the teams_id:


Code: [Select]
$sql = "SELECT r.results_id, r.results_home, r.results_out, r.results_goals_home, r.results_goals_out, r.results_done, t.teams_id, t.teams_name
        FROM (".TEAMS_TABLE." t)
LEFT JOIN ".RESULTS_TABLE." r ON r.results_home = t.teams_name
   
GROUP BY r.results_id
ORDER BY r.results_id ASC";
       
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);


I really tries everything, but.... :cry:

I believe there is something wrong with the LEFT JOIN.



Pages: 1 ... 6 7 8 9 [10] 11 12 13 14 ... 34