Arcade Webmaster Forum - Arcade Webmasters Talk Arcades at ArcadeBB
Current time: 02-05-2012, 08:12 PM


Arcade Webmaster Forum - Arcade Webmasters Talk Arcades at ArcadeBB ok Arcade Forum ok Arcade Discussions ok Webmastering
ok PHP Help?
Post Reply 
araclar
PHP Help?
Threaded Mode
Linear Mode
 
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
09-02-2010, 09:27 AM
Post: #1
cyruskafaiwu Offline
Member
***
Posts: 53
Joined: Feb 2010
Reputation: 0
Points: 76
PHP Help?
PHP Code:
<?php
include("../config.php");
$sql = mysql_query("SELECT * FROM `ava_tags`");
$num = 0;
$text = "";
while(
$a = mysql_fetch_array($sql)) {
$as = mysql_query("SELECT * FROM `ava_tag_relations` where `tag_id` = '$a[id]'");
$as = mysql_num_rows($as);
$min = 2; // the minmium of games that needs to be in that tag to be displayed.
if($as > $min) {
$num = $num+1;
}
}
$col = $num / 4;
$col = round($col);

$myfile1 = "tag_cloud_cache1.php";
$fh1 = fopen($myfile1, 'w') or die("can't open file");
$myfile2 = "tag_cloud_cache2.php";
$fh2 = fopen($myfile2, 'w') or die("can't open file");
$myfile3 = "tag_cloud_cache3.php";
$fh3 = fopen($myfile3, 'w') or die("can't open file");
$myfile4 = "tag_cloud_cache4.php";
$fh4 = fopen($myfile4, 'w') or die("can't open file");
$col1 = $col;
$col2 = $col * 2;
$col3 = $col * 3;
$col4 = $col * 4;
$numw = 0;
while(
$a = mysql_fetch_array($sql)) {
$as = mysql_query("SELECT * FROM `ava_tag_relations` where `tag_id` = '$a[id]'");
$as = mysql_num_rows($as);
if(
$as > $min) {
$numw = $numw+1;
$tag_link = 'tag/'.seoname($a[tag_name]).$setting['seo_extension'];
$string = '<a href="'.$setting['site_url'].'/'.$tag_link.'">' . $a[tag_name] . '</a><br />
'
;
if(
$numw <= $col1) {
//less than 25?
fwrite($fh1, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
elseif(
$col1 <= $numw && $numw <= $col2) {
// more than 25 but less than 50
fwrite($fh2, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
elseif(
$col2 <= $numw && $numw <= $col3) {
// more than 50 but less than 75
fwrite($fh3, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
elseif(
$col3 <= $numw && $numw <= $col4) {
// more than 25 but less than 25
fwrite($fh4, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
else
{
}
}
}
fclose($fh1);
fclose($fh2);
fclose($fh3);
fclose($fh4);

?>
<div class="tag_block_col">
<?php
include("tag_cloud_cache1.php");
?>
</div>
<div class="tag_block_col">
<?php
include("tag_cloud_cache2.php");
?>
</div>
<div class="tag_block_col">
<?php
include("tag_cloud_cache3.php");
?>
</div>
<div class="tag_block_col">
<?php
include("tag_cloud_cache4.php");
?></div> 

Heres a code i have been working on. Apparantly, it wont write to the files. And later found that if elses are broken.

Can anyone help me figure out whats wrong or help me fix the if elses?

noobowned.com // Advertise And Review Arcades Here
Earn Money
Find all posts by this user
Quote this message in a reply
09-02-2010, 08:31 PM
Post: #2
stereotape Offline
Member
***
Posts: 95
Joined: Apr 2010
Reputation: 0
Points: 109
RE: PHP Help?
(09-02-2010 09:27 AM)cyruskafaiwu Wrote:  
PHP Code:
<?php
include("../config.php");
$sql = mysql_query("SELECT * FROM `ava_tags`");
$num = 0;
$text = "";
while(
$a = mysql_fetch_array($sql)) {
$as = mysql_query("SELECT * FROM `ava_tag_relations` where `tag_id` = '$a[id]'");
$as = mysql_num_rows($as);
$min = 2; // the minmium of games that needs to be in that tag to be displayed.
if($as > $min) {
$num = $num+1;
}
}
$col = $num / 4;
$col = round($col);

$myfile1 = "tag_cloud_cache1.php";
$fh1 = fopen($myfile1, 'w') or die("can't open file");
$myfile2 = "tag_cloud_cache2.php";
$fh2 = fopen($myfile2, 'w') or die("can't open file");
$myfile3 = "tag_cloud_cache3.php";
$fh3 = fopen($myfile3, 'w') or die("can't open file");
$myfile4 = "tag_cloud_cache4.php";
$fh4 = fopen($myfile4, 'w') or die("can't open file");
$col1 = $col;
$col2 = $col * 2;
$col3 = $col * 3;
$col4 = $col * 4;
$numw = 0;
while(
$a = mysql_fetch_array($sql)) {
$as = mysql_query("SELECT * FROM `ava_tag_relations` where `tag_id` = '$a[id]'");
$as = mysql_num_rows($as);
if(
$as > $min) {
$numw = $numw+1;
$tag_link = 'tag/'.seoname($a[tag_name]).$setting['seo_extension'];
$string = '<a href="'.$setting['site_url'].'/'.$tag_link.'">' . $a[tag_name] . '</a><br />
'
;
if(
$numw <= $col1) {
//less than 25?
fwrite($fh1, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
elseif(
$col1 <= $numw && $numw <= $col2) {
// more than 25 but less than 50
fwrite($fh2, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
elseif(
$col2 <= $numw && $numw <= $col3) {
// more than 50 but less than 75
fwrite($fh3, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
elseif(
$col3 <= $numw && $numw <= $col4) {
// more than 25 but less than 25
fwrite($fh4, $string) or die("can't open file");
echo 
"$a[tag_name]";
}
else
{
}
}
}
fclose($fh1);
fclose($fh2);
fclose($fh3);
fclose($fh4);

?>
<div class="tag_block_col">
<?php
include("tag_cloud_cache1.php");
?>
</div>
<div class="tag_block_col">
<?php
include("tag_cloud_cache2.php");
?>
</div>
<div class="tag_block_col">
<?php
include("tag_cloud_cache3.php");
?>
</div>
<div class="tag_block_col">
<?php
include("tag_cloud_cache4.php");
?></div> 

Heres a code i have been working on. Apparantly, it wont write to the files. And later found that if elses are broken.

Can anyone help me figure out whats wrong or help me fix the if elses?

I'm not a coder but i have never saw
Code:
`
in the codes that i looked previously...Try to change them
Code:
'

Real Arcade
Android Games
Best Car Games
All Physics Games
Kids Math Games
Visit this user's website Find all posts by this user
Quote this message in a reply
09-04-2010, 01:09 PM
Post: #3
cyruskafaiwu Offline
Member
***
Posts: 53
Joined: Feb 2010
Reputation: 0
Points: 76
RE: PHP Help?
Its been fixed at a different forum. Closed (hopes his magic works).

noobowned.com // Advertise And Review Arcades Here
Earn Money
Find all posts by this user
Quote this message in a reply
 
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:


Iphone Seri 4 Tasarımı blackinci Tarafından Yapılmıştır
Powered By MyBB, © 2002-2012 MyBB Group.