Click here to Skip to main content
15,915,501 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
QuestionCloning a XLS worksheet in PHP Pin
Bijayani31-May-10 23:47
Bijayani31-May-10 23:47 
AnswerRe: Cloning a XLS worksheet in PHP Pin
Kristian Sixhøj3-Jun-10 7:29
Kristian Sixhøj3-Jun-10 7:29 
AnswerRe: Cloning a XLS worksheet in PHP Pin
Richard MacCutchan3-Jun-10 8:40
mveRichard MacCutchan3-Jun-10 8:40 
QuestionLearning Linux Pin
pc.bharti27-May-10 23:33
pc.bharti27-May-10 23:33 
AnswerRe: Learning Linux Pin
Richard MacCutchan28-May-10 0:10
mveRichard MacCutchan28-May-10 0:10 
GeneralRe: Learning Linux Pin
wbgxx21-Jun-10 3:58
wbgxx21-Jun-10 3:58 
AnswerRe: Learning Linux Pin
Iranian MM7-Sep-11 6:51
Iranian MM7-Sep-11 6:51 
QuestionPHP DOM Pin
vho12320-May-10 4:50
vho12320-May-10 4:50 
Having trouble with this little DOM PHP task. When i parse it from unix with the command -> php DOMSearch.php "Brookside"
it prints out

Channel 5
Start : 2001-07-0521:55:00

However, it should print out all channels and start times from the "Brookside" series like below:

Channel 4
Start : 2001-07-05T20:00:00
Start : 2001-07-05T20:30:00
Channel 5
Start : 2001-07-0521:55:00

my script is only going through the document once and only returning one result
can anyone help me how to keep looping through and print channel and start time when series matches what the user has entered.

**** PHP CODE ****
<?php<br />
$objDOM = new DOMDocument(); <br />
$objDOM->load('TVGuide.xml'); <br />
$series  = $argv[1];<br />
$channel = $objDOM->getElementsByTagName("Channel"); <br />
$chan = $channel->item(0)->nodeValue; <br />
foreach( $channel as $value )<br />
{<br />
    $names = $value->getElementsByTagName("Name");<br />
    $name = $names->item(0)->nodeValue;<br />
    $program = $objDOM->getElementsByTagName("Program");<br />
    foreach( $program as $prog )<br />
    {<br />
        $starts = $prog->getElementsByTagName("Start");<br />
        $start = $starts->item(0)->nodeValue;<br />
        $serie = $prog->getElementsByTagName("Series");<br />
        $ser = $serie->item(0)->nodeValue;<br />
    }<br />
}<br />
if($series == $ser)<br />
{<br />
    echo "$name\n";<br />
    echo "Start : $start\n";<br />
}  <br />
<br />
?>


**** XML SOURCE CODE ****



AnswerRe: PHP DOM Pin
Graham Breach20-May-10 7:06
Graham Breach20-May-10 7:06 
QuestionManaging a database insert failure.. Pin
MacIntyre19-May-10 4:57
MacIntyre19-May-10 4:57 
AnswerRe: Managing a database insert failure.. [modified] Pin
Dr.Walt Fair, PE19-May-10 5:26
professionalDr.Walt Fair, PE19-May-10 5:26 
GeneralRe: Managing a database insert failure.. Pin
MacIntyre19-May-10 5:39
MacIntyre19-May-10 5:39 
GeneralRe: Managing a database insert failure.. Pin
Dr.Walt Fair, PE19-May-10 6:02
professionalDr.Walt Fair, PE19-May-10 6:02 
GeneralRe: Managing a database insert failure.. Pin
MacIntyre19-May-10 6:32
MacIntyre19-May-10 6:32 
GeneralRe: Managing a database insert failure.. Pin
Dr.Walt Fair, PE19-May-10 6:53
professionalDr.Walt Fair, PE19-May-10 6:53 
GeneralRe: Managing a database insert failure.. Pin
MacIntyre19-May-10 7:53
MacIntyre19-May-10 7:53 
GeneralRe: Managing a database insert failure.. Pin
User 171649219-May-10 7:14
professionalUser 171649219-May-10 7:14 
GeneralRe: Managing a database insert failure.. Pin
MacIntyre19-May-10 7:54
MacIntyre19-May-10 7:54 
QuestionFile Conversion Pin
S p k 52117-May-10 18:44
S p k 52117-May-10 18:44 
Questionphp and batch files Pin
simpocoder17-May-10 3:13
simpocoder17-May-10 3:13 
AnswerRe: php and batch files Pin
User 171649217-May-10 3:22
professionalUser 171649217-May-10 3:22 
GeneralRe: php and batch files Pin
simpocoder17-May-10 4:10
simpocoder17-May-10 4:10 
GeneralRe: php and batch files Pin
cjoki17-May-10 11:43
cjoki17-May-10 11:43 
GeneralRe: php and batch files Pin
simpocoder18-May-10 22:53
simpocoder18-May-10 22:53 
GeneralRe: php and batch files Pin
cjoki1-Jun-10 14:19
cjoki1-Jun-10 14:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.