Jump to content


Photo

PHP and HTML and Frames


  • Please log in to reply
3 replies to this topic

#1 krixham

krixham
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 01 March 2006 - 07:27 PM

Now, this code is working, and I am getting the list that I need...

[blockquote]<body>

<?php

// Make the connection to MySQL and select the database

$conn = mysql_connect;
mysql_select_db;

$result=mysql_query('SELECT * FROM production_dirs') or die ("Error in query: " .mysql_error());

// Close the connection to MySQL

mysql_close();

echo "<table width='100%'>
<table style=\"font-family: arial; font-size: 10pt;\">";
$num=mysql_numrows($result);

// Start the loop
$i=0;
while ($i < $num) {

// Define your variables
// We only want to display the field proj_name for this exercise
$proj_name=mysql_result($result,$i,'proj_name');
// However we also need the job_name
$job_name=mysql_result($result,$i,'job_name');
// AND the job directory
$projdir=mysql_result($result,$i,'projdir');

echo "<tr>
<td>
[!--coloro:#3366FF--][span style=\"color:#3366FF\"][!--/coloro--]<a href=\"http://172.27.19.36/main.menu.php?$job_name\&$proj_name\&$projdir\" target=clienttype onclick='top.clienttype.location=\"../blank.html\"'> $proj_name \n</a>[!--colorc--][/span][!--/colorc--]
</td>
</tr>";

// End loop
$i++;
}

// End table
echo "</table>";
echo "</span>";
?>

<!-- Now end the HTML -->
</body>
</html>[/blockquote]

The problem is happening with the bolded line. Where I am sending the variables on to the next script, and using the clienttype frame on the web page.

What I need to do at this point is read another table and the results of that table determine if I go to the clienttype frame or the orderframe, depending on what is in the field 'job_id_name', Thing is right now everything goes right to clienttype. I know this is stupid, but does anyone have any suggestions?

For what it's worth, the script that I am trying to kick off is this one:

[blockquote]<?php
$input = ($_SERVER[argv][0]);
$input_array = explode("\&", $input);

echo "<pre>";print_r($input_array);echo "</pre>";

$client = $ARGV[0];
$name = $ARGV[1];
$jobdir = $ARGV[2];


// Make the connection to MySQL and select the database

$conn = mysql_connect;
mysql_select_db;

// Query your table
// In this case we are chosing from the jobinfo TABLE
// and are choosing ALL the entries

$result=mysql_query('SELECT * FROM jobinfo') or die ("Error in query: " .mysql_error());

// Close the connection to MySQL

mysql_close();

$num=mysql_numrows($result);

// We need the job_name
$job_name=mysql_result($result,$i,'job_name');
// We need the conf_file
$conf_file=mysql_result($result,$i,'conf_file');
// We need the job_id_name
$job_id_name=mysql_result($result,$i,'job_id_name');

if($job_id_name = '') {
system ("cd $jobdir");
system ("/usr/local/apache2/cgi-bin/order.cgi $client $job_name $conf_file jobdir");
} else {
system ("cd $jobdir");
system ("/usr/local/apache2/cgi-bin/choose.cgi $client $name");
print "$jobdir $client\n";
}
?>
exit 0;[/blockquote]

As you can see, I thought of trying to just kick off two seperate scripts. But, it isn't working. Oh, I can see why, I just don't know how to get around it.

This was SO much easier just using HTML and static tables. And the MySQL and PHP was my idea 8-(



#2 php_b34st

php_b34st
  • Members
  • PipPipPip
  • Advanced Member
  • 168 posts

Posted 01 March 2006 - 07:53 PM

it depends on how many different options are in the 'job_id_name' field, if there is only a few variations you could use something like:

if($job_id_name = 'option1')
{
    $target = 'clienttype';
}
else if($job_id_name = 'option2')
{
    $target = 'orderframe';
}
echo '<tr>
    <td><a href="url" target="'.$target.'">'.$proj_name.'</a></td>
      </tr>';

You can repeat the elseif as many times as you want but if there is a lot of different options you might want to see if there is an easier way than typing lots of else if statements.

#3 krixham

krixham
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 02 March 2006 - 07:37 PM

I've been trying and trying and trying to get this to work. I keep telling my boss that I am too stupid to be doing this, but he won't listen <S>.

Thank you php_b34st for the input, and I can see where it should work, but for some reason it just isn't doing what I need it to do.

There are only two choices under job_id_name - either it is blank or it has something in it. Which is where I am struggling. I need to display the first field based on proj_name, grouped by proj_name, or DISTINCT proj_name.

My issue is that I don't quite know the MYSQL commands to get the entire process to do what I need it to do.

Back to the old drawing board...

Maybe now my boss will believe it?????????????

Kathy

#4 krixham

krixham
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 06 March 2006 - 08:07 PM

This is now solved, thanks to some information in the topic 'selecting empty columns'. [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87617\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=87617[/a]

I appreciate the input I am receiving, and thank everyone for their help.

Kathy




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users