Jump to content

Corona4456

Members
  • Posts

    244
  • Joined

  • Last visited

    Never

Everything posted by Corona4456

  1. <?php class Connection { var $result; function Connection($localhost, $username, $password, $database){ $con = mysql_connect($localhost,$username,$password); mysql_select_db($database, $con); if($con) { $this->result = 'successful connection'; } else { $this->result = 'failed connection'; } } } // Add curly bracket here $test = &new Connection('localhost','***username(removed)***','***password(removed)***','cpt'); //line 18 echo $test->result; ?> You never close your brackets for your Connection class (see code for added curly bracket)
  2. It's an escape character. http://www.phpnoise.com/tutorials/25/3
  3. Ah I see the problem... I apologize ... since I don't have a way to test it, it's hard for me to see the error. <?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><td>$img</td><td> $row[6] </td><td> $row[0]</td><td> $row[1] </td><td id='header'><a href='#' onClick=\"FuncShowHide('$row[0]')\"> More Info.</a></td><td id='header'><a class='WHATSTHIS' onclick='selectLoc([0])' href='javascript:;'>Select this Location</a></td></tr>\n"; echo"<tr id='$row[0]' 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>\n"; } echo "</table>"; //close the db mysql_close(); echo "</body>"; echo "</html>"; ?>
  4. The only way I can think of doing it is this way: $sql = "SHOW TABLES" ; $result = mysql_query($sql,$connection) or die('Query failed: ' . mysql_error()); $total = 0; while($table = mysql_fetch_row($result)){ $sql = "SELECT COUNT(*) FROM `" . $table[0] . "`"; $result2 = mysql_query($sql, $connection); $row = mysql_fetch_row($result2); $total += $row[0]; } echo $total;
  5. onmouseover="showInfo('Austins Acres','austinsacres')" onmouseout="return nd();" Should be: onmouseover=\"showInfo('Austins Acres','austinsacres')\" onmouseout=\"return nd();\"
  6. Well I took a closer look at your code and it's pretty buggy so here take this code: Javascript: <script language="JavaScript" type="text/javascript"> function FuncShowHide(rowid){ row = document.getElementById(rowid); if(row.style.display == "none"){ row.style.display = "table-row"; } else { row.style.display = "none"; } } </script> <?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><td>$img</td><td> $row[6] </td><td> $row[0]</td><td> $row[1] </td><td id='header'><a href='#' onClick='FuncShowHide($row[0])'> More Info.</a></td><td id='header'><a class='WHATSTHIS' onclick='selectLoc([0])' href='javascript:;'>Select this Location</a></td></tr>\n"; echo"<tr id='$row[0]' 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>\n"; } echo "</table>"; //close the db mysql_close(); echo "</body>"; echo "</html>"; ?> Also, I'd suggest limiting the amount of results and add pagination... the page will load much faster. so your $sql will be: <?php $sql = "SELECT f2,f3,phone,f8,f9,f10,f11,f12,f13,f15 FROM station ORDER BY f11 ASC LIMIT 0, 20" ; ?> This is for testing purposes only though... later you can add code for pagination.
  7. <script language="javascript" type="text/javascript"> function FuncShowHide(rowid){ if (document.getElementById('hideShow').style.display == document.getElementById(rowid).style.display){ document.getElementById('hideShow').style.display = "none"; } else { document.getElementById('hideShow').style.display = document.getElementById(rowid).style.display } } </script> This is the code you need to have... copy and paste it exactly as written above
  8. Err... no, the function definition is function FuncShowHide(rowid) - where rowid is the parameter you pass in.
  9. oh I see what you are confused about ... here... let's change it up: <script language="javascript" type="text/javascript"> function FuncShowHide(rowid){ if (document.getElementById('hideShow').style.display == document.getElementById(rowid).style.display){ document.getElementById('hideShow').style.display = "none"; } else { document.getElementById('hideShow').style.display = document.getElementById(rowid).style.display } } </script> The PHP code for passing in the parameter should remain the same: <?php echo ... onClick='FuncShowHide(" . $row[0] . ")'> ... ?>
  10. Well... whether you do it with "" or '' you'll have to make sure and escape the proper character. So if you are using "" then you'll have to escape every " in the string and if you are using '' you'll have to escape every ' in the string.
  11. To define the class name for a tag just do the following: var pcss=document.getElementById('tabnavigation').getElementsByTagName('a')[0]; pcss.className = "whateverTheClassNameIs";
  12. I'm assuming you want to get the text within the 'a' tag: alert(pcss.text);
  13. You never passed in the row[0] into your function... look over the code again and look at the change made to the function call FuncShowHide().
  14. Change the following line: <?php 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>"; } ?> Just an FYI I didn't test this code so there may be some syntax errors or something like that. to <?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>"; } ?> Then change your javascript to: <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>
  15. Ah I see, document.getElementById returns the first element with the id 'trX'. You'll need to figure out a different method of uniquely identifying each row and passing in the unique id into your FuncShowHide() function. My suggestion would be to use the row id from the MySQL table to identify each table row.
  16. <?php header("Content-type: application/xhtml+xml"); ?>
  17. Could you show the javascript? Looks like you are using Ajax for this. Thanks.
  18. If you are using amaroK you can just use their web interface app: http://www.kde-apps.org/content/show.php?content=31871 Or if using XMMS: http://www.joethielen.com/xmms-control/ Whatever player you are using, odds are there is a web interface implementation somewhere out there .
  19. so are you sure that whatever is stored in $username is in the 'account' table? use 'mysql_error()' to see if you get an error for your mysql_query().
×
×
  • 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.