Jump to content

BladeMetal

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

BladeMetal's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. include won't work, it just generates an image not found symbol (the red x symbol). Also, sessions didn't work either. I tested with sessions while using include() and it found the variable and printed it for me(obviously, because it was also is the right scope, namely integrated to index.php). However, it doesn't seem to recognise it in a straight <img> tag. Trying cookies now. ok, it worked with cookies. Thanks for your help.
  2. Due to my website containing both images and text, I was forced to implement JPGraph using <img src="myscript.php"> However, my only issue is that I can't send values to it. The graph shows the average age of a football team over time and dynamically updates using a MySQL database. However, the graph is to used for many different football teams and I thought I could just use: [code] mysql_query("SELECT * FROM graph_data WHERE team_id=$team_id"); [/code] Because my script is external, is there anyway to get the $team_id variable from index.php into the external script (myscript.php)? If it can, then all my issues will be solved. Thanks in advance. -Adam
  3. Thanks heaps. I can't believe I didn't do that before. Thanks again, its much appreciated.
  4. [!--quoteo(post=364332:date=Apr 13 2006, 07:01 PM:name=shocker-z)--][div class=\'quotetop\']QUOTE(shocker-z @ Apr 13 2006, 07:01 PM) [snapback]364332[/snapback][/div][div class=\'quotemain\'][!--quotec--] [code] $sql2="SELECT profilehits FROM fusion_users WHERE user_name = '$owner'"; $result2=mysql_query($sql2); $rows2=mysql_fetch_array($result2); $views = $rows2['profileviews']; echo('before explode value is: '.$views.'<Br>') $arr = explode(',', $views); $i=0; foreach($arr as $count) { $i++; echo('Comma: '.$i.' Value:'.$count.'<Br>'); } [/code] This will help you by seeing origonal data, data being counted and so on.. [/quote] I think mysql_fetch_array() should read mysql_fetch_assoc() if I'm not mistaken.
  5. sure, $_POST is a super global, but it is used to access values from ONE page to another. You can't then go to a second page and expect the $_POST variables to stil work. The scope of $_POST is for the page referenced to in <form action="page.php"> meaning that only page.php can access the $_POST array values from the form.
  6. Hey, I've got a problem. If anyone can help me I'll be most appreciative. This is my code: [code] <?php //initial feed url $website = strtolower(file_get_contents("http://www.mywebsite.com")); //set haystack as website variable $haystack = $website; //set needle to link identifier $needle = "some text to find"; //determine how many times the needle is in the haystack $foundtimes = substr_count($haystack,$needle); //loop and save data to linkdb array for ($i=0;$i<$foundtimes;$i++) {        $pos[$i] = strpos($haystack,$needle,$i*350+4400);        $linkdb[$i] = substr($website,$pos[$i],30);     if (substr_count($linkdb[$i],'"')) {         $linkdb[$i] = str_replace('"',' ',$linkdb[$i]);     }     //print out the farmed links        echo $i." ".$pos[$i]." ".htmlentities($linkdb[$i])."<br>"; } ?> [/code] My issue is in the for loop. The $needle contents occurs 18 times in the website I'm pulling the contents from. So $foundtimes = 18. Is there a way to find each occurance of $needle in $haystack in such that once you find an occurance, you log its position, and when you loop back, start searching for the same string from the position of the previous string + 1? The above code works to an extent. The $i*350+4400 in strpos function causes some of the text to be found more than once which is not ideal of course. I've tried: [code] pos[0] = 0 for ($i=1;$i<=$foundtimes;$i++) {        $pos[$i] = strpos($haystack,$needle,$pos[$i-1]);        $linkdb[$i] = substr($website,$pos[$i],30);     if (substr_count($linkdb[$i],'"')) {         $linkdb[$i] = str_replace('"',' ',$linkdb[$i]);     }     //print out the farmed links        echo $i." ".$pos[$i]." ".htmlentities($linkdb[$i])."<br>"; } [/code] And it didn't work. All it returned was the same text from the same position. If anyone has any ideas, please let me know. Thanks in advance.
  7. Hi, Thanks heaps. Just what I needed!
  8. thanks, that worked a treat! Now I have one more issue. This is my code: [code] <?php $website = file_get_contents("http://www.website.com"); print $website; ?> [/code] This executes the HTML, but I would like it to display the HTML source on the screen as text rather than trying to display the original site. If this is possible let me know. Thanks.
  9. [!--quoteo(post=363894:date=Apr 12 2006, 03:14 PM:name=hadoob024)--][div class=\'quotetop\']QUOTE(hadoob024 @ Apr 12 2006, 03:14 PM) [snapback]363894[/snapback][/div][div class=\'quotemain\'][!--quotec--] hmm... maybe your problem is that $_SESSION variables are accessed using the following syntax: $_SESSION['seclevel'] and in your query string, you're accessing the value using: $_SESSION[seclevel] maybe you're just missing the single quotes? [/quote] no his syntax is 100% correct. When calling superglobals in something like an echo statement you can have: [code] echo 'This session superglobal equals $_SESSION[value]'; [/code]
  10. where 'whatever' equals the field name in your database
  11. I know that such a function exists to pull the source code off a website. I've used it before. However, I now can find the function no matter how hard I try. Any help greatly appreciated. And before someone asks, this is not for a malicious purpose. Its just to get data from a website and I have permission to pull it off the source. Thanks in advance! -BladeMetal
  12. I have a script I'm writing where the user inputs their birthday and the program returns their age in whole years. I had this script, but during leap years and daylight saving, it could be thrown out. $birth_date = $_POST['birthday_year'].'-'.$_POST['birthday_month'].'-'.$_POST['birthday_day']; //creates birthday as a string $manager_age = ((mktime() - strtotime($birth_date))/31556926); //finds the difference as a timestamp and divides by the number a seconds in a normal year echo floor($manager_age); //prints the output If someone could rewrite this for me so it actually works with leap years and daylight saving in mind it would be greatly appreciated. Cheers -Adam
  13. Hi I'm Adam I'm a 17 year old programmer I started programming when i was 13 using quickbasic :-( then moved to visual basic then decided web design was best and have been programming in php mysql since last year. I'm never heard of a female with the name Adam so obviously I'm male!
×
×
  • 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.