Author Topic: Using image tags on a custom page.  (Read 66976 times)

0 Members and 1 Guest are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #90 on: November 15, 2007, 02:30:49 AM »
Quote
It has nothing to do with your english. I think you tired today. Have some rest Thunderstrike.

No ... is request ... I no get (but is my english for get this request ...)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #91 on: November 15, 2007, 02:38:54 AM »
I do not have any problem with your english. I understand perfectly.
Maybe I am the one how tired. Another day I will explain it better (If I do not solve it myself :wink:)

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #92 on: November 15, 2007, 11:59:46 AM »
Ok so if want for show user name and hobby only for upload user - is this:

Code: [Select]
$sql = "SELECT " . get_user_table_field("u.", "user_name") . $additional_sql . "
        FROM ".IMAGES_TABLE." i
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
        WHERE i.user_id = 1
        GROUP BY i.user_id
        ORDER BY i.user_id DESC
        LIMIT 20";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);


I have question:

When I use this query I get all the information I asked except user_id.

When I use ".$user_row['user_name']." ".$user_row['user_hobby]." I get the right value, but when I use ".$user_row['user_id]." I get nothing.

What wrong with my code?
I appreciate any help

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #93 on: November 15, 2007, 06:54:52 PM »
Code: [Select]
$sql = "SELECT " . get_user_table_field("u.", "user_name") . $additional_sql . "
        FROM ".IMAGES_TABLE." i
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
        WHERE i.user_id = 1
        GROUP BY i.user_id
        ORDER BY i.user_id DESC
        LIMIT 20";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

for:

Code: [Select]
$sql = "SELECT " . get_user_table_field("u.", "user_id") . get_user_table_field(", u.", "user_name") . $additional_sql . "
        FROM ".IMAGES_TABLE." i
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
        WHERE i.user_id = 1
        GROUP BY i.user_id
        ORDER BY i.user_id DESC
        LIMIT 20";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

Now - $user_row[$user_table_fields['user_id']]
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #94 on: November 15, 2007, 08:18:18 PM »
Perfect Thunderstrike. Thanks for your support.

Quote
Now - $user_row[$user_table_fields['user_id']]

$user_row['user_id'] is now also doing a goog job :wink:

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #95 on: November 15, 2007, 08:29:06 PM »
Please use (with USERS_TABLE):

Code: [Select]
$user_row[$user_table_fields['user_id']]
format_text(trim($user_row[$user_table_fields['user_name']]), 2)

Thank for posting.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #96 on: November 19, 2007, 11:00:08 PM »
Hi guys,

I have a very little question:

I changed the WHERE LINE to:
Code: [Select]
WHERE i.user_hobby <> ""
but I got this error.

Quote
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /hsphere/local...... on line 46

What do I have to typ instead of (<> "") (Not empty)

Hery you have the full query:
Code: [Select]
$sql = "SELECT " . get_user_table_field("u.", "user_id") . get_user_table_field(", u.", "user_name") . $additional_sql . "
        FROM ".IMAGES_TABLE." i
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
        WHERE i.user_id = 1
        GROUP BY i.user_id
        ORDER BY i.user_id DESC
        LIMIT 20";

Many thank in advance,
Cruxy

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #97 on: November 19, 2007, 11:30:22 PM »
Code: [Select]
WHERE i.user_hobby <> ""

for:

Code: [Select]
WHERE i.user_hobby != ""
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #98 on: November 19, 2007, 11:49:04 PM »
Code: [Select]
$sql = "SELECT " . get_user_table_field("u.", "user_id") . get_user_table_field(", u.", "user_name") . $additional_sql . "
        FROM ".IMAGES_TABLE." i
        LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)
        WHERE i.user_hobby != ""
        GROUP BY i.user_id
        ORDER BY i.user_id DESC
        LIMIT 20";

Now I get the error:

Code: [Select]
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /hsphere/local/home/....
in this line:

Code: [Select]
LIMIT 20";
When I change:
Code: [Select]
WHERE i.user_hobby != ""
to

Code: [Select]
WHERE i.user_hobby > 1

I get some results

Can you see what wrong in this line?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #99 on: November 19, 2007, 11:52:26 PM »
I edited my post

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #100 on: November 19, 2007, 11:55:04 PM »
Code is small ... is possible for post more ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #101 on: November 20, 2007, 12:44:20 AM »
I tried to solve it by myself, but no luck!

I changed the code to make it easy for you:
Code: [Select]
<?php
$main_template 
'special3';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$allowed_users_access_page = array(2); // Change for all user ID need.
if (function_exists('check_for_valid_user_access_page') && !check_for_valid_user_access_page($allowed_users_access_page) && $user_info['user_level'] < ADMIN) {
   
redirect($url);
}
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');
include(
ROOT_PATH.'includes/stats.php');

            
$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

if (isset(
$additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
   foreach (
$additional_user_fields as $key => $val) {
      
$additional_sql .= ", u.".$key;
   }
}

 
//Hobby

  
$sql "SELECT i.image_id, i.image_events, i.cat_id, i.user_id, i.image_name, i.image_date, i.image_active, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id) 
        WHERE i.image_events != ""
        GROUP BY i.user_id
        ORDER BY i.image_date DESC
        LIMIT 100"
;
$result $site_db->query($sql); 
$num_rows $site_db->get_numrows($result); 

if (!
$num_rows)  { 
   
$hobby $lang['no_images']; 

else  {
   
$hobby "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\"><tr><td>Image Name</td><td></td><td>Image events</td></tr>";
   

   while (
$user_row $site_db->fetch_array($result)){ 
   
$hobby .= "<tr><td>".$image_name."</a></td><td>".$image_row['image_events']."</td></tr>";


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

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

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"clickstream" => $clickstream,
  

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

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




Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Using image tags on a custom page.
« Reply #102 on: November 20, 2007, 12:49:05 AM »
Oh ok so:

Code: [Select]
WHERE i.image_events != ""

for:

Code: [Select]
WHERE " . strlen("i.image_events") > 0 . "
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #103 on: November 20, 2007, 01:03:00 AM »
Code: [Select]
WHERE i.user_hobby <> ""

for:

Code: [Select]
WHERE i.user_hobby != ""

I think you mean:
Code: [Select]
WHERE i.user_hobby != ''
Because my code is working fine now.

Offline Sun Zaza

  • Sr. Member
  • ****
  • Posts: 399
    • View Profile
Re: Using image tags on a custom page.
« Reply #104 on: November 20, 2007, 01:14:35 AM »
Thank you Thunderstike anyway for your help. :wink: