Jump to content

Round

Members
  • Posts

    104
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    England

Round's Achievements

Member

Member (2/5)

0

Reputation

  1. The server is the version it has always been. I don't control the server. PHP was upgraded when it needed to be and has stayed the same since. Haven't had any issues still using mssql_ It seems sqlsrv is an easier transition for the code to be changed. I will be looking into upgrading requests and code change. Many thanks
  2. Ok so I have tried the example and as I'm using mssql and not mysql I have had to change it a bit. I now have: $sqlsn = "SELECT system_name FROM tbl_sub_systems WHERE section=\"21a\""; $rssn = mssql_query( $sqlsn, $conn) or die ("Cannot execute"); $data = array_chunk(mssql_fetch_array($rssn), 2); echo "<table border=\"1\">"; foreach ($data as $row) { echo "<tr>"; if (count($row)==2) { foreach ($row as $n) echo "<td>".$n['system_name']."</td>"; } else { echo "<td colspan=\"2\">".$row[0]['system_name']."</td>"; } echo "</tr>"; } echo "</table>"; But it only ever return a count of 2. So it only creates 1 row of the table which oddly displays the first letter of the first result in each column. So for instance I have 3 records: AB CD EF The desired result being +--------+--------+ | AB | CD | +--------+--------+ | EF | +-----------------+ but I am getting +--------+--------+ | A | A | +--------+--------+ If the records are: Z1 Y1 X1 I get: +--------+--------+ | Z | Z | +--------+--------+ For starters I don't even understand why it's only displaying the first letter?? I am truly lost. Many thanks
  3. Exactly barand. Thanks I will have a look and try your example
  4. Hello All, I really hope I explain this properly. What I am attempting to achieve and I'm failing miserably at is to create the table layout based on the number of rows returned from a query. Basically if 1 row is returned I want a table to be structured like: <table> <tr> <td></td> </tr> </table> If 2 rows are returned structure like: <table> <tr> <td></td> <td></td> </tr> </table> if 3 rows are returned structure like: <table> <tr> <td></td> <td></td> </tr> <tr> <td colspan="2"></td> </tr> </table> The number of rows returned by the query is infinite. The last row of the table needs to be spanned across the 2 columns if the row count returned is odd. If the row count returned is equal I want each row of the table to have two columns. I know that if only one row is returned I could use: <table> <tr> <td colspan="2"></td> </tr> </table> to satisfy any if's/loops. I am really struggling with the fact the number of record rows returned is unknown. Any help much appreciated
  5. Hello, I definitely didn't cut and paste error. I added the get mssql_get_last_message to be connection include file and then loaded a page. After a few refreshes as it's intermittent I recieved the error and copied it from the page. Obviously I changed the dbname to a generic 1 as to not show my actual. I'll look at the ini settings you suggest. Thanks
  6. Hello Ch0cu3r, Thanks for the reply. I now get: Err:conn - Changed database context to 'databasename'. Many thanks
  7. Hello All, I hope someone can help. Recently and randomly mssql_connect is failing. I am using the code below to make the db connection: $conn = @mssql_connect( "SERVER", "username", "password" ) or die( "Err:conn"); $rs = @mssql_select_db( "database", $conn) or die( "ERR:Db"); For some reason every now and then a page will report Err:conn and a few page refreshes will then connect. Am I hitting a maximum connection number? Can anyone shed any light? Any help much appreciated. Build: PHP Version 5.2.6 Windows 2003 R2 Microsoft-IIS/6.0 Thanks
  8. No, sorry I wasn't very clear. The navbar loads at the bottom of the screen but when the user scrolls it doesn't stay at the bottom of the screen. It's becomes static to the point at where it loaded on the text etc. I don't. I will get the browser version etc. Thanks looks interesting. I will look into it. Many thanks to you both.
  9. Hello all, Sorry this may seem to be a double post but I'm pretty sure the first place I put this is incorrect! I put it in website critique and I'm after help with my layout (sorry mods remove the other post please) It's difficult to find a slot sometimes... Anyway... I have created a site aimed at mobiles. I know it's basic but this is to ensure load times are kept low and loads in low 3g areas etc and there will be a growing amount of info added. The problem I'm having is getting the footer nav bar to stay at the bottom. Works fine on apple ios and some android. Windows devices it loads at the bottom of the screen on first load but stays on that part of the page when scrolled and some androids it jumps around when scrolling. It's currently handled by css div#footer_wrapper { width: 100%; height: 150px; position:fixed !important; left:0; bottom:0; background-color:#000000; text-align:center; } Obviously some mobiles are not compatible with positon: fixed; I'm stuck for ideas on alternatives. Is css the right way to go about this? Also the images that are web links have white borders surrounding them on windows devices I can't seem to remove. but the following removes it on others: a{ color:#FFFFFF } Any help appreciated. Many thanks http://www.ccevents.netne.net
  10. Try this $result = mssql_query($query, $conn); in the place of: $result = mssql_query($query); As you have to specify which connection to use. A page may have multiple db connections
  11. Hello All, I have created a site aimed at mobiles. I know it's basic but this is to ensure load times are kept low and loads in low 3g areas etc and there will be a growing amount of info added. The problem I'm having is getting the footer nav bar to stay at the bottom. Works fine on apple ios and some android. Windows devices it does it's own thing each load and some androids it jumps around when scrolling. Also the images have white borders surrounding them on windows devices I can't seem to remove. Any help appreciated. Many thanks http://www.ccevents.netne.net
  12. Hello newladder, Sorry it's been a while. Yes I did find a solution, if it's still an issue you have too, I'll find the code and help you out. Cheers
  13. Forgot to mention, I am using the count because I was originally using odbc_num_rows to check for results but it would only ever return the result -1. I have also tried removing the while loop like so:- [code]$count=0;     while($temp = odbc_fetch_into($rs,&$counter)){         $count++;    } if ( $count !=0 ) { echo ("records found in new table"); #retrieve data $list = "<table align= \"center\" border=\"0\" cellpadding=\"4\" width=\"100%\">"; $list .= "<tr>"; $list .= "<th class=table>Column1</th>"; $list .= "<th class=table>Column2</th>"; $list .= "<th class=table width=\"30%\">Column3</th>"; $list .= "<th class=table width=\"40%\">Column4</th>"; $list .= "<th class=table>Column5</th>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td class=table>".$column1 = odbc_result($rs, "column1")."</td>"; $list .= "<td class=table>".$column2 = odbc_result($rs, "column2")."</td>"; $list .= "<td class=table width=\"30%\">".$column3 = odbc_result($rs, "column3")."</td>"; $list .= "<td class=table width=\"40%\">".$column4 = odbc_result($rs, "column4")."</td>"; $list .= "<td class=table>".$column5 = odbc_result($rs, "column5")."</td></tr><tr>"; $list .= "<th class=table colspan =\"5\">Column6<th></tr><tr>"; $list .= "<td class=table colspan =\"5\">".$column6 = odbc_result($rs, "column6")."</td>"; $list .= "</tr>"; $list .= "</table>"; echo( $list. "<br>" ); [/code] Which does work, but if they have two rows in the table will it only display one of them?? I need the while loop don't I? Thanks Again
×
×
  • 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.