[PHP-DB] Splitting Arrays in Half
Hello all, I have the following code and here is my goal: I have an array and right now, as the code stands, I have one column of data on a page. I want it to have 2 colums of data on a page. I have tried this and it just returns blank so I am asking for some help. Thank you in advance and I will be here for any questions you have. Thanks Again, Jacob $total_count = 0; $display_count = 0; //Do for each item foreach ($item as $sched) { /*$total_count++; $sched[] = array( 'teama' = $item[teama], 'teamb' = $item[teamb], 'scorea' = $item[scorea], 'scoreb' = $item[scoreb]); } while ($total_count $display_count) { if ($display_count != 0) next($sched);*/ //Start the Row $output-TableRowStart(); // Get the team name given its ID $tma = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched[teama])); $tmb = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched[teamb])); $col1 = $vars['color1']; // Home is the first team or the second? $rev = $vars['reversed']; if ($rev == 1) { $loc = $tmb[city]; $field = $tmb[paddress]; } else { $loc = $tma[city]; $field = $tma[paddress]; } if ($sched[scorea] == -1) { $sched[scorea] = NA; } if ($sched[scoreb] == -1) { $sched[scoreb] = NA; } $output-Text(td); $output-Text(table width='200'); $output-Text(tr); $output-Text(td); $output-Text(div align=\left\font size=1nbsp;.$tma[team]. ($sched[scorea])/font/div); $output-Text(/td); $output-Text(td bgcolor='$col1' width='100'); $output-Text(font color=#FF size='1'/font); $output-Text(/td); $output-Text(/tr); $output-Text(tr); $output-Text(td); $output-Text(div align=\left\font size=1nbsp;.$tmb[team]. ($sched[scoreb])/font/div); $output-Text(/td); $output-Text(td bgcolor='$col1' width='100'); $output-Text(font color=#FF size='1'div align=\right\a title='$field'$loc/a/div/font); $output-Text(/td); $output-Text(/table); $output-Text(/td); /* $display_count++; next($sched); while($total_count $display_count) { // Get the team name given its ID $tma = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched['teama'])); $tmb = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched['teamb'])); //Get the COlors $col1 = $vars['color1']; // Home is the first team or the second? $rev = $vars['reversed']; if ($rev == 1) { $loc = $tmb[city]; $field = $tmb[paddress]; } else { $loc = $tma[city]; $field = $tma[paddress]; } if ($sched[scorea] == -1) { $sched[scorea] = NA; } if ($sched[scoreb] == -1) { $sched[scoreb] = NA; } $output-Text(td); $output-Text(table); $output-TableRowStart(); $output-TableColStart(1,left); $output-Text(font size=1nbsp;.$tma[team]. ($sched[scorea])/font); $output-TableColEnd(); $output-Text(td bgcolor='$col1' align='center' valign='middle' width='80'); $output-Text(font color=#FF size='1'/font); $output-TableColEnd(); $output-TableRowEnd(); $output-TableRowStart(); $output-TableColStart(1,left); $output-Text(font size=1nbsp;.$tmb[team]. ($sched[scoreb])/font); $output-TableColEnd(); $output-Text(td bgcolor='$col1' align='center' valign='middle' width='80'); $output-Text(font color=#FF size='1'a title='$field'$loc/a/font); $output-TableColEnd(); $output-Text(/table);
[PHP-DB] Correction: [PHP-DB] Splitting Arrays in Half
I was thinking. The way I have it now the code is commented out the parts that I thought would work and allow me to have two columns. I have commented them out because in the production environment it was returning nothing so I at least have to have it show SOMETHING! Thanks in advance. Hopefully it clairifies some things On 12/9/04 1:28 PM, You, Jacob Hackamack, with the internet address: [EMAIL PROTECTED] wrote: Hello all, I have the following code and here is my goal: I have an array and right now, as the code stands, I have one column of data on a page. I want it to have 2 colums of data on a page. I have tried this and it just returns blank so I am asking for some help. Thank you in advance and I will be here for any questions you have. Thanks Again, Jacob $total_count = 0; $display_count = 0; //Do for each item foreach ($item as $sched) { /*$total_count++; $sched[] = array( 'teama' = $item[teama], 'teamb' = $item[teamb], 'scorea' = $item[scorea], 'scoreb' = $item[scoreb]); } while ($total_count $display_count) { if ($display_count != 0) next($sched);*/ //Start the Row $output-TableRowStart(); // Get the team name given its ID $tma = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched[teama])); $tmb = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched[teamb])); $col1 = $vars['color1']; // Home is the first team or the second? $rev = $vars['reversed']; if ($rev == 1) { $loc = $tmb[city]; $field = $tmb[paddress]; } else { $loc = $tma[city]; $field = $tma[paddress]; } if ($sched[scorea] == -1) { $sched[scorea] = NA; } if ($sched[scoreb] == -1) { $sched[scoreb] = NA; } $output-Text(td); $output-Text(table width='200'); $output-Text(tr); $output-Text(td); $output-Text(div align=\left\font size=1nbsp;.$tma[team]. ($sched[scorea])/font/div); $output-Text(/td); $output-Text(td bgcolor='$col1' width='100'); $output-Text(font color=#FF size='1'/font); $output-Text(/td); $output-Text(/tr); $output-Text(tr); $output-Text(td); $output-Text(div align=\left\font size=1nbsp;.$tmb[team]. ($sched[scoreb])/font/div); $output-Text(/td); $output-Text(td bgcolor='$col1' width='100'); $output-Text(font color=#FF size='1'div align=\right\a title='$field'$loc/a/div/font); $output-Text(/td); $output-Text(/table); $output-Text(/td); /* $display_count++; next($sched); while($total_count $display_count) { // Get the team name given its ID $tma = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched['teama'])); $tmb = pnModAPIFunc('Standings','user','getteam',array('tid' = $sched['teamb'])); //Get the COlors $col1 = $vars['color1']; // Home is the first team or the second? $rev = $vars['reversed']; if ($rev == 1) { $loc = $tmb[city]; $field = $tmb[paddress]; } else { $loc = $tma[city]; $field = $tma[paddress]; } if ($sched[scorea] == -1) { $sched[scorea] = NA; } if ($sched[scoreb] == -1) { $sched[scoreb] = NA; } $output-Text(td); $output-Text(table); $output-TableRowStart(); $output-TableColStart(1,left); $output-Text(font size=1nbsp;.$tma[team]. ($sched[scorea])/font); $output-TableColEnd(); $output-Text(td bgcolor='$col1' align='center' valign='middle' width='80'); $output-Text(font color=#FF size='1'/font); $output-TableColEnd(); $output-TableRowEnd
[PHP-DB] Question
Hello, I am using PostNuke and have decided to create a page for a local basketball team. I have this as the create team function: // /// Create a new Team for the given Tournament /// /// Parameters: /// 'cid' = Tournament ID ///'team' = Team name /// 'contact' = name of the team representative /// 'email' = representative's email ///'homepage' = team's Homepage // function standings_admin_createteam($args) { // Get parameters from whatever input we need. list($lid,$cid,$team,$city,$shorts,$tshirt,$shortsa,$tshirta, $contact,$phone,$paddress,$email,$homepage,$penpts,$picturet) = pnVarCleanFromInput('lid','cid','team','city','shorts','tshirt','shortsa','t shirta', 'contact','phone','paddress','email','homepage','penpts','picturet'); // Admin functions of this type can be called by other modules. extract($args); // Confirm authorisation code. if (!pnSecConfirmAuthKey()) { pnSessionSetVar('errormsg', _BADAUTHKEY); pnRedirect(pnModURL('Standings', 'admin', 'viewteams', array('lid' = $lid))); return true; } $modid = pnModGetIDFromName('Standings'); $modinfo= pnModGetInfo($modid); $picenable = pnModGetVar('Standings', 'picenable'); // Notable by its absence there is no security check here. This is because // the security check is carried out within the API function and as such we // do not duplicate the work here // Load API. if (!pnModAPILoad('Standings', 'admin')) { pnSessionSetVar('errormsg', _LOADFAILED); return $output-GetOutput(); } // The API function is called. $tid = pnModAPIFunc('Standings','admin','createteam', array('lid' = $lid, 'team'= $team, 'city'= $city, 'shorts' = $shorts, 'tshirt' = $tshirt, 'shortsa' = $shortsa, 'tshirta' = $tshirta, 'contact' = $contact, 'phone' = $phone, 'paddress'= $paddress, 'email' = $email, 'homepage'= $homepage, 'penpts' = $penpts)); // The return value of the function is checked here if ($tid != false) { // Success pnSessionSetVar('statusmsg', _STANDINGSTEAMCREATED); } /* if ($picenable == 1) { // manage picture Upload if there is a picture sent - Portrait if ($picture!=) { $picname = $_FILES['picture']['name']; with: if ($picenable == 1) { // manage picture Upload if there is a picture sent // make Portrait photo first $picname = $_FILES['picturep']['name']; if ($picname != ) { */ if ($picenable == 1) { // manage picture Upload if there is a picture sent // make Portrait photo first $picname = $_FILES['picturet']['name']; if ($picname != ) { $pictype = $_FILES['picturet']['type']; $picsize = $_FILES['picturet']['size']; $pictemp = $_FILES['picturet']['tmp_name']; $picdest = modules/.$modinfo['directory']./pnimages/photos/teams/team.$tid..jpg; $picmax = pnModGetVar('Standings', 'picmaxt'); $picwidth = pnModGetVar('Standings', 'xsizet'); $picheight = pnModGetVar('Standings', 'ysizet'); $picqual = pnModGetVar('Standings', 'picqualt'); $picerror = ; // check if file is of the right type (jpg - gif - png) - Set in config??? if ($pictype != image/pjpeg) { $picerror = _STANDINGSPLAYERPICTERR1; } if ($picsize $picmax) { $picerror = _STANDINGSPLAYERPICTERR2; } if ($picerror == ) { $g_is=getimagesize($pictemp); if(($g_is[0]-$picwidth)=($g_is[1]-$picheight)) { $g_iw=$picwidth; $g_ih=($picwidth/$g_is[0])*$g_is[1]; } else { $g_ih=$picheight; $g_iw=($g_ih/$g_is[1])*$g_is[0]; } $img_src = imageCreateFromJpeg($pictemp); $img_dst = imageCreateTrueColor($g_iw,$g_ih); imageCopyResampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw, $g_ih, $g_is[0], $g_is[1]); imageJpeg($img_dst, $picdest, $picqual); imageDestroy($img_dst); } } } // This function generated no output, and so now it is complete we redirect // the user to an appropriate page for them to carry on their work pnRedirect(pnModURL('Standings', 'admin', 'viewteams', array('lid' = $lid))); // Return return true; } The only problem is that the image upload does not seem to work. Any help
[PHP-DB] Session Values Change
Hello, I am trying to start a blog page where the person selects their person they want to view (bottom of the page) and then it somehow changes the session variable (top of the code) and then accesses the database. I was wondering, what is the correct way to do something like this. I have tried a couple of options (a hrefs) but they didn¹t seem to work and was wondering if anybody had any suggestions. Thank You In Advance Jacob ?php session_start(); if (! isset($_SESSION['view'])) { $_SESSION['view'] = Jacob; } ? #FORMATTING CODE HERE $dbuser='php' ; $dbpass=''; $dbhost='localhost'; $conn = mysql_connect ( $dbhost , $dbuser , $dbpass ); //mysql_select_db ( web ); $sql = 'Select UNIX_TIMESTAMP(date) AS date,title,article from web.blog where user='.$view.' order by date desc LIMIT 10'; $result = mysql_query($sql); //Execute For Future Use: SELECT DATE_FORMAT(date,'%W, %D %M, %Y %l:%i%p') content FROM blog while ( $dataRow = mysql_fetch_row ( $result ) ) { $date=date(F dS Y h:i:s A, $dataRow[0]); echo 'a name='.$date.'/a'; echo ' div class=date'.$date. '/div'; echo ' h3'.$dataRow[1].'/h3'; echo ' p'.$dataRow[2].'/pbr'; #echo $sql ; } mysql_close ( $conn ); #FORMATTING CODE HERE div id=footer p Other Users: br Jacob Hackamack | Julie Hackamack | David Hackamack/p /div
[PHP-DB] Quick Question: Line Breaks
Hello, I have a couple of quick questions. When I execute this code on my php page (I know that the .PSD image isn¹t web ready, but Safari does what I need it to do :) ) it displays the entire source as one line. Is there anyway to have it be broken. I have read places (internet sites) that say that the following solutions might work: echo ¹;\n\n echo ¹\n\n ; echo \n\n¹; None of them seem to work, am I doing something wrong? echo 'meta http-equiv=content-type content=text/html; charset=utf-8'; echo 'html'; echo 'head'; echo 'title'; echo 'FilmCanister Desktops'; echo '/title'; echo '/head'; echo 'body'; echo 'center'; echo 'img src=images/Rotating.psd'; echo 'h2'; echo 'Coming SoonDesktop Pictures (2.83 GB Worth)/h2'; echo '/center'; echo '/body'; echo '/html'; Also, I am looking for a good freeware image gallery for Linux/Apache, if anybody has any suggestions please help out. Thanks for advance. Jacob
[PHP-DB] BBEdit
I use BBEdit on Mac OSX, I know I copied and pasted some things, but I actually wrote all of the lines that you took out, weird. I really have no idea how its screwing up on spaces like that, I wish there was a PHP error checker that actually told you what happens and why. Anyways, the beta of the site is up at http://www.filmcanister.com/Education/Physics/ If anybody wants to take a look at it (don't be afraid to put in a fake name and period, the table is backed up and won't go live for some time) :). Thank you one and all. Jacob -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem Solved
Thanks for your help, I was able to go through line by line and fix what was wrong, I guess a simple rewriting of some code solved it because now its better and faster then before. Thank You all. Jacob