Jump to content

themeatpuppet

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

themeatpuppet's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ugh no luck :'(. working php: http://www.amazero.com/phpinfo.php new domain: http://www.reinventingthecolorwheel.org/phpinfo.php
  2. Yes I have the .htaccess, One question though just to make sure I'm doing this right, in the part of the script that says # And where should it be installed? DOMAIN="hiveminds.co.uk" I should write the new domain while at SOURCEDOMAIN="demo.hiveminds.co.uk" I should write the one that's already working right?
  3. oh and yeah, I do have access to the php.ini file for the domain that is running the version I compiled with this script, the problem indeed is that the url_wrappers are disabled in the php that is running on the server which I do not have access to.
  4. Hm You mean to swapping those changes in the first script? That one actually worked and I have a folder called 'php5' before my domains, and the domain I name in that first installation is running that new version of php. I'm afraid that if I run that script again with the changes I might ruin something that was already working in the first place or make matters worse.... My actual problem is with redirecting that existing version of php into another domain on the same account. Do you think that swap will fix that?
  5. It is the same exact one as the tutorial: Dreamhost, its server's php version does not allow fopen, fwrite... as well as some other functions I need for my application, :'( This is why I had to compile a new version to edit that support in my php.ini file. Thanks for replying!
  6. Hello I'm using this tutorial to compile my own version of php that support fwrite and fopen: http://www.hiveminds.co.uk/node/3201 For some reason the script only works within the domain of the original installation, I've followed all of the instructions: the second shell script successfully creates a new folder in in php5 with the new domain name as well as a cgi-bin (although it only has a php.cgi and not a php.fcgi) in the new domain. When I try a phpinfo the version of php is evidently the one on the server. What could be wrong? Are there alternatives methods to go about this? Thanks for reading!
  7. blast! i tought i've corrected that before, i cant believe it was actually that, i guess with so many of them i got kungfused thanks!
  8. I'm pulling out links from a database, some of them are images, some are movies, some are URLs and some are just download files. I need a way to differentiate each of the to be printed in the anchor tag this is what I'm doing: for($j=0;$j<count($links);$j++) { // explode on '.' to separate string $link_path = explode('.',$links['link_path']); // get last element for extension $link_path=$link_path[count($link_path)-1]; if($link_path=='jpg'|| $link_path=='gif'|| $link_path=='png'|| $link_path=='JPG'|| $link_path=='jpeg'|| $link_path=='JPEG'|| $link_path=='GIF'|| $link_path=='PNG'|| $link_path=='swf'|| $link_path=='SWF') { $link_image = getimagesize($folder.'/'.links['link_path']); $link_location = $folder.'/'; $link_target = "\" onclick=\"popUp(this.href,'console',$link_image[1],$link_image[0]);return false;\" target=\"newWin\">"; } elseif($link_path=='cfm'||$link_path='htm'||$link_path='html') { $link_location = $folder.'/'; $link_target = '">'; } else { $link_location=''; $link_target = '">'; } $links_div .='<li><a href="'.$link_location.$links['link_path'].$link_target.$links['link_name'].'</a>'; if(($i!=count($links))||$i==0) { $links_div .= " | </li>"; } else { $links_div .= "</li>"; } } Well the idea makes sense to me, but for some reason i don't understand, the loop is skipping the last else statement and those links that should be processed as such end up as the second elseif. It's like a riddle ??? ???
  9. I guess in this case the question is how much of an effect does calling the mysql database have in the overall performance of the site, in one script the database is called for a single record every time it is needed while in the other it is only called a single time and the results are retrieved. As much as I test here it doesn't really seem to make a difference but I wonder if it does elsewhere.
  10. Finally! It still took me a lot of tweaking (including a neurotic spree of commenting each step of the process) even AFTER it all made sense, but I finally made it with your hel btheri thank you so much. I truly feel that I've stepped above a new level of both php programming knowledge and confidence after this one Now, just to make sure, for the million cent question, is this code: $select_all_kingdom="SELECT * FROM kingdoms, castles, castleguards WHERE kingdoms.kingdomId=$c AND castles.kingdomId=$c AND castles.castleId=castleLinks.castleId ORDER BY castles.castleId"; $kingdom_selected = mysql_query($select_all_kingdom) or die('Query failed: ' . mysql_error()); $castles = array(); while($kingdom=mysql_fetch_assoc($kingdom_selected)) { $kingdom_name=$kingdom["kingdomName"]; $kingdom_king = $kingdom["kingdomKing"]; $kingdom_des = $kingdom["kingdomDescription"]; $castle_id=$kingdom["castleId"]; $guard_id=$kingdom["guardId"]; if(isset($prev_castle_id)&&$prev_castle_id!=$castle_id){ $castle['castle_guards']=$guards; array_push($castles,$castle); } if(empty($prev_castle_id)||$prev_castle_id!=$castle_id){ $guard=array(); $guards=array(); $guard['guard_name']=$kingdom["guardName"]; $guard['guard_weapon']=$kingdom["guardWeapon"]; array_push($guards,$guard); $prev_guard_id=$guard_id; $castle = array(); $castle['castle_name'] = $kingdom["castleName"]; $castle['castle_des'] = $kingdom["castleDescription"]; $prev_castle_id=$castle_id; } if(isset($prev_guard_id)&&$prev_guard_id!=$guard_id) { $guard=array(); $guard['guard_name']=$kingdom["guardName"]; $guard['guard_weapon']=$kingdom["guardWeapon"]; array_push($guards,$guard); $prev_guard_id=$guard_id; } } if(isset($guards)&&$castle){ $castle['castle_guards']=$guards; array_push($castles,$castle); } all that much better than this one: $select_castles ="SELECT * FROM castles WHERE kingdomId=".$k; $castles_selected = mysql_query($select_castles) or die(mysql_error()); $castles = array(); while($this_castle=mysql_fetch_assoc($castles_selected)) { $castle=array(); $castle_name = $this_castle['castleName']; $castle_des = $this_castle['castleDescription']; $castle_id = $this_castle['castleId']; $castle['castle_name']=$castle_name; $castle['castle_des']=$castle_des; $castle_guards = array(); $select_guards ="SELECT * FROM castleguards WHERE castleId=".$castle_id; $guards_selected = mysql_query($select_guards) or die(mysql_error()); while($guard=mysql_fetch_assoc($guards_selected)) { $castle_guard = array(); $castle_guard['guard_name']=$guard['guardName']; $castle_guard['guard_weapon']=$guard['guardWeapons']; array_push($castle_guards,$castle_guard); } $castle['castle_guards'] = $castle_guards; array_push($castles,$castle); } ???
  11. I keep getting duplicates , but I know what's the problem. It's in the array of kingdoms, I dont see anyway of telling php when both all the castles and the guards for those castles have been processed for that kingdom to be finally added to the array. Otherwise I get a duplicate kingdom array of arrays for every new guard! $select_all_kingdom="SELECT * FROM kingdoms, castles, castleguards WHERE kingdoms.kingdomId=$c AND castles.kingdomId=$c AND castles.castleId=castleguards.castleId"; $kingdom_selected = mysql_query($select_all_kingdom) or die('Query failed: ' . mysql_error()); // array to keep each castle $castles = array(); // array to keep each info item for each castle $i=0; while($kingdom=mysql_fetch_assoc($kingdom_selected)) { //for($i=0;$i<mysql_num_rows($kingdom_selected);$i++){ // $kingdom_id = $kingdom["kingdomId"]; $kingdom_name=$kingdom["kingdomName"]; $kingdom_prof = $kingdom["kingdomProf"]; $kingdom_des = $kingdom["kingdomDescription"]; $castle_id=$kingdom["castleId"]; // if castle has not entered before if(empty($prev_pid)||$prev_pid!=$castle_id){ $castle = array(); $guards=array(); $prev_pid=$castle_id; $castle['castle_name'] = $kingdom["castleName"]; $castle['castle_des'] = $kingdom["castleDescription"]; } $guard_id=$kingdom["guardId"]; if(empty($prev_lid)||isset($prev_lid)&&$prev_lid!=$guard_id) { $guard=array(); $guard['guard_name']=$kingdom["guardName"]; $guard['guard_weapon']=$kingdom["guardWeapon"]; // array of castle_guard inserted to the end of array_push($guards,$guard); $castle['castle_guards']=$guards; $prev_lid=$guard_id; } // on first ru,n previous castle doesn't exist if(empty($prev_proi)){ echo '"prev proi empty castle pushed !!!"'.$i."\n\n"; array_push($castles,$castle); } elseif(isset($prev_proi)&&$prev_proi!=$i){ echo '"prev proi='.$prev_proi.'!=castles['.$i.']"'."\n\n"; array_push($castles,$castle); } $prev_proi=$i; $i++; } print_r($castles); echo '</pre>'; } im way over my head! help!
  12. hey man thanks, that was fast! For some reason, I always think there's a function that everyone knows but I when thinks don't go right. This is working just find, the associative array tip worked like a charm, thanks again!
  13. Hi! This is my first post in this forum, I posted this question on another site but it's a bit slow and I wanted to try a new forum for a change. My php problem is I want to make the result of 3 tables linked through foreign keys into a 3-dimensional array that reflects their relationship without repetition and without having to call the database more three times. I know I'm doing a couple of things wrong, one thing for instance is initializing a variable at the end of the loop to remember the previous value s that it does not repeat itself, surely there must be a more elegant way to go about this, but I'm lost and I've been stuck on this all day. here's the infamous loop: $select_kcg = "SELECT * FROM kingdoms, castles, guards WHERE kingdoms.kingdomId=$mykingdom AND castles.kingdom_id=$mykingdom AND castles.castle_id=guards.castleId"; $mykingdom_selected = mysql_query($select_kcg) or die('Query failed: ' . mysql_error()); $castles = array(); $castle = array(); while($mykingdom=mysql_fetch_assoc($mykingdom_selected)) { $mykingdom_name=$mykingdom["kingdom_name"]; $mykingdom_king = $mykingdom["kingdom_king"]; $mykingdom_des = $mykingdom["kingdom_description"]; $castle_name=$mykingdom["castle_name"]; if(empty($pn)||$pn!=$castle_name){ $castle_guards = array(); array_push($castle,$castle_name,$mykingdom["castle_description"]); } $guard_name=$mykingdom["guard_name"]; if(empty($ln)||$ln!=$guard_name){ array_push($castle_guards,$guard_name, $mykingdom["guard_weapon"]); array_push($castle,$castle_guards); } if(empty($pn)||$pn!=$castle_name) array_push($castles,$castle); $gn=$guard_name; $cn=$castle_name; } Basically, I want to make the result of a query into an array like this one: Array [0]=>Array ([0]=>"Castle Rock",[1]=>King Hendrix,[2]=>Made of Sand, [3]=>Array([0]=>Timothy,[1]=> Thomas,[2]=>Kurt))) Array [1] ... would be even better it were associative: Array [0]=>Array (['castle_name']=>"Castle Rock",['castle_king']=>King Hendrix,['castle_description']=>Made of Sand, ['castle_guards']=>Array([0]=>Timothy,[1]=> Thomas,[2]=>Kurt))) Array [1] ... Now I could maybe make a class to handle this as an object but the server only supports PHP 4, and this seems like its the only way to go. All help is greatly appreciated and Thanks for reading.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.