Home     Articles & Projects     Products & Web Services     Forum

Forum

CASE stock:asx.

Hi I need away to do the following (NOTE MYSQL code done just need to know how to use case to run different mysql's

if the user types is stock:Telstra then it searches all of the database
but if they type in stock:asx.Telstra then it runs the case stock but then see that there is the asx. and runs that Mysql that is in that case.

Can you help

<?php
$parts
= explode(":",$q);
  switch(
$parts[0])
  {
    case
"Stock":
    case
"stock":

//code

 
break;
}
?>

If RSS has Enclosure

Hi david just wondering what PHP code would i use to see if an RSS feed has an enclosure like the one below. All I need out of that is the URL link http://www.v8supercars.com.au/content/panelbeaters_podcast/2008_round_14... 14 Podcast.mp3

Any help welcomed.

<enclosure url="http://www.v8supercars.com.au/content/panelbeaters_podcast/2008_round_14_oran_park/files/20622/Round 14 Podcast.mp3" type="audio/x-mpeg"></enclosure>

Thanks

code taking very very long to run...

the following code at {link saved} is taking for ever to load.

code below I want this script to run every 5 min and also due to the list of RSS feeds will grow over time, I need away to have it so it runs 5 and then after 5 runs another 5 etc...

{code saved}

htaccess query

Hi.

I am trying to tidy up some php urls on one of my sites

e.g. http://www.gocaravanning.com/details/parkdetails.php?Name=Devon Cliffs Holiday Park&Urn=635

to show as http://www.gocaravanning.com/details/Devon_Cliffs_Holiday-Park-635.html

I have managed to get it to work as follows

http://www.gocaravanning.com/details/Devon%20Cliffs%20Holiday%20Park-635...

Is there a way in the htaccess file to change the %20 to be _ for example

Here is the htaccess I am using

RewriteEngine on
RewriteRule ^(.*)-(.*).html$ parkdetails.php?Name=$1&Urn=$2 [L]

Any help would be great

Many thanks

Simon

Displaying different images based on an if statement

Hi,

I am trying to get a php web page to show a different image based on if a field in the database is yes or no.

I have created this code but it shows the same image regardless of the setting. Please can someone tell me where i have gone wrong

<?php
if ($row_ful_site['TouringPitches']='Yes') {
echo
"<img src=http://www.gocaravanning.com/siteicons/touring_caravans.jpg";
}
else {
echo
"<img src=http://www.gocaravanning.com/siteicons/blank.jpg";
}
?>

Many thanks in advance

Simon
www.4theUK.com

seem if song time has already past

Hi I am looking for away to do the following.
In my database I have the following rows

songLength
Timestamp <-Time song started playing

in my PHP script I use $now to get the current time.

What i would like to do is find out if the song has finished playing and if it has I want to be able to show a message saying "This song finished X min/hours ago.

I am also having an issue with these two rows
t1.radio_now_playing_artist as song, <- this should be artist
t1.radio_now_playing_song as artist, <- this should be song

But when I do it
t1.radio_now_playing_artist as artist,
t1.radio_now_playing_song as song,

the $song shows the artist and the $artist shows the song...

here is the PHP code I use to get the data.

{code saved}

Limitting amount per load

Hi I am currently running the XML catch script in a cron job, however since I have over 50 XML feeds. Which puts that data into the mysql database.

What I need to do, due to it is taking around 10min to run the PHP page, I would like to be able to limit the number of feeds to say 5 each page load.

But what I need is for the script to auto go to the next 5 feeds and so on.

Is there anyway to do that?

Thanks

PHP Calculation

Calculation
1.666667*6= x : x=10.000002

I noticed Bing search engine can do calculations, I am wondering how I can build a calculator in my search engine, so all people do is type in what they want to calculate and it shows them the answer.

Any advice?

Login script

I am having a small issue with the following, even when i type in the correct information it still redirects me to the error page.
can you see any issues?

<?php
$login
= "SELECT * FROM tbl_user_account WHERE user_account_username = '".$username."' AND user_account_password = '".$password."'";
$result = mysql_query($login);

if (!
$result)
{
header('Location: login.php?error=1');
}
else
{
$sqlupdate = "UPDATE tbl_user_account SET user_account_last_login = '".$now."', user_account_last_login_ip = '".$ip."' WHERE user_account_username ='".$username."' AND user_account_password = '".$password."'";
setcookie("logincookie", $username, time()+3600);
header('Location: profile.php');
}
mysql_free_result($result);
?>

serialize SimpleXmlElement

Hi,
I have been working on this code for over 3 days, and all is working well. however the following is not doing what it should

I need it to serialize the category/s in an RSS feed. However I can not get it to work.

<?php
$feed
= file_get_contents("http://www.techau.tv/blog/?feed=rss2");
$xml = new SimpleXmlElement($feed);
foreach (
$xml->channel->item as $entry){
  echo
$entry->title.'<br/>';
  echo
$entry->description.'<br/><br/>';



 
    foreach (
$feed->channel->category as $kwordsarray) {
       
$keywordsArray[] = $kwordsarray;
        }

      
//serialize keyword array ready for posting in link
   
$keywords = str_replace( array('O:16:"SimpleXMLElement":0:{}', 'O:16:"SimpleXMLElement":'), array('s:0:"";', 'O:8:"stdClass":'), serialize(simplexml_load_string($keywordsArray)));
?>

Am I over thinking this?

Syndicate content