Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Whoops. I suppose I should read the question before posting, no?
  2. Sorry, my omniscience seems to be lacking today. You could always try posting your code. Moreover, you could try posting your code in the javascript forum
  3. As i understood the the question, only one field from the datatabase was required. Using bluejay002's code, you would have a multidimensional array with all the fields. The problem with your code, laura, is that you are using strlen() to see how many elements there are in the array; you should be using count: $j=0; for ($j=0; $j<=count($link); ++$j){ echo $link[$j]."\n"; } You might find it easier to use a foreach loop with arrays, however: foreach($link as $v){ echo $v."\n"; } Finally, if you did only want the one field from your table, its very inefficient to select all the rows as you are doing. Modify your query to: select link from linkauto P.S. Welcome to the forums
  4. Like i said earlier: Otherwise, try posting what you've tried and tell us what happens/what doesn't happen and if you receive any errors.
  5. That's correct. You must call a function, otherwise the code in it will not be executed.
  6. At my school they used to have this webpage popup each time you logged in telling you of the rules. You 'had' to click a button to agree to the rules to get the window to go away. I used to hit Alt+F4 so my defence would always be i never agreed to the rules Before they upgraded to XP, you could gain access to the server. I was always tempted to modify said webpage.
  7. I agree; that's absolute rubbish. Just because they provide your internet does not give them the powers or rights to use any information they may gain from that. Sure, they have the right to monitor and log your usage, but there's a huge difference.
  8. I think you misread Orio -- you're code wasn't working, but only because the function was never called. Ken's code worked (it wasn't a function). You need to call the the function like so: function sum_array ($finCountArr) { $result = array(); foreach($finCountArr as $key => $val) //Sum each sub-array and put it into $result { //Do the sum $sum = 0; foreach($val as $num) $sum += $num; //Enter the sum into $result $result[$key] = $sum; } return $result; } sum_array($finCountArr); The reason why print_r() was echoing a 1 was just that -- you were echoing it, but it already does that for you in the function. You can either do this: echo '<pre>'; print_r($finCountArr); echo '</pre>'; Or, you can return the output of print_r by setting the second paramenter to true, and then echo it: echo '<pre>'.print_r($finCountArr,1).'</pre>';
  9. The only thing that defines an associative array is one in which the key has some meaning -- that is, it is is some way associated with the value. You would therefore wish to maintain this association throughout all array operations (sorting etc). This is as opposed to an array in which the keys have no specific meaning beyond being used to access the values. A multidimensional array is one in which one or more values of the array are arrays themsleves. So yeah, in essence, you were correct. But I thought i'd provide some clarification.
  10. Well, i dont know if you made the error in replacing your passwords, but you didn't close your quote on line 3. There is also a missing $ sign on line 11.
  11. Call me old fashioned, but you could have tried putting that in your first post so we actually had a clue what you were talking about. Anywho, see this FAQ.
  12. Perhaps it's just me, but i've no idea what you're actually asking.
  13. Why though? What if a user wanted to show someone a particular page on your website? If you really want to do it, your options are limited to the use of frames or loading all your content with AJAX.
  14. Indeed. You can use mod re-writing to make things look neater, but hiding the URL isn't worth it. It's also very annoying for the user.
  15. Im unsure as to how http_build_query() would handle a site with an SSL certificate. However, it can be done with the cURL library (see: http://www.php.net/curl). You have two choices with regard to the SSL certificate. You can either ignore it and don't check the certificate (set the curl option CURLOPT_SLL_VERIFYPEER to false) or you can provide or you can provide a file to check the validity of the SSL and set the file with the CURLOPT_CAINFO option. If you go for the second, you can find the .crt file you need by downloading a copy of cURL from http://curl.haxx.se/download.html
  16. Try this: <?php for ($Nommer = 0; $Nommer < $Count; $Nommer++){ $Name = Get_Member_Name($Winners[$Nommer]['MemberNumber']); echo "<tr bgcolor='#C0A062' onMouseover=this.bgColor='#FFF7DF' onMouseout=this.bgColor='#C0A062'> <td align='center'>{$Winners[$Nommer]['Date Won']}</td> <td align='center'>{$Winners[$Nommer]['MemberNumber']}</td> <td align='center'>{$Name}</td> <td align='center'>{$Winners[$Nommer]['TicketNumber']}</td> <td align='center'>{$Winners[$Nommer]['UserID']}</td> </tr>\n"; } ?> 1.) You were using $Winner instead of $Winners. 2.) PHP finds the echoing of multidimensional arrays ambigous. For example: //given this: echo "$array[0][0]"; //did you mean this: echo $array[0].'[0]'; //that is, the value of $array[0] followed by the literal string [0] //or this: echo $array[0][0]; //the value of the array at index [0][0] You can therefore place braces around the variable to remove ambiguity. 3.) You should place quotes around keys if they are strings. Changing your error_reporting to E_ALL would have helped you spot that much quicker as it would have warned you of undefined variables and constants. See here and the links on that page for more details.
  17. You've lost me a little. How about posting your updated code?
  18. Well, there's nothing actually wront with the above; either $row is empty or the field names aren't as listed. Never having used mssql, im guessing a touch. But either way, try this: <?php $Winners = array(); if($sr !== FALSE){ if(mssql_num_rows($sr) > 0){ while ($row = mssql_fetch_array($sr)){ echo '<pre>'.print_r($row,1).'</pre>'; $Winners[$row['UserNum']] = array('First Name'=>$row['FirstName'], 'Last Name'=>$row['LastName']); $Count++; } echo '<pre>'.print_r($Winners,1).'</pre>'; }else{ echo 'No results returned'; } }else{ echo 'Query failed'; } ?> It should narrow it down for you.
  19. Well, from your original post i was going to suggest this: <?php function showimagesize($im){ $Imagesize = getimagesize($_SERVER['DOCUMENT_ROOT']."/portfolio/images/".$im.""); $width = $Imagesize[0] + 40; $height = $Imagesize[1] + 40; echo "<td><a href=\"/portfolio/images/$im\" onclick=\"NewWindow(this.href,'name','$width','$height','yes');return false\">$im</a> </td>"; } showimagesize($rsEdit["ClientLogo"]); ?> But then im not sure if that is what you want given your last post.
  20. Use MySQL's average function: $result = mysql_query("SELECT AVG(yourfield) FROM yourtable") or die(mysql_error()); $average = mysql_result($result,0); echo 'Average: '.$average;
  21. I spose i could always try reading the post properly couldn't I? Well, i'm not mod_rewrite expert, but i would imagine that the problem is your pattern is matched by phones.php so you have an infinite loop. I wonder if using the L flag would prevent that?
  22. By doesn't work, do you mean you have a 404 error? E.g. box with a red cross it in? What does the source look like when you view it?
  23. Without realoading the page? Yeah, you'll need to use AJAX techniques. If you're happy to have a reload then you'll want to name your checkbox as an array with the value of the checkbox as the ID of the row. You can then implode the array and use IN in your update statement. Something like: $ids = implode(',',$_POST['checkboxes']; //assuming ID is numerical. Otherwise, you'll need to add quotes around each ID too. $sql = "UPDATE yourtable SET DISPOSE = 'yes' WHERE ID IN ($ids)";
  24. Just increment a number in your foreach loop: <?php $dirname = "./pics/"; $images = scandir($dirname); $ignore = Array(".", ".."); $total = 0; foreach($images as $curimg){ if(!in_array($curimg, $ignore)) { echo "\n<a href='./pics/$curimg' rel='lightbox' id='imgi' title='Prezentare Sablon'> <img src='./pics/$curimg' id='img' height='150px' />[/url]\n"; $total++; } } if($total > 5){ //upload not allowed } ?>
×
×
  • 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.