Jump to content

webguync

Members
  • Posts

    951
  • Joined

  • Last visited

Everything posted by webguync

  1. I am still having trouble with this. The if is being passed by even if the condition is met, and the else is displaying for all records. any ways to troubleshoot why this is happening?
  2. that seemed to do the trick, thanks a lot for all of your help!
  3. [10] would be the position in the SQL (f15) $sql = "SELECT f2,f3,phone,f8,f9,f10,f11,f12,f13,f15 FROM station ORDER BY f11 ASC" ; one more question, in the table structure, I now have: echo"<tr><td>$img</td> what is the best way to add the if else statement to that in order for the result to appear where $img currently is?
  4. I believe I posted this previously, but didn't get a reply which is the reason for the repost. This should be fairly simple, but I cannot figure it out! I have an image path delared in a variable $img= "<img src='icons/apo.gif' width='15' height='17' alt='airportindicator'>"; and I only want the image to display if a condition is met in a MySQL row which has a value of [10]. I have tried: if ( $row[10] == 1 ) { echo "<td>$img</td>"; } else { echo "<td></td>"; } but I believe the syntax is wrong. If the condition is not met, I want a blank value within the html <td></td>
  5. that makes sense, but I still get the invalid argument error in IE line 11 char 11 which looks like this line: row.style.display = "table-row";
  6. the really good news, is that this works in firefox now, but in stupid old IE, I get a JS error (IE 7) Could not get the display property, invalid argument. Line 7 char 11 that line is in the JS. This part: row.style.display = "table-row"; any ideas on why IE might be choking?
  7. thanks for the assistance. I still get the js error..what did you alter? I couldn't see at 1st glance. I will look into the pagination.
  8. the error I get is: document.getElementById(rowid) has no properties
  9. so, the parameter id using php/mysql would be [0] in the JS it would be function FuncShowHide(0){ ??
  10. so, it wouldn't litteraly be function FuncShowHide(rowid){ it would be whatever the value of the row ID is eg: function FuncShowHide(0){ ??
  11. in the php the reference should be $row[0], but in the js it should just be (row) without the [0]?
  12. I am still trying to get this to work, and have been playing around with different things. question: doesn't onClick='FuncShowHide(" . $row0 . ")'> need to match up with function FuncShowHide(row){ in the JS? that syntax is confusing me..whether it s/b (row) or (row0) or (row[0]). I think I tried all 3!
  13. I now have in the PHP echo"<tr id='". $row[0] . "'><td> $img </td><td> $row[6] </td><td> $row[0]</td><td> $row[1] </td><td id='header'><a href='#' onClick='FuncShowHide(" . $row0 . ")'> More Info.</a></td><td id='header'><a class='WHATSTHIS' onclick='selectLoc([0])' href='javascript:;'>Select this Location</a></td></tr>"; echo"<tr id='hideShow' style='display:none'><td><strong>Address:</strong> $row[3] </td><td><strong>Address:</strong>$row[4] </td><td><strong>City:</strong> $row[5] </td><td> $row[6]</td><td>$row[7] </td><td><strong>Phone:</strong> $row[2] </td></tr>"; } echo "</table>"; anything else stand out ? and still get the JS error? I also tried onClick='FuncShowHide(" . $row[0] . ")'>
  14. hmmm., I get a JavaScript error, after trying that (http://www.carrentalsupport.com/bruce/Query.php#) document.getElementById(row) has no properties what am I still missing? here is my current JS: <script language="javascript" type="text/javascript"> function FuncShowHide(row){ if (document.getElementById('hideShow').style.display == document.getElementById(row).style.display){ document.getElementById('hideShow').style.display = "none"; } else { document.getElementById('hideShow').style.display = document.getElementById(row).style.display } } </script> and in the php echo"<tr id='". $row[0] . "'><td>
  15. would you be able to provide a quick example? For instance, on each row in MySQL the column named f2 is a unique value for each row so I could use that. How would I need to add that to the HTML and JS is what I need an example of...thx!
  16. the JS is this: <script language="javascript" type="text/javascript"> function FuncShowHide(){ if (document.getElementById('hideShow').style.display == document.getElementById('trX').style.display){ document.getElementById('hideShow').style.display = "none"; } else { document.getElementById('hideShow').style.display = document.getElementById('trX').style.display } } </script> so I have the id of "hideshow"set to my second row and this only works for the first entry in the table here http://www.carrentalsupport.com/bruce/Query.php#,and not in the subsequent ones...
  17. Hello, I believe my issue here lies within the PHP/MySQL and not the JS. What I need is on this page http://www.carrentalsupport.com/bruce/Query.php# if you click the more info link in the first row, a second row displays with more info...this is what I want, but it only works for the first row, and I need it to work for all entries. here is my PHP/MySQL code <?php $connection = mysql_connect("localhost","username","password"); mysql_select_db ('dbname'); $sql = "SELECT f2,f3,phone,f8,f9,f10,f11,f12,f13,f15 FROM station ORDER BY f11 ASC" ; $sql_resulta = mysql_query($sql,$connection) or die('Query failed: ' . mysql_error()); //result set $rs = mysql_query($sql); $img= "<img src='icons/apo.gif' width='15' height='17' alt='airportindicator'>"; //creating the table w/ headers echo "<table id='display' cellpadding='0' cellspacing='0' align='center'><tr><td class='header'>Airport Indicator</td><td class='header'>State</td><td class='header'>Airport Code</td><td class='header'>Airport Name</td><td class='header' colspan='2'> </td></tr>"; //row for each record while ($row = mysql_fetch_array($rs)) { echo"<tr id='trX'><td> $img </td><td> $row[6] </td><td> $row[0]</td><td> $row[1] </td><td id='header'><a href='#' onClick='FuncShowHide()'> More Info.</a></td><td id='header'><a class='WHATSTHIS' onclick='selectLoc([0])' href='javascript:;'>Select this Location</a></td></tr>"; echo"<tr id='hideShow' style='display:none'><td><strong>Address:</strong> $row[3] </td><td><strong>Address:</strong>$row[4] </td><td><strong>City:</strong> $row[5] </td><td> $row[6]</td><td>$row[7] </td><td><strong>Phone:</strong> $row[2] </td></tr>"; } echo "</table>"; //close the db mysql_close(); echo "</body>"; echo "</html>"; ?> thanks for any assistance!
  18. I still haven't gotten this working, and need to...can anyone assist looking at my current code? where I have <td> $img </td> I need an if/else like... if ( $row[10] == 1 ) { echo "<td>$img</td>"; } else { echo "<td></td>"; } but I don't think that is exactly right... $connection = mysql_connect("localhost","username","pw"); mysql_select_db ('dbName'); $sql = "SELECT f2,f3,phone,f8,f9,f10,f11,f12,f13,f15 FROM station ORDER BY f11 ASC" ; $sql_resulta = mysql_query($sql,$connection) or die('Query failed: ' . mysql_error()); //result set $rs = mysql_query($sql); $img= "<img src='icons/apo.gif' width='15' height='17' alt='airportindicator'>"; //creating the table w/ headers echo "<table id='display' cellpadding='0' cellspacing='0' align='center'><tr><td id='header'>Airport Indicator</td><td id='header'>State</td><td id='header'>Airport Code</td><td id='header'>Airport Name</td><td id='header'>Select this Location</td></tr>"; //row for each record while ($row = mysql_fetch_array($rs)) { echo"<tr id='trX'><td> $img </td><td> $row[6] </td><td> $row[0]</td><td> $row[1] </td><td id='header'><a href='#' onClick='FuncShowHide()'> More Info.</a></td></tr>"; echo"<tr id='hideShow' style='display:none'><td><strong>Address:</strong> $row[3] </td><td><strong>Address:</strong>$row[4] </td><td><strong>City:</strong> $row[5] </td><td> $row[6]</td><td>$row[7] </td><td><strong>Phone:</strong> $row[2] </td></tr>"; } echo "</table>"; //close the db mysql_close(); echo "</body>"; echo "</html>"; ?>
  19. thanks for the code cleaning up advice, yes the image path will always be the same!
  20. the image needs to be withing this : while ($row = mysql_fetch_array($rs)) { echo"<tr id='trX'><td>" . $row['f15'] . "</td><td>" . $row['f11'] . "</td><td>" . $row['f2'] . "</td><td>" .$row['f3'] ."</td></tr>"; echo"<tr id='hideShow' style='display:none'><td>" . $row['f8'] . "</td><td>" . $row['f9'] . "</td><td>" . $row['f10'] . "</td><td>" .$row['f11'] ."</td><td>" .$row['f12'] ."</td><td>" .$row['phone'] ."</td></tr>"; } in another table data tag, so <td>image will go here if f15 == 1</td>
  21. so, basically I just need the image icon to display where I have my table setup in the first <td></td> declaration
  22. maybe it would help if I displayed the whole code, I have so far. I think I still have the image declaration wrong... <?php $connection = mysql_connect("localhost","username","password"); mysql_select_db ('db_name'); $sql = "SELECT f2,f3,phone,f8,f9,f10,f11,f12,f13,f15 FROM station ORDER BY f11 ASC" ; $sql_resulta = mysql_query($sql,$connection) or die('Query failed: ' . mysql_error()); //result set $rs = mysql_query($sql); //creating the table w/ headers echo "<table id='display' align='center'><tr><td id='header'>Airport Indicator</td><td id='header'>State</td><td id='header'>Airport Code</td><td id='header'>Airport Name</td><td id='header'><span onClick='toggle();'>More Info.</span></td><td id='header'>Select this Location</td></tr>"; if($myinfo[f15] == 1) { $img = '<tr><td><img src="icons/apo.gif" width="15" height="17" alt="airportindicator"></td></tr>'; } echo $img; //row for each record while ($row = mysql_fetch_array($rs)) { echo"<tr><td>" . $row['f11'] . "</td><td>" . $row['f2'] . "</td><td>" .$row['f3'] ."</td></tr>"; echo"<tr id='hidethis'><td>" . $row['f8'] . "</td><td>" . $row['f9'] . "</td><td>" . $row['f10'] . "</td><td>" .$row['f11'] ."</td><td>" .$row['f12'] ."</td><td>" .$row['phone'] ."</td></tr>"; } echo "</table>"; //close the db mysql_close(); echo "</body>"; echo "</html>"; ?>
  23. Hello, I am displaying the results of a my SQL table in HTML via PHP, and what I want to do for the first column is display and image based information is one of the MySQL columns. The Column is named 'f15' and I want to display the image if the data in the column is equal to 1. Here is what I have: echo"<tr><td>" . $row['if(f15 == 1){<img src=icons/apo.gif" width="15" height="17" alt="airportindicator"> else{}}] . "</td></tr>"; and it's not working. I have the icons folder with apo.gif located on the server. Again, I want to display the image if column f15 in the MySQL table is =1 and I want it to display with the HTML <td> syntax.
×
×
  • 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.